MMRotate注册模型无法使用,提示is not in the model registry

问题:        

        使用MMRotate注册了backbone模型后,发现无法使用,出现错误:

'ModelName' is not in the model registry. Please check whether the value of `ModelName` is correct or it was registered as expected. 

        模型中的伪代码如下:(这里是mmrotate-1.x/mmdet-3.x,用法与mmrotate-0.x/mmdet-2.x不同)

from mmdet.registry import MODELS

...
@MODELS.register_module()
class ModelName(nn.Module):
...

        注册到__init__的伪代码如下:

from .model_name import ModelName
...

分析解决:

        跟踪代码后发现无论在mmrotate还是mmdet的registry中都找不到注册的ModelName,原因是在mmrotate里使用了mmdet.registry,需要使用mmrotate.registry,即:

from mmdet.registry import MODELS
# ->
from mmrotate.registry import MODELS

猜你喜欢

转载自blog.csdn.net/dou3516/article/details/130849247