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

I have an error when I load image file in data/coco/images/val2017 #175

Open
sun-tao opened this issue Apr 1, 2022 · 2 comments
Open

I have an error when I load image file in data/coco/images/val2017 #175

sun-tao opened this issue Apr 1, 2022 · 2 comments

Comments

@sun-tao
Copy link

sun-tao commented Apr 1, 2022

when I use !python3 pose_estimation/valid.py
--cfg experiments/coco/resnet50/256x192_d256x3_adam_lr1e-3.yaml
--flip-test
--model-file models/pytorch/pose_coco/pose_resnet_50_256x192.pth.tar
--workers 2
to valid the pretrained model,the following error happens!

=> classes: ['background', 'person']
=> num_images: 5000
=> load 6352 samples
=> fail to read data/coco/images/val2017/000000397133.jpg
Traceback (most recent call last):
File "pose_estimation/valid.py", line 168, in
=> fail to read data/coco/images/val2017/000000476258.jpg
main()
File "pose_estimation/valid.py", line 164, in main
final_output_dir, tb_log_dir)
File "/content/drive/MyDrive/simplepose /human-pose-estimation.pytorch/pose_estimation/../lib/core/function.py", line 108, in validate
for i, (input, target, target_weight, meta) in enumerate(val_loader):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 521, in next
data = self._next_data()
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
data.reraise()
File "/usr/local/lib/python3.7/dist-packages/torch/_utils.py", line 434, in reraise
raise exception
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/content/drive/MyDrive/simplepose /human-pose-estimation.pytorch/pose_estimation/../lib/dataset/JointsDataset.py", line 80, in getitem
raise ValueError('Fail to read {}'.format(image_file))
ValueError: Fail to read data/coco/images/val2017/000000397133.jpg

@Dipankar1997161
Copy link

This error occurs when the code is unable to locate your image file.

I encountered this when using my own dataset. The best way to sort this out is to keep that particular image outside the Val/Train folder and run the code again. For example: for Valid images. Instead of placing them inside /data/images/valid2017. Just keep it /data/images and then try. Try with 1 image and see if the same error occurs for the next image of the valid. Then you would understand.

It worked for me!

@zorica-zdravkovska
Copy link

@Dipankar1997161 Hello can you please explain how did you use the model for your own dataset?

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