boxlevelset icon indicating copy to clipboard operation
boxlevelset copied to clipboard

IndexError: list index out of range

Open ccdongxu opened this issue 3 years ago • 5 comments

I ran into this problem when training with a custom data set.How to solve it? Traceback (most recent call last): File "tools/train.py", line 191, in main() File "tools/train.py", line 187, in main meta=meta) File "/content/drive/MyDrive/boxlevelset/mmdet/apis/train.py", line 172, in train_detector runner.run(data_loaders, cfg.workflow) File "/usr/local/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run epoch_runner(data_loaders[i], **kwargs) File "/usr/local/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 54, in train self.call_hook('after_train_epoch') File "/usr/local/lib/python3.7/site-packages/mmcv/runner/base_runner.py", line 307, in call_hook getattr(hook, fn_name)(self) File "/content/drive/MyDrive/boxlevelset/mmdet/core/evaluation/eval_hooks.py", line 147, in after_train_epoch key_score = self.evaluate(runner, results) File "/content/drive/MyDrive/boxlevelset/mmdet/core/evaluation/eval_hooks.py", line 177, in evaluate results, logger=runner.logger, **self.eval_kwargs) File "/content/drive/MyDrive/boxlevelset/mmdet/datasets/dcm.py", line 482, in evaluate cocoEval.evaluate() File "/usr/local/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 149, in evaluate self._prepare() File "/usr/local/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 110, in _prepare _toMask(gts, self.cocoGt) File "/usr/local/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 95, in _toMask rle = coco.annToRLE(ann) File "/usr/local/lib/python3.7/site-packages/pycocotools/coco.py", line 497, in annToRLE rles = maskUtils.frPyObjects(segm, h, w) File "pycocotools/_mask.pyx", line 292, in pycocotools._mask.frPyObjects IndexError: list index out of range

ccdongxu avatar Dec 13 '22 11:12 ccdongxu

@ccdongxu Hello, the annotaion json file needs the coco format. I upload the coco-style json file (Google driver) of VOC, you can refer to it.

LiWentomng avatar Dec 13 '22 15:12 LiWentomng

@LiWentomng Thank you for your answer.The coco-style json file contains segmentation fields and bbox fields. Does this mean that both segmentation annotation and target box annotation are required in my json?

ccdongxu avatar Dec 14 '22 08:12 ccdongxu

@ccdongxu The training process only needs the bbox fields in the train.json file. The val/test process need both segmentation and box fields to evaluate the segmentatio performance (or bbox annotaion for detection performance, opitional.)

LiWentomng avatar Dec 14 '22 08:12 LiWentomng

Do you mean that my val.json file must include segmentation fields?

TaoshuaiZ avatar Jul 20 '23 08:07 TaoshuaiZ

But my dataset is marked by myself, labeled with labelme, and then converted to coco format. There are only four numbers in the segmentation, but the segmentation in the dataset used by the author has many numbers. How to solve this problem?

TaoshuaiZ avatar Jul 21 '23 03:07 TaoshuaiZ