mmdetction linux环境搭建 v2.11.0
参考的各个网站:
https://blog.csdn.net/sinat_28442665/article/details/108059954
https://blog.csdn.net/qq_41375609/article/details/94833928
https://www.freesion.com/article/89371367948/
conda虚拟环境下的pytorch 1.3.0搭建
cuda版本:10.0 (cuda版本不能用nvidia-smi查看!)
python版本:3.6.9
pytorch版本:1.3.0 py3.6_cuda10.0.130_cudnn7.6.3_0
torchvision版本:0.4.1 py36_cu100
由于无敌长城防火墙的原因,我换conda源成中科大或清华源下载torch和torchvision都不行,所以手动去网站上下载,然后conda离线安装
pytorch包下载网址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/
torchvision包下载网址:https://conda.anaconda.org/pytorch/linux-64
下载对应版本完了之后,用conda命令离线安装:
conda create -n torch130 python=3.6.9
conda activate torch130
conda install --offline xxx.tar.bz2
conda install --offline yyy.tar.bz2
最后安装完了这两个之后,用conda自动安装其他依赖包:conda
conda install pytorch==1.3.0 torchvision==0.4.1 cudatoolkit=10.0 -c pytorch
完成torch 1.3.0的安装(我之前试了很久,torch1.4.0没能成功匹配mmdet)
安装cpython
conda install cython
搭建mmcv-full
有很多地方都说这样安装mmcv:
git clone https://github.com/open-mmlab/mmcv.git
cd mmcv
pip install . #注意有一个点(.)
但是用上面这个方法我匹配不上最新的mmdet,会一直error,报错mmcv库not found
因此选择了离线下载mmcv-full,然后pip手动安装:
mmcv-full下载地址:https://download.openmmlab.com/mmcv/dist/index.html
根据文件名称下载到对应版本的包,然后pip install 这个包即可,正是由于这个网址里没有torch1.4.0对应的版本,所以之前要下载1.3.0
搭建mmdetection v2.11.0
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
python setup.py develop
测试能否运行
- 下载checkpoint
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
- 开始infer
python3.6 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