open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.08k stars 9.38k forks source link

Searching for help!!!KeyError:'ann_info' #4843

Closed Naive-Bayes closed 3 years ago

Naive-Bayes commented 3 years ago

Thanks for your error report and we appreciate it a lot.

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. I have read the FAQ documentation but cannot get the expected help.
  3. The bug has not been fixed in the latest version.

Describe the bug when i want to train a model, it have run first epoch and begin validation, "KeyError:'ann_info'" arised. But when i add a parse "--no-validate", it can continue. Reproduction

CUDA_VISIBLE_DEVICES=1,2,3 bash ./tools/dist_train.sh ./configs/faster_rcnn_r50_fpn_1x_city.py 3 --work-dir ./my_test/
  1. Did you make any modifications on the code or config? Did you understand what you have modified?
  2. What dataset did you use? Citypersons

Environment

  1. Please run python mmdet/utils/collect_env.py to collect necessary environment information and paste it here.
  2. You may add addition that may be helpful for locating the problem, such as
    • How you installed PyTorch [e.g., pip, conda, source]
    • Other environment variables that may be related (such as $PATH, $LD_LIBRARY_PATH, $PYTHONPATH, etc.)

Error traceback If applicable, paste the error trackback here.

Original Traceback (most recent call last):
  File "/home/oneco/miniconda3/envs/mmdetection/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/oneco/miniconda3/envs/mmdetection/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/oneco/miniconda3/envs/mmdetection/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/oneco/mmdetection/mmdet/datasets/custom.py", line 191, in __getitem__
    return self.prepare_test_img(idx)
  File "/home/oneco/mmdetection/mmdet/datasets/custom.py", line 234, in prepare_test_img
    return self.pipeline(results)
  File "/home/oneco/mmdetection/mmdet/datasets/pipelines/compose.py", line 40, in __call__
    data = t(data)
  File "/home/oneco/mmdetection/mmdet/datasets/pipelines/loading.py", line 366, in __call__
    results = self._load_bboxes(results)
  File "/home/oneco/mmdetection/mmdet/datasets/pipelines/loading.py", line 240, in _load_bboxes
    ann_info = results['ann_info']
KeyError: 'ann_info'

Bug fix If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!

fengyouliang commented 3 years ago

you may check you dataset, ensure annotations is correct

Naive-Bayes commented 3 years ago

yes,i reconstructed the datasets,and now mmdetection can work. Thank you for help!!!

abhilashkasarla commented 2 years ago

Can you please describe what was the issue? I am facing the same error.