question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'RetinaNet' object has no attribute 'CLASSES'

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sherlockedleecommented, May 26, 2019

@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.

1reaction
GuoxingYancommented, May 26, 2019

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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error trying to train the neural network - 'Namespace' object ...
1 Answer 1 · remove these lines from fit_generator() function call or · pass arguments with its name from your command line or...
Read more >
AttributeError: 'ResNet' object has no attribute 'get_features'
Hello i defined a method inside a class but i don't know why i'm getting the following error AttributeError: 'ResNet' object has no...
Read more >
Changelog — MMDetection 2.26.0 documentation
num_classes to indicate the class index of background labels. This change has no effect on the pre-trained models in the v2.x model zoo,...
Read more >
arcgis.learn module | ArcGIS API for Python
This format can be used with FasterRCNN, RetinaNet, SingleShotDetector and YOLOv3 models. Classified_Tiles : This option will output one classified image chip ...
Read more >
module 'torch' has no attribute 'pi' - You.com | The search engine you ...
python 3.x - pytorch, AttributeError: module 'torch' has no attribute . ... Enjoy best-in-class privacy and personalized search, from your address bar.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found