Python application for real time object detection and segmentation.
In previous article I walked through with you on using YOLOv5 for real time object detection. In this article let’s develop a Python application for real time object detection using Detectron2, which is a Facebook AI Research’s next generation software system that implements state-of-the-art object detection algorithms.
- Git clone the repository.
python setup.py install
- Install Detectron2 based on Python version and GPU availability
d2to start the application
qto exit the application
OpenCV is used to capture camera images. The application captures camera images in the main process, and spawns a separate process to detect objects in the image frame.
The application should work without GPU, but for better performance you should use a GPU machine.
The image with detected objects will be displayed in a separate frame.
You can find the full listing of the code below.
Training a Custom Model
You can refer to the Colab notebook on how to train a custom model using your own dataset, e.g. to detecting balloons as provided in the example.
There is a large collection of baselines trained with Detectron2 available for download.
Command Line Tool
There is also a command line tool for demo purpose.
You can also check out projects built on Detectron2.
It is relatively easily to use Detectron2 for object detection, and there are many more features that you can try on this library. Read the documentation to find out more.
You can find the sample application from this repository.
Do also check out the following articles!
Serving Machine Learning Models (DCGAN, PGAN, ResNext) using FastAPI and Streamlit