ChenhongyiYang / PlainMamba

[BMVC 2024] PlainMamba: Improving Non-hierarchical Mamba in Visual Recognition
Apache License 2.0
65 stars 6 forks source link

KeyError: "EncoderDecoder: 'PlainMamba is not in the models registry'" #7

Open starashima opened 3 weeks ago

starashima commented 3 weeks ago

Hi, thank you for sharing your work.

I’m trying to perform semantic segmentation using PlainMamba, but I encountered errors when running commands like tools/get_flops.py and tools/dist_test.sh. Could someone please assist me with this? I would greatly appreciate your guidance.

cd PlainMamba/downstream/mmsegmentation && python tools/get_flops.py plain_mamba_seg_configs/l1_upernet.py

/usr/local/lib/python3.10/site-packages/mmcv/__init__.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.
  warnings.warn(
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/mmcv/utils/registry.py", line 69, in build_from_cfg
    return obj_cls(**args)
  File "/root/PlainMamba/downstream/mmsegmentation/mmseg/models/segmentors/encoder_decoder.py", line 36, in __init__
    self.backbone = builder.build_backbone(backbone)
  File "/root/PlainMamba/downstream/mmsegmentation/mmseg/models/builder.py", line 20, in build_backbone
    return BACKBONES.build(cfg)
  File "/usr/local/lib/python3.10/site-packages/mmcv/utils/registry.py", line 237, in build
    return self.build_func(*args, **kwargs, registry=self)
  File "/usr/local/lib/python3.10/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg
    return build_from_cfg(cfg, registry, default_args)
  File "/usr/local/lib/python3.10/site-packages/mmcv/utils/registry.py", line 61, in build_from_cfg
    raise KeyError(
KeyError: 'PlainMamba is not in the models registry'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/PlainMamba/downstream/mmsegmentation/tools/get_flops.py", line 159, in <module>
    main()
  File "/root/PlainMamba/downstream/mmsegmentation/tools/get_flops.py", line 124, in main
    model = build_segmentor(
  File "/root/PlainMamba/downstream/mmsegmentation/mmseg/models/builder.py", line 48, in build_segmentor
    return SEGMENTORS.build(
  File "/usr/local/lib/python3.10/site-packages/mmcv/utils/registry.py", line 237, in build
    return self.build_func(*args, **kwargs, registry=self)
  File "/usr/local/lib/python3.10/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg
    return build_from_cfg(cfg, registry, default_args)
  File "/usr/local/lib/python3.10/site-packages/mmcv/utils/registry.py", line 72, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
KeyError: "EncoderDecoder: 'PlainMamba is not in the models registry'"
ChenhongyiYang commented 3 weeks ago

Hi, you may need to run "pip install -e ."

starashima commented 3 weeks ago

Thank you very much for your quick reply.

I successfully ran pip install -e . in ./PlainMamba, ./PlainMamba/downstream/mmdetection, and ./PlainMamba/downstream/mmsegmentation. I was able to perform object detection in ./PlainMamba/downstream/mmdetection, but I encountered the above error when trying to perform segmentation in ./PlainMamba/downstream/mmsegmentation.

This might not be related, but it appears that PlainMamba has not been registered in the mmseg/models/backbones/init.py file.