mmcv icon indicating copy to clipboard operation
mmcv copied to clipboard

[Bug] @BACKBONES.register_module() error

Open zbl929 opened this issue 2 years ago • 2 comments

Prerequisite

  • [X] I have searched Issues and Discussions but cannot get the expected help.
  • [X] The bug has not been fixed in the latest version(https://github.com/open-mmlab/mmcv).

Environment

mmseg==0.23.0 mmcv-full==1.5.0

Reproduces the problem - code sample

1

Reproduces the problem - command or script

I did not run through the script, but put the configuration file into the train file, I guarantee that he is OK.

Reproduces the problem - error message

TypeError: module must be a class, but got <class 'function'>

Additional information

When I used to register a module, I met three situations 1.Nextvit is the module that I registered successfully . image

I also tried to register the other two modules, but failed. Here 's what he looks like. 2.He first registered Vanillanet, but re-registered the vanillanet _ 5 module in another file. I can only use Vanillanet, but I don 't know how to use vanillanet _ 5. image image

3.The third is the module that I discussed with you before. It is not a class, but a function, and then the error message is as follows: TypeError: module must be a class, but got <class 'function'> image

I want to know how to solve the second and third cases, look forward to answering, thank you!

zbl929 avatar Jun 25 '23 06:06 zbl929

  1. What is the register_model in your second error?
  2. Upgrading your mmcv to 1.5.1 can fix the third error.

zhouzaida avatar Jun 25 '23 08:06 zhouzaida

Hello, first of all thank you for your answer.

  1. In the second error, I want to say that I will only use @ BACKBONES.register _ module ( ) instead of @ register _ model, just like the difference between Vaillanet and vaillanet _ 5 in the figure. I understand how to use Vaillanet, but I don 't know how to use vaillanet _ 5.
  2. In the third error,In the init ( ) under the mmseg file, write the following information: MMCV_MIN = '1.3.13' MMCV_MAX = '1.5.0' if upgrade mmcv to 1.5.1 will cause an error.

zbl929 avatar Jun 25 '23 11:06 zbl929