Megvii-BaseDetection / Megvii-BaseDetection/YOLOX

训练coco格式的数据集,出现以下这种情况

Open
#421 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

2021-08-09 13:51:54 | ERROR | yolox.core.launch:91 - An error has been caught in function 'launch', process 'MainProcess' (4300), thread 'MainThread' (140681679290560):
Traceback (most recent call last):

File "/home/warcraft/whrproject/YOLOX-main/tools/train.py", line 124, in
args=(exp, args),
│ └ Namespace(batch_size=32, ckpt='/home/warcraft/whrproject/YOLOX-main/yolox_l.pth', devices=0, dist_backend='nccl', dist_url=No...
└ ╒══════════════════╤═════════════════════════════════════════════════════════════════════════════════════════════════════════...

File "/home/warcraft/whrproject/YOLOX-main/yolox/core/launch.py", line 91, in launch
main_func(*args)
│ └ (╒══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <function main at 0x7ff282609cb0>

File "/home/warcraft/whrproject/YOLOX-main/tools/train.py", line 103, in main
trainer.train()
│ └ <function Trainer.train at 0x7ff27c2cee60>
└ <yolox.core.trainer.Trainer object at 0x7ff27aeea310>

File "/home/warcraft/whrproject/YOLOX-main/yolox/core/trainer.py", line 68, in train
self.before_train()
│ └ <function Trainer.before_train at 0x7ff278cc84d0>
└ <yolox.core.trainer.Trainer object at 0x7ff27aeea310>

File "/home/warcraft/whrproject/YOLOX-main/yolox/core/trainer.py", line 149, in before_train
no_aug=self.no_aug,
│ └ False
└ <yolox.core.trainer.Trainer object at 0x7ff27aeea310>

File "/home/warcraft/whrproject/YOLOX-main/yolox/exp/yolox_base.py", line 100, in get_data_loader
max_labels=50,

File "/home/warcraft/whrproject/YOLOX-main/yolox/data/datasets/coco.py", line 49, in init
self.annotations = self._load_coco_annotations()
│ │ └ <function COCODataset._load_coco_annotations at 0x7ff278cce950>
│ └ <yolox.data.datasets.coco.COCODataset object at 0x7ff270374b50>
└ <yolox.data.datasets.coco.COCODataset object at 0x7ff270374b50>

File "/home/warcraft/whrproject/YOLOX-main/yolox/data/datasets/coco.py", line 58, in _load_coco_annotations
return [self.load_anno_from_ids(_ids) for _ids in self.ids]
│ │ │ └ ['0000002_00005_d_0000014', '0000002_00448_d_0000015', '0000003_00231_d_0000016', '0000007_04999_d_0000036', '0000007_05499_d...
│ │ └ <yolox.data.datasets.coco.COCODataset object at 0x7ff270374b50>
│ └ <function COCODataset.load_anno_from_ids at 0x7ff278ccecb0>
└ <yolox.data.datasets.coco.COCODataset object at 0x7ff270374b50>

File "/home/warcraft/whrproject/YOLOX-main/yolox/data/datasets/coco.py", line 58, in
return [self.load_anno_from_ids(_ids) for _ids in self.ids]
│ │ │ │ │ └ ['0000002_00005_d_0000014', '0000002_00448_d_0000015', '0000003_00231_d_0000016', '0000007_04999_d_0000036', '0000007_05499_d...
│ │ │ │ └ <yolox.data.datasets.coco.COCODataset object at 0x7ff270374b50>
│ │ │ └ '0000002_00005_d_0000014'
│ │ └ '0000002_00005_d_0000014'
│ └ <function COCODataset.load_anno_from_ids at 0x7ff278ccecb0>
└ <yolox.data.datasets.coco.COCODataset object at 0x7ff270374b50>

File "/home/warcraft/whrproject/YOLOX-main/yolox/data/datasets/coco.py", line 61, in load_anno_from_ids
im_ann = self.coco.loadImgs(id_)[0]
│ │ │ └ '0000002_00005_d_0000014'
│ │ └ <function COCO.loadImgs at 0x7ff278cce290>
│ └ <pycocotools.coco.COCO object at 0x7ff270374790>
└ <yolox.data.datasets.coco.COCODataset object at 0x7ff270374b50>

File "/home/warcraft/anaconda3/envs/whrtorch/lib/python3.7/site-packages/pycocotools/coco.py", line 265, in loadImgs
return [self.imgs[id] for id in ids]
│ │ └ '0000002_00005_d_0000014'
│ └ {'0000002_00005_d_0000014': {'file_name': '0000002_00005_d_0000014.jpg', 'height': 540, 'width': 960, 'id': '0000002_00005_d_...
└ <pycocotools.coco.COCO object at 0x7ff270374790>
File "/home/warcraft/anaconda3/envs/whrtorch/lib/python3.7/site-packages/pycocotools/coco.py", line 265, in
return [self.imgs[id] for id in ids]
│ │ │ └ '0'
│ │ └ '0'
│ └ {'0000002_00005_d_0000014': {'file_name': '0000002_00005_d_0000014.jpg', 'height': 540, 'width': 960, 'id': '0000002_00005_d_...
└ <pycocotools.coco.COCO object at 0x7ff270374790>

KeyError: '0'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in yolox/data/datasets/coco.py at load_anno_from_ids and compare its image IDs with the lookup in pycocotools/coco.py. Reproduce training with the reported COCO dataset and determine why the lookup reaches the missing key '0'; done means the dataset loads without this KeyError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.