【mmdetection】AttributeError: COCO object has no attribute get_cat_ids

loading annotations into memory...
Done (t=0.49s)
creating index...
index created!
Traceback (most recent call last):
  File "tools/test.py", line 149, in <module>
    main()
  File "tools/test.py", line 101, in main
    dataset = build_dataset(cfg.data.test)
  File "/home/xx/mmcv/mmdetection/mmdet/datasets/builder.py", line 63, in build_dataset
    dataset = build_from_cfg(cfg, DATASETS, default_args)
  File "/home/xx/mmcv/mmcv/utils/registry.py", line 168, in build_from_cfg
    return obj_cls(**args)
  File "/home/xx/mmcv/mmdetection/mmdet/datasets/custom.py", line 71, in __init__
    self.data_infos = self.load_annotations(self.ann_file)
  File "/home/xx/mmcv/mmdetection/mmdet/datasets/coco.py", line 38, in load_annotations
    self.cat_ids = self.coco.get_cat_ids(cat_names=self.CLASSES)
AttributeError: 'COCO' object has no attribute 'get_cat_ids'

mmdetection 安裝完成後,編譯也沒有問題,在開始第一次訓練的的時候

python tools/test.py configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py checkpoints/  --show

報瞭如下錯誤,

AttributeError: 'COCO' object has no attribute 'get_cat_ids'

解決辦法:

重新安裝COCOAPI 

pip install -U "git+https://github.com/openmmlab/cocoapi.git#subdirectory=pycocotools"

解決!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章