Hi,thanks for your brilliant work.I use mmdetection on my own dataset and train the retinanet_r50_fpn_1x.py.I have made MyDataset follow GETTING_STARTED,and replace the coco classes by my data classes in coco.py and core/evaluation/class_names.The trainning goes well,but when I run test.py,some error occurs:
loading annotations into memory...
Done (t=0.21s)
creating index...
index created!
[ ] 0/548, elapsed: 0s, ETA:Traceback (most recent call last):
File "tools/test.py", line 189, in <module>
main()
File "tools/test.py", line 159, in main
outputs = single_gpu_test(model, data_loader, args.show)
File "tools/test.py", line 29, in single_gpu_test
model.module.show_result(data, result, dataset.img_norm_cfg)
File "./PycharmProjects/mmdetection/mmdet/models/detectors/base.py", line 105, in show_result
class_names = self.CLASSES
File "./.conda/envs/open-mmlab/lib/python3.6/site-packages/torch/nn/modules/module.py", line 539, in __getattr__
type(self).__name__, name))
AttributeError: 'RetinaNet' object has no attribute 'CLASSES'
Can you tell me how to fix it?Thank you very much.
Are you using latest code for training and testing?
BTW, you don't need to modify the classes in coco.py and core/evaluation/class_names if you follow GETTING_STARTED.
@hellock Yes,I do use the latest code,and I try to fix this issue by modifying the classes.The evalution results can be shown when I use python tools/test.py configs/retinanet_r50_fpn_1x.py ./work_dirs/retinanet_r50_fpn_1x/epoch_12.pth --eval bbox.The issue occurs only when I use python tools/test.py configs/retinanet_r50_fpn_1x.py ./work_dirs/retinanet_r50_fpn_1x/epoch_12.pth --show.I don't know what happened,thanks for your reply.
@hellock Yes,I do use the latest code,and I try to fix this issue by modifying the classes.The evalution results can be shown when I use
python tools/test.py configs/retinanet_r50_fpn_1x.py ./work_dirs/retinanet_r50_fpn_1x/epoch_12.pth --eval bbox.The issue occurs only when I usepython tools/test.py configs/retinanet_r50_fpn_1x.py ./work_dirs/retinanet_r50_fpn_1x/epoch_12.pth --show.I don't know what happened,thanks for your reply.
Have you solved the above problem?
How to display recall and ap?
Are you using latest code for training and testing?
BTW, you don't need to modify the classes in coco.py and core/evaluation/class_names if you follow GETTING_STARTED.
i have the same problem.i use the voc format.
I solved it
in test.py modify
model.module.show_result(data, result, dataset.img_norm_cfg,dataset.CLASSES)
and in config/retinanet.py
def show_result(self, data, result, img_norm_cfg,CLASSES, kwargs):
super(CascadeRCNN, self).show_result(data, result, img_norm_cfg,CLASSES,*
*kwargs)
@GuoxingYan I modify the test.py but I don't understand the second modification,can you make it clear?BTW,after the modification in test.py,the picture can be shown but not in an automatic way,the picture update only after I press theenter,can you tell me why?Thx for your kind reply.
Fixed in #747