Closed handsomefengfeng closed 5 years ago
fix here by adding the subset name (val2017
, train2017
) before the name
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
'
或者 咱们可以用中文吗 T T ~~
I use the unziped file to solve the problem. It seems that there is something wrong with the environment.
To start the training,\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'
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`
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???