Co-DETR icon indicating copy to clipboard operation
Co-DETR copied to clipboard

Training on custom dataset

Open amira-essawy opened this issue 1 year ago • 7 comments

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 avatar Jul 04 '23 11:07 amira-essawy

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'

amira-essawy avatar Jul 04 '23 11:07 amira-essawy

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

TempleX98 avatar Jul 04 '23 15:07 TempleX98

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?

201411156 avatar Jul 05 '23 07:07 201411156

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 .

naonao-beibei avatar Jul 17 '23 08:07 naonao-beibei

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.

201411156 avatar Jul 17 '23 09:07 201411156

@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 avatar Jul 19 '23 08:07 abdulbasit0369

@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

201411156 avatar Jul 20 '23 01:07 201411156