open-mmlab / mmsegmentation

OpenMMLab Semantic Segmentation Toolbox and Benchmark.
https://mmsegmentation.readthedocs.io/en/main/
Apache License 2.0
8.29k stars 2.62k forks source link

KeyError: 'EncoderDecoder is not in the model registry. #3129

Open DotWang opened 1 year ago

DotWang commented 1 year ago

Traceback (most recent call last):
  File "tools/train.py", line 104, in <module>
    main()
  File "tools/train.py", line 93, in main
    runner = Runner.from_cfg(cfg)
  File "/work/home/dw/miniconda3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 439, in from_cfg
    runner = cls(
  File "/work/home/dw/miniconda3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 406, in __init__
    self.model = self.build_model(model)
  File "/work/home/dw/miniconda3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 808, in build_model
    model = MODELS.build(model)
  File "/work/home/dw/miniconda3/lib/python3.8/site-packages/mmengine/registry/registry.py", line 548, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "/work/home/dw/miniconda3/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 241, in build_model_from_cfg
    return build_from_cfg(cfg, registry, default_args)
  File "/work/home/dw/miniconda3/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 100, in build_from_cfg
    raise KeyError(
KeyError: 'EncoderDecoder is not in the model registry. Please check whether the value of `EncoderDecoder` 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'

This the official module used in the config

...
model = dict(
    type='EncoderDecoder',
    data_preprocessor=data_preprocessor,
    ...

I have installed mmseg many times.

MatCorr commented 1 year ago

I had the same problem a while ago. See if this solution will work for you.

https://github.com/open-mmlab/mmsegmentation/issues/2997