屡试不爽的安装mmdetection方法
- 创建名为mmdet的conda环境
conda create --name mmdet python=3.8
- 确定自己的cuda版本:
- 去这个地址找下载pytorch的命令
pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121
- 测试pytorch安装成功,不报错代表成功
python
import torch
- 去这个地址找下载mmcv的wheel
pip install mmcv-2.1.0-cp38-cp38-manylinux1_x86_64.whl
- 去这个地址下载mmdetection(源码安装)
cd mmdetection
python -m pip install -e .
-
测试mmdet安装成功:
去这个地址下载retinanet_r18_fpn_1x_coco_20220407_171055-614fd399.pth权重:
然后运行下面代码:
python demo/image_demo.py demo/demo.jpg ./configs/retinanet/retinanet_r18_fpn_1x_coco.py --weights retinanet_r18_fpn_1x_coco_20220407_171055-614fd399.pth