Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: "Unable to open object (object 'video_tensor(41)' doesn't exist)" #26

Open
Maruidear opened this issue Jul 2, 2020 · 10 comments

Comments

@Maruidear
Copy link

Maruidear commented Jul 2, 2020

I only modified the address of the dataset

Traceback (most recent call last):
File "train.py", line 142, in
solver.train()
File "train.py", line 60, in train
for batch_i, (feature, label, ) in enumerate(tqdm(self.train_loader, desc='Batch', ncols=80, leave=False)):
File "/home/student/maruidi/anaconda2/envs/FCSN/lib/python3.6/site-packages/tqdm/std.py", line 1129, in iter
for obj in iterable:
File "/home/student/maruidi/anaconda2/envs/FCSN/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 615, in next
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/student/maruidi/anaconda2/envs/FCSN/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 615, in
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/student/maruidi/anaconda2/envs/FCSN/lib/python3.6/site-packages/torch/utils/data/dataset.py", line 103, in getitem
return self.dataset[self.indices[idx]]
File "/home/student/maruidi/Frames/Video_Summary_using_FCSN-master/data_loader.py", line 17, in getitem
video = self.data_file['video
'+str(index)]
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "/home/student/maruidi/anaconda2/envs/FCSN/lib/python3.6/site-packages/h5py/_hl/group.py", line 264, in getitem
oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5o.pyx", line 190, in h5py.h5o.open
KeyError: "Unable to open object (object 'video_tensor(41)' doesn't exist)"

@SinDongHwan
Copy link

Hi @Maruidear.
Please check h5 file.
KeyError: "Unable to open object (object 'video_tensor(41)' doesn't exist)"

@Maruidear
Copy link
Author

@Maruidear
请检查h5文件。
KeyError:“无法打开对象(对象'video_tensor(41)'不存在)“

After I replaced the. H5 file, I found a new problem:
Traceback (most recent call last):
File "train.py", line 142, in
solver.train()
File "train.py", line 86, in train
mean_loss = torch.stack(sum_loss_history).mean().item()
RuntimeError: expected a non-empty list of Tensors

@Maruidear
Copy link
Author

I find "*.h5" is loaded and "sum_loss_history" is empty before line 86 in train.py.

@Maruidear
Copy link
Author

我发现train.py的第86行之前已加载“ * .h5”,并且“ sum_loss_history”为空。

and I think the reason for this problem is that train() failed to execute successfully.

@SinDongHwan
Copy link

Hi, @Maruidear

Please check "self.train_loader".
I think not excute for iteration because of empty.

@Maruidear
Copy link
Author

Hi,@SinDongHwan
Now I think that the dataset can be loaded successfully.And there is a 'KeyError: "Unable to open object (object 'video_tensor(17)' doesn't exist)"' problem.
I have never modified any code, and the.".h5"file is downloaded directly from github.

Traceback (most recent call last):
File "train.py", line 144, in
solver.train()
File "train.py", line 61, in train
for batch_i, (feature, label, ) in enumerate(tqdm(self.train_loader, desc='Batch', ncols=80, leave=False)):
File "/home/student/maruidi/anaconda2/envs/FCSN/lib/python3.6/site-packages/tqdm/std.py", line 1129, in iter
for obj in iterable:
File "/home/student/maruidi/anaconda2/envs/FCSN/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 615, in next
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/student/maruidi/anaconda2/envs/FCSN/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 615, in
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/student/maruidi/anaconda2/envs/FCSN/lib/python3.6/site-packages/torch/utils/data/dataset.py", line 103, in getitem
return self.dataset[self.indices[idx]]
File "/home/student/maruidi/Frames/Video_Summary_using_FCSN-master/data_loader.py", line 17, in getitem
video = self.data_file['video
'+str(index)]
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "/home/student/maruidi/anaconda2/envs/FCSN/lib/python3.6/site-packages/h5py/_hl/group.py", line 264, in getitem
oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5o.pyx", line 190, in h5py.h5o.open
KeyError: "Unable to open object (object 'video_tensor(7)' doesn't exist)"

@SinDongHwan
Copy link

Hi, @Maruidear
I didn't face a error, working well.
if you can tell me a id/pwd of teamviewer to my e-mail, i help you.

Video_Summary_using_FCSN_dev/data_loader.py:10: H5pyDeprecationWarning: The default file mode will change to 'r' (read-only) in h5py 3.0. To suppress this warning, pass the mode you need to h5py.File(), or set the global default h5.get_config().default_file_mode, or set the environment variable H5PY_DEFAULT_READONLY=1. Available modes are: 'r', 'r+', 'w', 'w-'/'x', 'a'. See the docs for details.
self.data_file = h5py.File(data_path)
Save parameters at save_dir/epoch-4.pkl
Epoch: 8%|██ | 4/50 [00:03<00:32, 1.43it/s, loss=0.691]train.py:106: H5pyDeprecationWarning: The default file mode will change to 'r' (read-only) in h5py 3.0. To suppress this warning, pass the mode you need to h5py.File(), or set the global default h5.get_config().default_file_mode, or set the environment variable H5PY_DEFAULT_READONLY=1. Available modes are: 'r', 'r+', 'w', 'w-'/'x', 'a'. See the docs for details.
with h5py.File(self.config.data_path) as data_file:
Save score at score_dir/epoch-4.json
+------+-----------+--------+---------+
| ID | Precision | Recall | F-score |
+------+-----------+--------+---------+
| 21 | 0.478 | 0.472 | 0.475 |
| 14 | 0.503 | 0.492 | 0.498 |
| 7 | 0.522 | 0.515 | 0.518 |
| 17 | 0.641 | 0.627 | 0.634 |
| 20 | 0.562 | 0.556 | 0.559 |
| 46 | 0.582 | 0.574 | 0.578 |
| 2 | 0.595 | 0.590 | 0.592 |
| 50 | 0.522 | 0.514 | 0.518 |
| 11 | 0.623 | 0.612 | 0.617 |
| 40 | 0.546 | 0.539 | 0.543 |
| mean | 0.557 | 0.549 | 0.553 |
+------+-----------+--------+---------+
Save parameters at save_dir/epoch-9.pkl
Save score at score_dir/epoch-9.json
+------+-----------+--------+---------+
| ID | Precision | Recall | F-score |
+------+-----------+--------+---------+
| 21 | 0.483 | 0.477 | 0.480 |
| 14 | 0.489 | 0.482 | 0.486 |
| 7 | 0.570 | 0.559 | 0.565 |
| 17 | 0.645 | 0.639 | 0.642 |
| 20 | 0.567 | 0.561 | 0.564 |
| 46 | 0.574 | 0.567 | 0.571 |
| 2 | 0.383 | 0.383 | 0.383 |
| 50 | 0.505 | 0.500 | 0.502 |
| 11 | 0.687 | 0.684 | 0.685 |
| 40 | 0.534 | 0.528 | 0.531 |
| mean | 0.544 | 0.538 | 0.541 |
+------+-----------+--------+---------+
Epoch: 22%|█████▎ | 11/50 [00:12<00:43, 1.12s/it, loss=0.622]^C
Traceback (most recent call last):
File "train.py", line 142, in
solver.train()
File "train.py", line 82, in train
self.optimizer.step()
File "/home/ml/.virtualenvs/vsumm/lib/python3.5/site-packages/torch/optim/adam.py", line 103, in step
denom = (exp_avg_sq.sqrt() / math.sqrt(bias_correction2)).add_(group['eps'])
KeyboardInterrupt

@Maruidear
Copy link
Author

Hi@SinDongHwan
Change to Python 3.5, the code will run successfully.
Thank you very much for your kind help.

@SinDongHwan
Copy link

Hi, @Maruidear.
Good~!!
I've not caught a python version. ^^

@wangsen-sen
Copy link

Hi, @Maruidear.
Good~!!
I've not caught a python version. ^^

Hi,I have the following problem :
Traceback (most recent call last):
File "train.py", line 141, in
solver.train()
File "train.py", line 56, in train
writer = summary(log_dir=self.config.log_dir)
TypeError: 'LazyModule' object is not callable

I don't know how to solve it. Can you give me some suggestions?Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants