一、代码地址
github地址:https://github.com/NVlabs/SegFormer
二、我的系统配置:
1、硬件
2、软件
win10,vs2022,python3.7
三、创建虚拟环境
conda create -n MySegFormer python=3.7 numpy
conda activate MySegFormer
python
会显示如下
>>>Python 3.7.15 (default, Nov 24 2022, 18:44:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
四、安装pytorch
具体详见我的博客:https://blog.csdn.net/gaoenyang760525/article/details/126005478
cd D:\BaiduNetdiskDownload
pip install torch-1.13.0+cu117-cp37-cp37m-win_amd64.whl
pip install torchvision-0.14.0+cu117-cp37-cp37m-win_amd64.whl
五、安装其他
pip install cython matplotlib opencv-python
我的提示:Successfully installed cycler-0.11.0 cython-0.29.33 fonttools-4.38.0 kiwisolver-1.4.4 matplotlib-3.5.3 opencv-python-4.7.0.68 packaging-23.0 pyparsing-3.0.9 python-dateutil-2.8.2
六、一键安装预编译 MMCV
pip install -U openmim
mim install mmcv
就这两句话,成功安装mmcv。不用看那么多博客写的编译什么的。
Successfully installed addict-2.4.0 mmcv-full-1.7.1 regex-2022.10.31 yapf-0.32.0
MIM 在手,OpenMMLab 我有!
七、安装timm
pip install timm==0.3.2
Successfully installed timm-0.3.2
八、安装mmsegmentation
anaconda powershell prompt切换到segformer源代码所在文件夹,并且执行:
pip install -e . --user
Successfully installed mmsegmentation terminaltables-3.1.10