跑mask2former 实例分割 遇到的一些问题

1.源码

facebookresearch/Mask2Former: Code release for "Masked-attention Mask Transformer for Universal Image Segmentation" (github.com)环境配置

Mask2Former/INSTALL.md at main · facebookresearch/Mask2Former (github.com)

测试与训练

Mask2Former/GETTING_STARTED.md at main · facebookresearch/Mask2Former (github.com)

由于需要编译多尺度注意力机制,建议在ubuntu上配置环境,windows很麻烦

问题1:ImportError: cannot import name 'FrozenBatchNorm2d' from 'torchvision.ops' 

timm模块的问题,降低版本即可

pip install timm==0.3.0

问题2:ModuleNotFoundError:

Please compile MultiScaleDeformableAttention CUDA op with the following commands:
        `cd mask2former/modeling/pixel_decoder/ops`
        `sh make.sh`

安装要求操作即可,windows上编译能成功,但是导入会出错,建议在ubuntu上运行,省事很多

问题3: TypeError: __init__() got an unexpected keyword argument 'dtype'

Installation — detectron2 0.6 documentation

此问题源自detectron安装,使用源码安装时,和你安装的pytorch等不匹配导致,建议按照上面detectron2官方的安装提示,安装预编译的版本;当然也可以升级/降级你的pytorch

问题4:AttributeError: module 'distutils' has no attribute 'version'

修改setuptools的版本

pip install setuptools==59.5.0

问题5:AttributeError: module 'numpy' has no attribute 'bool'. 

numpy版本太高,1.20即可

pip install numpy==1.20

测试过程

python demo/demo.py --config-file /public/home/chenweiwen/Mask2Former/configs/coco/instance-segmentation/maskformer2_R50_bs16_50ep.yaml --input input/1.jpg --opts MODEL.WEIGHTS model_final_3c8ec9.pkl

训练过程

python train_net.py --num-gpus 4 --config-file configs/coco/instance-segmentation/maskformer2_R50_bs16_50ep1.yaml

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值