Object detection platform Detectron2 installation

1. Anaconda installation

Installation tutorial: Anaconda introduction, installation and usage tutorial
Tsinghua Open Source Mirror Network: Tsinghua Open Source Mirror Network

Some instructions:

  • View all environments
conda env list
  • Copy an environment, copy the test environment
conda create --name copy --clone test
  • Delete an environment
conda remove --name test --all

2. Detectron2 environment configuration

Link: detectron2

1. requirements

  • New environment
 conda create --name detectron2 python=3.6
  • Activate the environment
conda activate detectron2
conda install pytorch torchvision cudatoolkit=9.2 -c pytorch
  • Install the opencv package
conda install --channel https://conda.anaconda.org/menpo opencv3
  • Install the pycocotools package
pip install cython; pip install -U 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'

2. Object detection platform

Insert picture description here

3. Installation

python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'

3. Use of object detection platform Detectron2

1. Data set download

Link: COCO
Insert picture description here

2. Testing

  1. Find an image of the coco verification set and put ./detectron2/demoit in the folder
  2. Run command
  • Activate the environment
conda activate detectron2
  • Enter the path
 cd ./detectron2/demo
  • Run command
python demo.py --configfile ../configs/COCODetection/retinanet_R_50_FPN_1x.yaml --input 000000000785.jpg [--otheroptions]--opts MODEL.WEIGHTS detectron2://COCODetection/retinanet_R_50_FPN_1x/190397773/model_final_bfca0b.pkl

3. Test the accuracy of the trained model on the coco validation set

conda activate detectron2
cd ./detectron2
python ./tools/train_net.py --config-file ./configs/COCODetection/retinanet_R_50_FPN_1x.yaml --eval-only MODEL.WEIGHTS detectron2://COCODetection/retinanet_R_50_FPN_1x/190397773/model_final
_bfca0b.pkl

4. Solutions to common problems

Question&&method

  • pycharm is slow to load

    Click Folder → Mark Directory as → excluded

Guess you like

Origin blog.csdn.net/qq_35632833/article/details/108590036