mmdetection在重庆江小白上的训练--使用自定义coco数据集的测试和训练
本人目标检测小白一枚,未来可能会从事缺陷检测方向的研究与应用,因此提前了解一下目前检测的工具箱mmdetection,在使用mmdetection过程中,自我感觉踩了所有小白要踩得坑,特分享出来,希望对大家有帮助。
1、配置mmdetection
配置mmdetection,安装官方GitHub配置即可,即配即用,简单高效。官方更新了install,我在此给读着分享一下我的配置过程。
1.1 环境要求
转自官方:https://github.com/open-mmlab/mmdetection/blob/master/docs/INSTALL.md
Linux (Windows is not officially supported) 【据其他网友的分享,我在windows下成功配置了mmdetection】
Python 3.5+
PyTorch 1.1 or higher
CUDA 9.0 or higher
NCCL 2
GCC 4.9 or higher
mmcv
We have tested the following versions of OS and softwares:
OS: Ubuntu 16.04/18.04 and CentOS 7.2
CUDA: 9.0/9.2/10.0/10.1
NCCL: 2.1.15/2.2.13/2.3.7/2.4.2
GCC(G++): 4.9/5.3/5.4/7.3
1.2安装mmdetection
a.创建虚拟环境
conda create -n open-mmlab python=3.7 -y
source activate open-mmlab
安装后的conda list 结果如下:
b.安装Pytorch1.1
conda install pytorch=1.1 torchvision -c pytorch
安装好后,可以重启 一下环境,测试一下pytorch安装成功了没
python
import torch
c.安装mmdetection
我们先创建一个文件夹,并cd到这个文件夹下
mkdir chongqingDefectDetection
cd ./chongqingDefectDetection/
然后git mmdetection这个项目,没安装git的可以先安装一下
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
安装mmdetection需要的包,之前的官方教程将mmcv的安装列了出来,目前的mmcv在requirements.txt中
conda install cython
pip install -r requirements.txt
pip install "git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI"
pip install -v -e . # or "python setup.py develop"
注意最后一行命令最后有个“ . ”
pip list 看到有mmdet就是安装成功了
2、测试
要完成测试,需要checkpoint,需要demo,需要一个.jpg。
先说checkpoint,推荐2个网址:
(1)