【mmseg】‘SegDataPreProcessor is not in the model registry问题解决

14 篇文章 0 订阅

问题描述:

        在使用mmseg的模型进行推理导出为torchscript时出错:

KeyError: "class `EncoderDecoder` in mmseg/models/segmentors/encoder_decoder.py: 'SegDataPreProcessor is not in the model registry. Please check whether the value of `SegDataPreProcessor` 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'"

分析解决:

        出错原因是模块没在注册信息中找到,需要添加mmseg注册模块代码。

from mmseg.utils import register_all_modules
register_all_modules()

        具体参考:

Here is the answer : #9719 (comment)

The whole thing can be fixed by adding this to you inference script :
from mmdet.utils import register_all_modules
register_all_modules()

I explain some of what I understood in the issue above, it's a problem of modules not being registered in mmengine MODELS registry (because they are in the mmdet MODELS registry) but the data preprocessors are initialized in mmengine scope so they are not found. I think this is an actual issue that could be fixed by using mmengine registry methods to search in the children of the MODELS registry in mmengine which contains the mmdet MODELS registry.

  • 7
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值