这个问题出现在我将PolarMask的模型和配置文件拷贝到新安装的mmdetection中训练时发生的。
首先说主要原因,是因为PYTHONPATH环境变量中没有mmdetection下的build的某个子子目录(仔细看安装时的提示就解决了)
解决方法:
- 卸载mmdetection(或者也可以不卸载?我没试)
https://blog.csdn.net/jiraiya_wl/article/details/111404703 - 在~/.bashrc中写
(路径改成你自己的)
export PYTHONPATH="/mnt/h/Experiments/Code/mmdetection-2.21.0/build/bdist.linux-x86_64/egg/:$PYTHONPATH"
- 使环境变量生效
source ~/.bashrc
- 重新安装mmdetection
python setup.py install develop
我出现的问题解决方法就是这样,接下来就是硬件性能不够,加钱的问题了。
ImportError: cannot import name ‘force_fp32’
从mmdetection1迁移到mmdetection2
这两个函数需要这样导入
from mmcv.runner import auto_fp16, force_fp32
PolarMask: FPN: init() got an unexpected keyword argument ‘extra_convs_on_inputs’
这是在mmdetection种,应该把extra_convs_on_inputs和add_extra_convs这两个参数都统一了,extra_convs_on_inputs=False应该就等于直接
add_extra_convs=True,具体查看fpn.py的源码和
https://zhuanlan.zhihu.com/p/183098688