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

[Bug] YOLOX is not in the mmengine::model registry (same goes for Yolov7) #2837

Open
3 tasks done
levrone1987 opened this issue Nov 6, 2024 · 0 comments
Open
3 tasks done

Comments

@levrone1987
Copy link

Checklist

  • I have searched related issues but cannot get the expected help.
  • 2. I have read the FAQ documentation but cannot get the expected help.
  • 3. The bug has not been fixed in the latest version.

Describe the bug

This is my config file:

model = dict(
    type='YOLOX',  # YOLOX architecture
    backbone=dict(type='CSPDarknet', deepen_factor=1.0, widen_factor=1.0),  # YOLOX backbone
    neck=dict(type='YOLOXPAFPN', in_channels=[256, 512, 1024], out_channels=[256, 512, 1024]),
    bbox_head=dict(
        type='YOLOXHead',
        num_classes=1,  # Update this based on the number of classes in your dataset
        in_channels=256,
        feat_channels=256
    ),
    train_cfg=dict(assigner=dict(type='SimOTAAssigner', center_radius=2.5)),
    test_cfg=dict(score_thr=0.01, nms=dict(type='nms', iou_threshold=0.65))
)

The following code lists YOLOX:

from mmdet.registry import MODELS

# Print all available models in the registry
print(MODELS.module_dict.keys())

However, running this code:

from mmengine.config import Config
from mmengine.runner import Runner
from mmdet.utils import register_all_modules

# Register all modules for MMYOLO and MMDetection
register_all_modules()

def train_model(config_file):
    # Load the configuration
    cfg = Config.fromfile(config_file)
    
    # Ensure the working directory for checkpoints and logs
    cfg.work_dir = './checkpoints'  

    # Build the runner
    runner = Runner.from_cfg(cfg)
    
    # Start training
    runner.train()
    print("Training completed! Checkpoints saved to './checkpoints'.")


# Path to your configuration file
config_file = 'configs/yolov7/yolox_subset_coco.py'

# Train the model
train_model(config_file)

produces this error:

KeyError: 'YOLOX is not in the mmengine::model registry. Please check whether the value of `YOLOX` is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'

Same holds for YOLOv7 model, which is in fact the one I would like to use. What do you think is the error here?

Reproduction

See above

Environment

I followed this for installation:
https://github.com/open-mmlab/mmyolo?tab=readme-ov-file#%EF%B8%8F-installation-

I do not have GPU.

Error traceback

No response

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