zylo117 / Yet-Another-EfficientDet-Pytorch

The pytorch re-implement of the official efficientdet with SOTA performance in real time and pretrained weights.
GNU Lesser General Public License v3.0
5.21k stars 1.27k forks source link

Key Error:0 #663

Open moonlightian opened 3 years ago

moonlightian commented 3 years ago

tried to reform my dataset image ids to ints,but there are still errors. How should I make it right? By the way, I used VisDrone2019-Det

Traceback (most recent call last): File "train.py", line 326, in train(opt) File "train.py", line 211, in train for iter, data in enumerate(progress_bar): File "/home/yanwei/anaconda3/envs/edet/lib/python3.6/site-packages/tqdm/std.py", line 1178, in iter for obj in iterable: File "/home/yanwei/anaconda3/envs/edet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/home/yanwei/anaconda3/envs/edet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data return self._process_data(data) File "/home/yanwei/anaconda3/envs/edet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data data.reraise() File "/home/yanwei/anaconda3/envs/edet/lib/python3.6/site-packages/torch/_utils.py", line 394, in reraise raise self.exc_type(msg) KeyError: Caught KeyError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/yanwei/anaconda3/envs/edet/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/yanwei/anaconda3/envs/edet/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/yanwei/anaconda3/envs/edet/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/yanwei/yanwei_project_backup/EfficientDet/efficientdet/dataset.py", line 42, in getitem img = self.load_image(idx) File "/home/yanwei/yanwei_project_backup/EfficientDet/efficientdet/dataset.py", line 50, in load_image image_info = self.coco.loadImgs(self.image_ids[image_index])[0] File "/home/yanwei/anaconda3/envs/edet/lib/python3.6/site-packages/pycocotools/coco.py", line 229, in loadImgs return [self.imgs[id] for id in ids] File "/home/yanwei/anaconda3/envs/edet/lib/python3.6/site-packages/pycocotools/coco.py", line 229, in return [self.imgs[id] for id in ids] KeyError: '0'

zylo117 commented 3 years ago

Then I think you dataset is in wrong format