HRNet / HRNet-Object-Detection

Object detection with multi-level representations generated from deep high-resolution representation learning (HRNetV2h). This is an official implementation for our TPAMI paper "Deep High-Resolution Representation Learning for Visual Recognition". https://arxiv.org/abs/1908.07919
Apache License 2.0
644 stars 97 forks source link

KeyError: "There is no item named \'000000201722.jpg\' in the archive"\n' #33

Closed handsomefengfeng closed 5 years ago

handsomefengfeng commented 5 years ago

To start the training, python -m torch.distributed.launch --nproc_per_node 4 tools/train.py configs/hrnet/faster_rcnn_hrnetv2p_w32_syncbn_mstrain_1x.py --launcher pytorch But i got the error: `KeyError: 'Traceback (most recent call last):\n File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop\n samples = collate_fn([dataset[i] for i in batch_indices])\n File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in \n samples = collate_fn([dataset[i] for i in batch_indices])\n File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/mmdet-0.6rc0+8ccdbf2-py3.6.egg/mmdet/datasets/zip_dataset.py", line 209, in getitem\n data = self.prepare_train_img(idx)\n File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/mmdet-0.6rc0+8ccdbf2-py3.6.egg/mmdet/datasets/zip_dataset.py", line 218, in prepare_train_img\n img = load_img(img_info[\'filename\'], self.img_prefix)\n File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/mmdet-0.6rc0+8ccdbf2-py3.6.egg/mmdet/datasets/zip_dataset.py", line 57, in load_img\n data = io.BytesIO(f.read(filename))\n File "/usr/lib/python3.6/zipfile.py", line 1337, in read\n with self.open(name, "r", pwd) as fp:\n File "/usr/lib/python3.6/zipfile.py", line 1375, in open\n zinfo = self.getinfo(name)\n File "/usr/lib/python3.6/zipfile.py", line 1304, in getinfo\n \'There is no item named %r in the archive\' % name)\nKeyError: "There is no item named \'000000201722.jpg\' in the archive"\n'

`

I've re-downloaded the train2017.zip, test2017.zip, val2017.zip and annotations_trainval2017.zip from the official website but it didn't work.

What's the problem???

wondervictor commented 5 years ago

https://github.com/HRNet/HRNet-Object-Detection/blob/8ccdbf2e67173604758ac8027ec1807d8a492108/mmdet/datasets/zip_dataset.py#L46

fix here by adding the subset name (val2017, train2017) before the name

handsomefengfeng commented 5 years ago

Sorry, i could not understand you. Could you please be more detailed?

I've print filename and zipfilename

def load_img(filename, zipfilename): print("filename:", filename) print("zipfilename:", zipfilename) with zipfile.ZipFile(zipfilename, 'r') as f: data = io.BytesIO(f.read(filename)) img = Image.open(data).convert('RGB') img = np.array(img, dtype=np.float32) return img

The terminal shown : ' filename: 000000367020.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000304076.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000210679.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000142080.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000295134.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000362293.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000126067.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000507615.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000201722.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000380909.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000350289.jpg filename: 000000424137.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000227040.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000076462.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000365047.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000396269.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000294992.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000408957.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000137925.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000402909.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000560355.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000019962.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000369961.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000257923.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000550414.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000013302.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000064520.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000027163.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000293891.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000423201.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000375820.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000032629.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000448351.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000267734.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000168106.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000458846.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000028367.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000315631.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000005669.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip filename: 000000357774.jpg zipfilename: /home/yyf/HRNet-Object-Detection/data/coco/train2017.zip Traceback (most recent call last): File "tools/train.py", line 95, in main() File "tools/train.py", line 91, in main logger=logger) File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/mmdet-0.6rc0+8ccdbf2-py3.6.egg/mmdet/apis/train.py", line 57, in train_detector _dist_train(model, dataset, cfg, validate=validate) File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/mmdet-0.6rc0+8ccdbf2-py3.6.egg/mmdet/apis/train.py", line 102, in _dist_train runner.run(data_loaders, cfg.workflow, cfg.total_epochs) File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/mmcv/runner/runner.py", line 358, in run epoch_runner(data_loaders[i], **kwargs) File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/mmcv/runner/runner.py", line 260, in train for i, data_batch in enumerate(data_loader): File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 637, in next return self._process_next_batch(batch) File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch raise batch.exc_type(batch.exc_msg) KeyError: 'Traceback (most recent call last):\n File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop\n samples = collate_fn([dataset[i] for i in batch_indices])\n File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in \n samples = collate_fn([dataset[i] for i in batch_indices])\n File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/mmdet-0.6rc0+8ccdbf2-py3.6.egg/mmdet/datasets/zip_dataset.py", line 211, in getitem\n data = self.prepare_train_img(idx)\n File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/mmdet-0.6rc0+8ccdbf2-py3.6.egg/mmdet/datasets/zip_dataset.py", line 220, in prepare_train_img\n img = load_img(img_info[\'filename\'], self.img_prefix)\n File "/home/yyf/anaconda3/envs/pytorch/lib/python3.6/site-packages/mmdet-0.6rc0+8ccdbf2-py3.6.egg/mmdet/datasets/zip_dataset.py", line 59, in load_img\n data = io.BytesIO(f.read(filename))\n File "/usr/lib/python3.6/zipfile.py", line 1337, in read\n with self.open(name, "r", pwd) as fp:\n File "/usr/lib/python3.6/zipfile.py", line 1375, in open\n zinfo = self.getinfo(name)\n File "/usr/lib/python3.6/zipfile.py", line 1304, in getinfo\n \'There is no item named %r in the archive\' % name)\nKeyError: "There is no item named \'000000201722.jpg\' in the archive"\n

'

handsomefengfeng commented 5 years ago

或者 咱们可以用中文吗 T T ~~

handsomefengfeng commented 5 years ago

I use the unziped file to solve the problem. It seems that there is something wrong with the environment.