TensorFlow + OpenCV: a 2017 recipe for real-time object detection
A minimal glue project that wires Google's Object Detection API to a webcam or HLS stream with just enough threading to keep frames moving.

What it does
This is a thin Python application that pulls video from a webcam or an HLS stream, runs each frame through TensorFlow’s pre-trained object detection models, and displays the annotated results in real time. It also supports pushing the output to a livestreaming server. Two scripts are provided: a basic single-threaded version and a multithreaded variant that queues frames across workers to reduce stutter.
The interesting bit
The README documents a small but genuine systems lesson: spawning child processes to parallelize OpenCV’s .read() call flat-out failed, but moving the same work to a separate thread succeeded. That’s the kind of detail you usually only find in a closed issue, not the project notes.
Key highlights
- Supports both local webcam (
--source=0) and remote HLS input (--stream-input) - Configurable worker threads and queue depth for throughput tuning
- Optional RTMP/HLS output for re-broadcasting annotated video
- Includes pytest tests for utility functions
- Explicitly pinned to OpenCV 3.0 to avoid an OSX crash in 3.1
Caveats
- Dependencies are frozen in 2017: Python 3.5, TensorFlow 1.2, OpenCV 3.0. Modern environments will need careful dependency reconciliation or containerization.
- The multithreading is frame-queue management, not model parallelism; you’re still running one inference graph.
Verdict
Worth a look if you need a minimal, hackable baseline for webcam-based detection and don’t mind updating the dependency stack. Skip it if you want a maintained, production-ready pipeline—this is a tutorial-grade scaffold with dated internals.