Detectron2 Install and Run on your Machine

Posted By :Saharsh Gaurav |2nd January 2020

Detectron2: Installation and Implementation on your machine

This blog is a guide to install Detectron2 and how to run it on your machine.

We assume here that Python is already installed on your machine.

Process of installing Detectron2

Step 1: Clone the following git repository on your machine.

git clone git://github.com/jagin/detectron2-pipeline.git
cd detectron2-pipeline

 Step 2: Create and activate the environment with conda.

$ conda env create -f environment.yml
$ conda activate detectron2-pipeline

Step 3: Next, we need to clone and install Detectron2 itself

git clone https://github.com/facebookresearch/detectron2.git
cd detectron2

Step 4: Build and Install detectron2

python setup.py build develop

 Step 5: Back to detectron2-pipeline directory.

cd ..
cd detectron2-pipeline

If you are using macOS x then...

MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py build develop

Now Detectron2 is installed in your python detectron2-pipeline enviroment.

How to Run Detectron2

To run detectron2 on images use...

python process_images.py -i /home/task/detectron2-pipeline/assets/images/others/ -p

For more options of process_images.py use... 

python process_images.py -h

To use other config/models of the detectron2 use...

python process_images.py -i /home/task/detectron2-pipeline/assets/images/others/couple.jpg -p --config-file configs/COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml

Note: You can always supply other config/models to the process_images.py to change the identification process. All the model can be found in config directory

To process Video by using Detectron2 use...

python process_video.py -i /home/task/detectron2-pipeline/assets/videos/walk.small.mp4 -p -d -ov walk.avi

To know more options of process_video.py use...

python process_video.py -h

To process video using other config/models use...

python process_video.py -i /home/task/detectron2-pipeline/assets/videoss/traffic.small.mp4 -p -d -ov traffic.avi --config-file configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_3x.yaml

Note: You can always supply other config/models to the process_video.py to change the identification process. All the model can be found in config directory

To process live video using your webcam use...

python process_video.py -i 0 -d -p

That's all in this blog about Installing and Running the "Detectron2: A state-of-the-art computer-vision Application"


About Author

Saharsh Gaurav

Saharsh is a quick & smart learner, problem-solver, and smart-working Python Developer. He has good knowledge about Python, Flask Framework, Machine Learning, Artificial Intelligence, Model Training and Prediction, REST Web API. He likes playing Chess.

Request For Proposal

[contact-form-7 404 "Not Found"]

Ready to innovate ? Let's get in touch

Chat With Us