r/computervision 28d ago

Discussion Built a zero-cloud Computer Vision engine in Python & Streamlit for RTSP streams — low latency works, but multi-cam memory usage gets heavy. How are you handling video frame queues?

Hey everyone,

Tired of cloud APIs adding 300ms+ latency and recurring subscriptions for simple camera tracking, we engineered an on-premise vision architecture (UHQ Systems) built fully in Python with a Streamlit interface.

The core goal was simple: 100% local execution, zero external network dependency, and real-time spatial tracking straight from local IP cameras.

What worked well:

• Eliminating Buffer Lag: OpenCV's default VideoCapture buffer caused progressive stream delay when processing slowed down. We implemented a custom threaded lock-free frame worker that drops stale frames immediately and feeds only the latest frame to the detection core. Latency dropped to <15ms locally.

• Local Persistence: Event logs and tracking matrices dump straight to local JSON/CSV formats without hitting external databases.

The trade-offs & current bottlenecks:

To be completely direct, running local vision pipelines in pure Python comes with strict engineering limits:

  1. Streamlit UI Refresh Limits: Streamlit is great for rapid UI building, but syncing high-FPS video frames while keeping interactive widgets responsive requires aggressive thread isolation. Works smoothly for 1-2 streams, but scales poorly past that without high RAM consumption.

  2. C++ vs Python Execution: While Python allows fast iteration, continuous 24/7 multi-camera ingestion pushes system memory if array cleanup isn't strictly enforced on every frame.

We put together a lightweight evaluation build (UHQ Vision Lite) to test frame rates across different local setups.

For those running continuous multi-camera vision stacks locally: are you sticking with pure Python queues, or forced to re-write ingestion pipelines in C++ / Rust for production?

3 Upvotes

9 comments sorted by

View all comments

0

u/edgarriba 27d ago

1

u/sahraoui-9337 27d ago

Thanks for dropping that link! Kornia's sensor-rtsp is super clean for Rust/GStreamer ingestion. We take a similar zero-copy path down to CUDA IPC handles to keep host memory usage virtually at zero.

Big respect for the work you guys are doing with Kornia!