Object Detection Mobile Net SSD
π Overview
Do lightweight object detection with the MobileNet SSD model: MobileNet extracts features, SSD handles localisation, and the combined model is small (a few tens of MB) so it runs in real time on an ordinary laptop or even a Raspberry Pi.
OpenCV's DNN module supports the model directly and it recognises the 80 COCO classes - the friendliest way into deep-learning object detection.
π§° What you need
- Computer + camera
- Python 3.7+ environment
- pip install: opencv-python, numpy
- The MobileNet SSD .caffemodel weights + prototxt + class name file
π§ Step by step
Download the model
Get MobileNetSSD_deploy.caffemodel and the prototxt
It is about 25MB, far smaller than YOLO
Load the network
Load the model with readNetFromCaffe
Read in the class labels (person, car, phone, and so on)
Pre-process the input
Resize the image to 300x300 and normalise the blob
The OpenCV tutorial uses fixed scaling parameters
Infer and parse
net.forward returns the detection output matrix
Each row is one detection: class index, confidence, and normalised box coordinates
Filter and draw
Only show detections above a confidence threshold
Scale the normalised coordinates back to the original image size before drawing
Compare and apply
Compared with YOLO: faster and lighter, but weaker on small objects
Well suited to embedded and real-time monitoring use cases
π‘ Tips
- A 300x300 input is unkind to distant small objects; raise the input size a little if needed
- MobileNet SSD still reaches a usable real-time frame rate on a Raspberry Pi
- The normalisation parameters (mean, scale) must match training or the results will be wrong