Skip to content

COCO Object Detection Demo

OpenCV integration of a pretrained COCO detector with image preprocessing and inference.

How it’s built

How it’s built

COCO Object Detection Demo · OpenCV DNN webcam demo of a COCO-trained SSD MobileNet v2 detector

I wrote OpenCV scripts that load a pretrained SSD MobileNet v2 COCO model through cv2.dnn, run it on webcam frames or still images at 300x300, and draw labelled boxes above a 0.25 confidence threshold. A second script runs OpenCV's ResNet-10 SSD face detector on a video stream. The pretrained weights come from TensorFlow and OpenCV, not my own training.

lines of own Python across 4 scripts
~370
detector input size
300x300
confidence thresholds (COCO / face)
0.25 / 0.7

Technology and what it does here

OpenCV DNN
ReadNetFromTensorflow loads frozen_inference_graph.pb with the SSD MobileNet v2 pbtxt
SSD MobileNet v2 (COCO)
Pretrained detector, labels from coco-labels-2014_2017
OpenCV ResNet-10 SSD (Caffe)
Face detection in program.py from res10_300x300_ssd fp16 weights
NumPy / matplotlib
Image channel exploration and still-image result display

Implementation details

  • app.py runs live webcam detection and draws filled label backgrounds with class and score for each box above threshold.
  • tf_text_graph_ssd.py is OpenCV's own script for generating the .pbtxt graph and should not be counted as my code.

Technologies

  • OpenCV
  • COCO
  • Object Detection

Next project · Academic Researcher

MLGuard

Portfolio assistant

Gabriel’s projects, experience, and research