安装mmdetection2.22
- 确定版本
- 安装mmcv1.4
- 安装mmdetection
- 测试
- 方案1
- 方案2
确定版本
安装mmcv1.4
首先.cuda,pytorch得安装好,这里我拷贝pt1.8虚拟环境
安装mmcv1.4
安装mmdetection
参考文章
下载
cd E:\Code\mmdetection\mmdetection-2.22.0
pip install -r requirements/build.txt
conda install -c conda-forge pycocotools
pip install -v -e .
测试
遇到问题
解决mmdetection进行测试不出图片
方案1
测试代码如下
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
from mmdet.apis import init_detector, inference_detector, show_result_pyplot
import mmcv
config_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
checkpoint_file = 'checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'
device = 'cuda:0'
model = init_detector(config_file, checkpoint_file, device=device)
# 这一步会输出: "Use load_from_local loader"
img = 'demo/demo.jpg'
result = inference_detector(model,img)
show_result_pyplot(model,img,result)
方案2
python demo/image_demo.py demo/demo.jpg configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth