This code demonstrates usage of OpenCV deep learning module (dnn module) with MobileNet-SSD network for object detection.
pip install -r requirements.txt
python dnn_object_detection.py \
--prototxt MobileNetSSD_deploy.prototxt.txt \
--model MobileNetSSD_deploy.caffemodel \
--labels object_detection_classes_pascal_voc.txt
python dnn_object_detection.py [-h] -p PROTOTXT -m MODEL -l LABELS
[-c CONFIDENCE] [-v VIDEO]
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.
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.
Real-time object detection with deep learning and OpenCV
MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications