AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4.

 安装mmsegmentation

项目文件预览 - GitCode 链接

Get started: Install and Run MMSeg

environment with PyTorch.

MMSegmentation works on Linux, Windows and macOS. It requires Python 3.7+, CUDA 10.2+ and PyTorch 1.8+.

Step 1. Create a conda environment and activate it.

conda create --name openmmlab python=3.8 -y
conda activate openmmlab

Step 2.  PyTorch  环境配置

On GPU platforms:  创建环境,配置pytorch 环境(轮子提前下载到电脑上)

pip install E:\install\cuda_install\whl_cu116\torch-1.13.1+cu116-cp38-cp38-win_amd64.whl
pip install E:\install\cuda_install\whl_cu116\torchaudio-0.13.1+cu116-cp38-cp38-win_amd64.whl
pip install E:\install\cuda_install\whl_cu116\torchvision-0.14.1+cu116-cp38-cp38-win_amd64.whl

Installation

We recommend that users follow our best practices to install MMSegmentation. However, the whole process is highly customizable. See Customize Installation section for more information.

Best Practices

Step 0. Install MMCV using MIM.

pip install -U openmim
mim install mmengine
mim install "mmcv>=2.0.0"

Step 1. Install MMSegmentation.

Case a: If you develop and run mmseg directly, install it from source:

git clone -b main https://github.com/open-mmlab/mmsegmentation.git
cd mmsegmentation
pip install -v -e .
# '-v' means verbose, or more output
# '-e' means installing a project in editable mode,
# thus any local modifications made to the code will take effect without reinstallation.

这里可能遇到问题 (因为没有安装git.所以出现)

git 不是内部或外部命令,也不是可运行的程序 或批处理文件“

解决方法:下载Git  https://git-scm.com/官网下载并安装

并在 电脑—>属性->高级系统设置->环境变量->系统变量->path->编辑

添加

用demo验证MMSegmentation安装是否正确

Step 1. We need to download config and checkpoint files.

mim download mmsegmentation --config pspnet_r50-d8_4xb2-40k_cityscapes-512x1024 --dest .

The downloading will take several seconds or more, depending on your network environment. When it is done, you will find two files pspnet_r50-d8_4xb2-40k_cityscapes-512x1024.py and pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth in your current folder.

Step 2. Verify the inference demo.

Option (a). If you install mmsegmentation from source, just run the following command.

python demo/image_demo.py demo/demo.png configs/pspnet/pspnet_r50-d8_4xb2-40k_cityscapes-512x1024.py pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth --device cuda:0 --out-file result.jpg

第二步出现错误

AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4.

原因:mmcv版本和torch以及cuda版本冲突问题导致的

解决方案: 

先查看自己的troch和cuda版本:

python
import torch
print(torch.__version__)

去官网找相应的MMCV版本安装 MMCV — mmcv 2.0.0 文档

https://mmcv-zh-cn.readthedocs.io/zh_CN/2.x/get_started/installation.html

pip install mmcv==2.0.0rc3 -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.13/index.html

出现错误 AssertionError: MMCV==2.0.0rc3 is used but incompatible. Please install mmcv>=2.0.0rc4.

改为

pip install mmcv==2.0.0rc4 -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.13/index.html  

错误 :OSError: [WinError 127] 找不到指定的程序。 Error loading "D:\Program Files\miniconda3\envs\mmseg\lib\site-packages\torch\lib\c10_cuda.dll" or one of its dependencies.

解决 :pytorch重新安装 pytorch官网  Previous PyTorch Versions | PyTorch

https://pytorch.org/get-started/previous-versions/   安装  输入命令(梯子)

pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116

不梯子得话 ,先在https://download.pytorch.org/whl/cu116  下载轮子,再本地安装

 解决

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值