Open sun-tao opened 2 years ago
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!
@Dipankar1997161 Hello can you please explain how did you use the model for your own dataset?
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