基本环境
ubuntu18.04LST
cuda10.2
cudnn7.5
开始搭建配置mmdetection环境
- 创建环境并激活环境
conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab
- 安装pytorch,这里使用清华源进行安装。
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda install pytorch torchvision cudatoolkit=10.2
- 安装配置mmcv,参考连接在这。
pip install mmcv-full==latest+torch1.5.0+cu102 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html
- 克隆mmdetection仓库并进行配置。
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
然后先对cocoapi进行配置
从百度云盘上下载cocoapi到当前目录,链接: https://pan.baidu.com/s/1kIXAaZuNKV0Uyg1VlRGA7Q 密码: wqvn
cd cocoapi-master
cd pycocotoools
python setup.py develop
然后执行
pip install -r requirements/build.txt
pip install -v -e . # or "python setup.py develop"
- demo测试
python image_demo.py demo.jpg /home/xueting/mmdetection/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py /home/xueting/mmdetection/checkpoint/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth