记录自本人安装过程,环境建议:
- Linux or macOS (Windows is not currently officially supported)
- Python 3.6+
- PyTorch 1.3+
- CUDA 9.2+ (If you build PyTorch from source, CUDA 9.0 is also compatible)
- GCC 5+
1. torch & torchvision
我使用的是 torch 1.5.1 + torchvision 0.6.1
pip install torch==1.5.1 torchvision==0.6.1 [-i https://pypi.douban.com/simple]
2. mmcv
pip install mmcv-full
3. mmdetection
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -r requirements/build.txt
pip install -v -e . # or "python setup.py develop"
4. test
下载数据
mkdir checkpoints
wget -c https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/v2.0/mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco_bbox_mAP-0.408__segm_mAP-0.37_20200504_163245-42aa3d00.pth \
-O checkpoints/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco_bbox_mAP-0.408__segm_mAP-0.37_20200504_163245-42aa3d00.pth
此时查看文件目录树如下
> tree checkpoints
checkpoints
└── mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco_bbox_mAP-0.408__segm_mAP-0.37_20200504_163245-42aa3d00.pth
运行image_demo.py
测试mmdet是否安装成功
python demo/image_demo.py demo/demo.jpg configs/mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco.py checkpoints/mask_rcnn_r50_caffe_fpn_mstrain-poly_3x_coco_bbox_mAP-0.408__segm_mAP-0.37_20200504_163245-42aa3d00.pth
若安装成功,会显示如下图像:
Some ERROR
libcudart.so.10.1: cannot open shared object file: No such file or directory
先卸载原有cudatoolkit
:conda uninstall cudatoolkit
再安装10.1版本:conda install cudatoolkit=10.1