主要对yolov7实例分割版本的环境配置做简单介绍,并实现推理应用。相应的训练部分等后期发布后会及时更新。
1.配置环境
github上下载yolov7的mask分支代码和模型
2. 安装所需要的环境,注意torch版本
- 安装完成之后,下载安装detectron2。此处因为没有安装Git,使用的方法是先把整个文件下载下来,然后再cd到文件目录安装,地址下载地址https://github.com/facebookresearch/detectron2。
python setup.py install
出现问题:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: https://visualstudio.microsoft.com/visual-cpp-build-tools/
解决方法:
安装Visual Studio 2019
安装包在百度网盘,有详细的安装流程。
百度网盘https://pan.baidu.com/s/1_IRJWKeZtmPfsaOO7KoV7A
提取码:6666
根据自己需要勾选内容和设置位置。之后再进行python setup.py install
出现问题:
ModuleNotFoundError: No module named ‘pywintypes’
解决方法:
试了很多方法,最后通过降低版本解决。
pip install pywin32==227
将ipynb 文件转成 python 的.py文件
jupyter nbconvert --to python tools/instance.ipynb
,然后再将转换后的。py文件复制到主目录下,不然会出现引用路径不存在的问题。
出现问题:
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
解决方法:
删掉红色框内内容即可,位置根据索引,在上采样中
出现问题:
AttributeError: module ‘numpy’ has no attribute ‘int’.
解决方法:
这个地方是版本的问题,如果不想更换numpy的版本,把np.int换成int就可以。
之后就可以运行成功了。