DNN_Object_Detection

This code demonstrates usage of OpenCV deep learning module (dnn module) with MobileNet-SSD network for object detection.

Setup

Dependencies

pip install -r requirements.txt

Execution

python dnn_object_detection.py \
--prototxt MobileNetSSD_deploy.prototxt.txt \
--model MobileNetSSD_deploy.caffemodel \
--labels object_detection_classes_pascal_voc.txt 

Usage

python dnn_object_detection.py [-h] -p PROTOTXT -m MODEL -l LABELS
                               [-c CONFIDENCE] [-v VIDEO]

Description

Object recognition is a computer vision technique for identifying objects in images or videos. Object recognition is a key output of deep learning and machine learning algorithms.

As part of Opencv 3.4.+ deep neural network(dnn) module was included officially. The dnn module allows load pre-trained models from most populars deep learning frameworks, including Tensorflow, Caffe, Darknet, Torch. Besides MobileNet-SDD other architectures are compatible with OpenCV 3.4.1 :

  • GoogleLeNet
  • YOLO
  • SqueezeNet
  • Faster R-CNN
  • ResNet

This API is compatible with C++ and Python.

Implementation

Network used - MobileNet-SSD

We can therefore detect 20 objects in images (+1 for the background class), including airplanes, bicycles, birds, boats, bottles, buses, cars, cats, chairs, cows, dining tables, dogs, horses, motorbikes, people, potted plants, sheep, sofas, trains, and tv monitors.

Results

Alt Text

Alt Text

References

Real-time object detection with deep learning and OpenCV

MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications

SSD: Single Shot MultiBox Detector

OpenCV deep learning module