Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: ConsistentTeacher: 'NoneType' object has no attribute 'num_scores' #61

Open
FLYDust1101 opened this issue Apr 28, 2024 · 1 comment

Comments

@FLYDust1101
Copy link

I have 1 GPU,and i run the code for 4000iters.

Before testing, I copyed DynamicSoftLabelAssigner to ConsistentTeacher-main\thirdparty\mmdetection\mmdet\core\bbox\assigners
and change init.py

from .dynamic_assigner import DynamicSoftLabelAssigner

__all__ = [
    'BaseAssigner', 'MaxIoUAssigner', 'ApproxMaxIoUAssigner', 'AssignResult',
    'PointAssigner', 'ATSSAssigner', 'CenterRegionAssigner', 'GridAssigner',
    'HungarianAssigner', 'RegionAssigner', 'UniformAssigner', 'SimOTAAssigner',
    'TaskAlignedAssigner', 'MaskHungarianAssigner', 'DynamicSoftLabelAssigner'
]

It seems worked with following code.

from mmdet.core.bbox.builder import BBOX_ASSIGNERS
print(BBOX_ASSIGNERS)

But it still have following error when testing. Should I register Class ConsistentTeacher and class FAM3D and... like DynamicSoftLabelAssigner???

loading annotations into memory...
Done (t=0.73s)
creating index...
index created!
Traceback (most recent call last):
  File "C:\Anaconda3\envs\ct\lib\site-packages\mmcv\utils\registry.py", line 52, in build_from_cfg               
    return obj_cls(**args)                                                                                       
  File "d:\lyb\consistentteacher-main\ssod\models\consistent_teacher.py", line 33, in __init__                   
    num_scores = self.train_cfg.num_scores                                                                       
AttributeError: 'NoneType' object has no attribute 'num_scores'                                                  
                                                                                                                 
During handling of the above exception, another exception occurred:                                              
                                                                                                                 
Traceback (most recent call last):                                                                               
  File "tools/test.py", line 261, in <module>                                                                    
    main()                                                                                                       
  File "tools/test.py", line 204, in main                                                                        
    model = build_detector(cfg.model, test_cfg=cfg.get("test_cfg"))                                              
  File "d:\lyb\consistentteacher-main\thirdparty\mmdetection\mmdet\models\builder.py", line 58, in build_detector
    return DETECTORS.build(
  File "C:\Anaconda3\envs\ct\lib\site-packages\mmcv\utils\registry.py", line 212, in build
    return self.build_func(*args, **kwargs, registry=self)
  File "C:\Anaconda3\envs\ct\lib\site-packages\mmcv\cnn\builder.py", line 27, in build_model_from_cfg
    return build_from_cfg(cfg, registry, default_args)
  File "C:\Anaconda3\envs\ct\lib\site-packages\mmcv\utils\registry.py", line 55, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
AttributeError: ConsistentTeacher: 'NoneType' object has no attribute 'num_scores'
@FLYDust1101
Copy link
Author

I run in the terminal

python tools/test.py configs\consistent-teacher\consistent_teacher_r50_fpn_coco_180k_10p.py\
work_dirs\consistent_teacher_r50_fpn_coco_180k_10p\iter_4000.pth\
--eval bbox
ConsistentTeacher-main
--ssod
----apis
----core
----datasets
----.....
--configs\consistent_teacher\...
--thirdparty
----mmdetection/mmdet/core/bbox/assigners
--------dyramic_assigner.py(add)
--work_dirs\consistent_teacher_r50_fpn_coco_180k_10p\...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant