mmdetection is a very useful toolkit for target detection. It provides a large number of pre-trained models. It is too troublesome to develop on the server, so I tried to install mmdetection on my windows computer, and finally ran out of the demo successfully, as follows:
The version information is as follows:
- Graphics card: RTX2070S
- System: Windows10
- miracles : 11.1
- cudnn : 8.1
- pytorch:1.8.0
- torchvision:0.9.0
- mmcv:1.3.9
- mmdetection:2.15.0
Install cuda and cudnn
Download cuda11.1 and install it. The download address is as follows:
CUDA Toolkit 11.1.0 | NVIDIA Developer
Download cudnn and copy it to the corresponding cuda directory. The download address is as follows:
cuDNN Archive | NVIDIA Developer
Those who are inconvenient to download can go to this address to download:
cuda11 and cudnn8.1.zip-Deep Learning Documentation Resources-CSDN Download
install mmdetection
-
install pytorch
Here we install pytorch 1.8.0
pip3 install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio===0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
As a rule, your torchvision will generally be one version number higher than your torch.
-
install mmcv
mmcv is the underlying support of the mm series, including the installation of mmclassification and mmsegmentation. mmcv is used. There are two installation versions, one is a simplified version
mmcv
and the other is a complete versionmmcv-full
. The complete version contains a large number of operators. Under the GPU It is better to install this full version, the installation command is as follows:pip install mmcv-full==1.3.9 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html
-
install mmdetection
The versions of mmdetection and mmcv should pay attention to the correspondence. The correspondence here is:
MMDetection version MMCV version master mmcv-full>=1.3.8, <1.4.0 2.15.0 mmcv-full>=1.3.8, <1.4.0 2.14.0 mmcv-full>=1.3.8, <1.4.0 2.13.0 mmcv-full>=1.3.3, <1.4.0 2.12.0 mmcv-full>=1.3.3, <1.4.0 2.11.0 mmcv-full>=1.2.4, <1.4.0 2.10.0 mmcv-full>=1.2.4, <1.4.0 2.9.0 mmcv-full>=1.2.4, <1.4.0 2.8.0 mmcv-full>=1.2.4, <1.4.0 2.7.0 mmcv-full>=1.1.5, <1.4.0 2.6.0 mmcv-full>=1.1.5, <1.4.0 2.5.0 mmcv-full>=1.1.5, <1.4.0 2.4.0 mmcv-full>=1.1.1, <1.4.0 2.3.0 mmcv-full==1.0.5 2.3.0rc0 mmcv-full>=1.0.2 2.2.1 mmcv==0.6.2 2.2.0 mmcv==0.6.2 2.1.0 mmcv>=0.5.9, <=0.6.1 2.0.0 mmcv>=0.5.1, <=0.5.8 In the above step, I installed mmcv 1.3.9, so I can directly install the latest version of mmdetection in this step, and perform the following series of operations:
# install mmdetection git clone https://github.com/open-mmlab/mmdetection.git cd mmdetection pip install -r requirements/build.txt pip install -v -e .
test demo
First, you need to create a new checkpoints directory in the mmdetection directory, and download the weight of FasterRcnn to this folder. The download address is:
https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth
On the command line, cd to the path of mmdetection and execute the following code
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
success!
In addition, if you need to run other model files, you can go to the following website to find the corresponding models and configuration files.
mmdetection/model_zoo.md at master · open-mmlab/mmdetection (github.com)