Sense-X / Co-DETR

[ICCV 2023] DETRs with Collaborative Hybrid Assignments Training
MIT License
1.02k stars 113 forks source link

Training on custom dataset #5

Open amira-essawy opened 1 year ago

amira-essawy commented 1 year ago

Thank you for your work. I'm training using my custom dataset but I got that error

KeyError: 'CoDETR is not in the models registry'
amira-essawy commented 1 year ago

This is error is resolved but I got another one:

Traceback (most recent call last):
  File "/opt/conda/envs/codetr/lib/python3.8/site-packages/mmcv/utils/registry.py", line 52, in build_from_cfg
    return obj_cls(**args)
TypeError: __init__() got an unexpected keyword argument 'with_cp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/envs/codetr/lib/python3.8/site-packages/mmcv/utils/registry.py", line 52, in build_from_cfg
    return obj_cls(**args)
  File "/root/workspace/amiras/Co-DETR/projects/models/co_detr.py", line 33, in __init__
    self.backbone = build_backbone(backbone)
  File "/root/workspace/amiras/Co-DETR/mmdet/models/builder.py", line 20, in build_backbone
    return BACKBONES.build(cfg)
  File "/opt/conda/envs/codetr/lib/python3.8/site-packages/mmcv/utils/registry.py", line 215, in build
    return self.build_func(*args, **kwargs, registry=self)
  File "/opt/conda/envs/codetr/lib/python3.8/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg
    return build_from_cfg(cfg, registry, default_args)
  File "/opt/conda/envs/codetr/lib/python3.8/site-packages/mmcv/utils/registry.py", line 55, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
TypeError: SwinTransformerV1: __init__() got an unexpected keyword argument 'with_cp'
TempleX98 commented 1 year ago

You can set use_checkpoint=True instead of with_cp=True. For Swin Transformer, we do not use the mmdet version and follow the original implementation (https://github.com/SwinTransformer/Swin-Transformer-Object-Detection).

201411156 commented 1 year ago

Thank you for your work. I'm training using my custom dataset but I got that error

KeyError: 'CoDETR is not in the models registry'

how can you resolved 'CoDETR ~ registry' problem?

naonao-beibei commented 1 year ago

Thank you for your work. I'm training using my custom dataset but I got that error

KeyError: 'CoDETR is not in the models registry'

how can you resolved 'CoDETR ~ registry' problem?

pip install -v -e .

201411156 commented 1 year ago

Thank you for your work. I'm training using my custom dataset but I got that error

KeyError: 'CoDETR is not in the models registry'

how can you resolved 'CoDETR ~ registry' problem?

pip install -v -e .

Thank you for the answer! My case, I resolved it by moving some files(ex> co_~~) from 'projects/models/' to 'mmdetection/mmdet/models/detector and dense_heads/' and importing the class in init.py.

abdulbasit0369 commented 1 year ago

@201411156 I am facing a similar issue. Can you share the exact files that needs to be moved also where to import these files?

201411156 commented 1 year ago

@201411156 I am facing a similar issue. Can you share the exact files that needs to be moved also where to import these files? @abdulbasit0369

my projects folder's structure : Co-DETR/projects/models/co_atss_head.py , co_deforamable_detr_head.py, co_detr.py, co_roi_head.py, swin_transformaer.py, transformer.py and copy this upper files to mmdet/modles or mmdetection/mmdet/models folder. ex) projects/models/co_detr.py -> mmdet/models/detector/co_detr.py and add import in mmdet/models/detector/init.py -> from .co_detr import CoDETR Others co_attss_head.py, co_deformable_detr_head.py, co_roi_head.py are copy to models/dense_heads/ and add code to /models/dense_head/init.py from .co_deformable_detr_head import CoDeformDETRHead from .co_roi_head import CoStandardRoIHead from .co_atss_head import CoATSSHead