Installation process of detectron2 framework for deep learning target detection


Installation process of detectron2 framework for deep learning target detection

1. detectron2

FAIROpen source target detection frameworkDetectron2, based onPytorch。 It trains faster than ever, has more functions, and supports more models than ever before. For example, the early modelFaster R-CNN,Mask R-CNN,RetinaNet,DensePoseIn addition to the support of other models, such asCascade R-NN,Panoptic FPN,TensorMaskWait, and it’s solved beforePytorchThe criticism that production is difficult to deploy. So I can’t wait to have a try and record itDetectron2Environment building process.

2. Python environment

First of all, we need to build a python environment. For the steps, please refer to the previous article using CONDA to install the deep learning framework pytoch.

3. opencv3

Opencv3Is a well-known computer vision processing library. stayPython 3.6In the environment, use the following command and it is OK:

conda install -c menpo opencv3

But in thePython 3.7The above command is invalid in the environment. have access topypiInstallation:

pip install opencv-python

If your network is not good and easy to fail, we can temporarily use TsinghuapypiImage to install:

pip install -i opencv-python

4. fvcore

fvcoreyesFAIROpen source is a lightweight core library that provides a variety of computer vision frameworks (such asDetectron2)The most common and basic features shared in. This library requires>=Python 3.6OfPythonEnvironmental Science.

CondaThe installation command is:

conda install -c fvcore fvcore

pypiThe installation command is:

pip install fvcore

reference resourcesChapter 3Use inpypiIt’s faster to mirror.

5. pycocotools

Microsoft releasedCOCOThe database is a large image data set designed for object detection, segmentation, human key point detection, semantic segmentation and caption generation. The coco API providesMatlab, PythonandLuaOfAPIInterface. TheAPIThe interface can provide complete loading, parsing and visualization of image tag data. adoptpycocotoolsLibrary we can useCOCOProvides a range of features. The installation method is different in different environments. Here is thelinuxFor example, environment:

pip3 install -U Cython
pip3 install -U pycocotools

6. Other package dependencies

According to the project providedrequirementsInstall it.

GCCCompiler Version >= 4.9

7. Install detectron2

Here’s the point. The next big thing is installationdetectron 2Yes.

7.1 direct installation

You can directly execute the following command to install directly:

pip install 'git+'

If the prompt does not have permission, please add it on the above command line--userParameter.

7.2 local installation

You can alsoGitPull to local installation:

git clone
cd detectron2 && pip install -e .

7.3 tips

For MacOS users, whether the7.1perhaps7.2Should beOn its basisExecute the following installation command:

 MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ pip install -e .

And if more than one is installed on the machinecudaVersion may causenvccAndcudaVersion is inconsistent, there are solutions online, I did not encounter, so just to remind you.

8. Summary

Generally speaking, there are not too many problems to install according to the above steps. If you have good suggestions, you can pass the WeChat official account.FelordcnGive feedback. In the next article, we will discuss some practical problems.

Pay attention to the official account: Felordcn for more information

Personal blog:

Recommended Today

Singularity iPhone version officially launched

Recently, I haven’t updated my short book, technology blog, CocoaChina, etc. I’ve been busy developing my own product singularity app. I hope to solve our technical problems in this high-quality “app ape” product, so that more people know the singularity. We dig high-quality Internet technology articles every day for you to recommend (currently, it supports […]