Project · Edge AI · Live in production
AIBox
The edge box that does the watching - one rugged NVIDIA Jetson per site, four cameras, real-time safety detection without ever leaving the building.
- Period
- Jul 2025 - Jul 2026
- Role
- Architect and lead engineer
- Client
- PathTech JSC - shipped to Petrolimex Aviation at Noi Bai International Airport and EVN's 110 kV Mo Lao substation. 18+ cameras in production at Noi Bai alone.
18
distinct AI model types (helmet, oil-spill, smoke, plate, face, …)
91
REST endpoints across 13 routers
4
concurrent CCTV streams per box
2
live production deployments (airport + substation)
Problem
A fuel depot or high-voltage substation has cameras everywhere, but no one watches them all day. Pushing every video stream to the cloud for AI is expensive, slow, and stops working the moment the internet hiccups. The site needed AI that runs on a single box right there - spots safety violations in real time, saves a photo and a short video clip as evidence, and only sends finished alerts to the cloud.
Approach
- 01
Built one Python service that runs continuously on the Jetson box, pulls live video from every camera on site, and runs the right AI models against each one in real time. No cloud round-trip for inference.
- 02
Designed a per-camera pipeline so each camera owns its own thread, its own queue, and its own settings - one camera misbehaving never drags down the others. Models can be swapped on a live camera with zero downtime.
- 03
Built a three-layer event-dedup system: track each detected object so a static violation only fires once; spatially bucket bounding boxes so duplicates within seconds collapse; and a hard per-(camera × violation) cooldown so a single standing scene doesn't generate hundreds of alerts.
- 04
Added a static-region suppressor that auto-learns the camera's painted lines, signs, and fixed objects - and stops re-flagging them as fresh detections every time the tracker resets.
- 05
Always-on pre-roll: a tiny background process keeps the last few seconds of every camera in a ring buffer, so when an event fires the system already has video from before it happened - no second connection, no missed keyframes.
- 06
Streamed annotated video back to operators over WebRTC, RTSP, or MJPEG depending on the client - and synced events to the cloud over MQTT.
From the live product

Daytime · Noi Bai apron - PPE assessment per person, stable track IDs across frames.

Night · 23:16 local - same models, same site, no human watching the feed.
Stack
- Python 3.12 · FastAPI · SQLAlchemy
- PyTorch · Ultralytics YOLO v8/v11 · OpenCV
- FaceNet (face recognition)
- PostgreSQL + pgvector (512-dim face embeddings)
- MQTT (cloud sync) · WebRTC · RTSP · MJPEG
- NVIDIA Jetson · CUDA 12.8 · MediaMTX
Lessons
- Hardware-aware throttling beats hardware-blind retries. The pipeline reads GPU temperature and free memory and stretches its inference cadence before things go wrong, not after.
- Operators want one alert per real event, not 374,000 in ten minutes. The dedup ladder (object track → spatial bucket → hard cooldown) is the difference between 'safety system' and 'noise generator'.
- Never use auto-reload in production for a long-lived multi-camera service. It double-loads weights, doubles VRAM, and kills capture threads mid-frame. Restart, don't reload.