无脑015——windows 安装mmdetection

首先创建conda环境

conda create -n mmdet_torch171 python=3.8
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.1 -c pytorch
conda activate mmdet_torch171
pip install pillow==8.0

然后安装openmim

pip install -U openmim
mim install mmengine

#因为不支持torch1.12以上,所以自己去这个网站找mmcv的版本
https://mmcv.readthedocs.io/en/2.x/get_started/installation.html

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

手动下载mmdetection的包,解压到
G:\bsh\mmdet_torch171
进入目录,开始安装

 cd .\bsh\mmdet_torch171\
 pip install -v -e .
 

安装成功之后显示:

Successfully installed mmdet-3.2.0 pycocotools-2.0.7 scipy-1.10.1 shapely-2.0.2 terminaltables-3.1.10

验证安装结果

输入
mim download mmdet --config rtmdet_tiny_8xb32-300e_coco --dest .
输出
Successfully downloaded rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth to G:\bsh\mmdet_torch171
Successfully dumped rtmdet_tiny_8xb32-300e_coco.py to G:\bsh\mmdet_torch171

完成后,你会在当前文件夹中发现两个文件 rtmdet_tiny_8xb32-300e_coco.py 和 rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth

输入
python demo/image_demo.py demo/demo.jpg rtmdet_tiny_8xb32-300e_coco.py --weights rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth --device cuda
输出
results have been saved at outputs
可以去outputs查看输出的文件,会在当前文件夹中的 outputs/vis 文件夹中看到一个新的图像 demo.jpg,图像中包含有网络预测的检测框。

至此,环境测试完成,可以正常使用

你可能感兴趣的:(无脑100,python)