open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.71k stars 9.48k forks source link

TypeError: class `YOLOX` in mmdet/models/detectors/yolox.py: __init__() got an unexpected keyword argument 'input_size' #10140

Open Kodapsy opened 1 year ago

Kodapsy commented 1 year ago

I trained the YOLOX model on a Linux remote server with the following environment:

The environment is currently running without any problems on the remote server, but I now need to do model inference in local Windows. It seems that mmdet has been updated to 3.0, and my local Windows environment is as follows:

The following error was encountered:

Traceback (most recent call last):
  File "C:\Users\10352\.conda\envs\openmmlab\lib\site-packages\mmengine\registry\build_functions.py", line 121, in build_from_cfg
    obj = obj_cls(**args)  # type: ignore
TypeError: __init__() got an unexpected keyword argument 'input_size'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/10352/PycharmProjects/test/mmdetection/demo/devie_envir.py", line 8, in <module>
    model = init_detector(config_file, checkpoint_file, device='cpu')
  File "c:\users\10352\pycharmprojects\test\mmdetection\mmdet\apis\inference.py", line 61, in init_detector
    model = MODELS.build(config.model)
  File "C:\Users\10352\.conda\envs\openmmlab\lib\site-packages\mmengine\registry\registry.py", line 545, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "C:\Users\10352\.conda\envs\openmmlab\lib\site-packages\mmengine\registry\build_functions.py", line 241, in build_model_from_cfg
    return build_from_cfg(cfg, registry, default_args)
  File "C:\Users\10352\.conda\envs\openmmlab\lib\site-packages\mmengine\registry\build_functions.py", line 135, in build_from_cfg
    raise type(e)(
TypeError: class `YOLOX` in mmdet/models/detectors/yolox.py: __init__() got an unexpected keyword argument 'input_size'

I see similar bugs in both of the following problems: https://github.com/open-mmlab/mmdetection/issues/7044 https://github.com/airctic/icevision/issues/1062 But these solutions did not solve my problem and I would be grateful if someone could help me!

alfian-sensyn commented 1 year ago

is there any update ? should i use compatible version?