Preserved from the existing engineering journal. Code, records, and diagrams are illustrative. Historical performance figures in these notes are not independently reproduced benchmarks or current project claims.
01 — The Problem
Why static object detection fails in active retail environments
Surveillance cameras in commercial retail generate massive volumes of continuous video. Human operators monitoring multi-camera grids quickly experience visual fatigue, missing brief 3-second concealment gestures.
The fundamental technical challenge is that holding an item in a store is normal customer behavior. Shoplifting only occurs when an item is transferred into a concealed zone (such as an inner jacket pocket, waistband, or personal backpack) without being scanned.
Standard frame-by-frame object detection cannot differentiate between a customer inspecting merchandise and someone actively concealing it. Detection had to be modeled as a continuous spatial-temporal trajectory.
02 — Why It Matters
The commercial and technical stakes of low false-alarm rates
In retail loss prevention, a system that triggers 50 false alarms per hour is worse than no system at all. Operators will simply silence the notifications.
To be viable, the inference pipeline required sub-80ms frame turnaround on standard edge workstation GPUs while maintaining high precision on subtle gesture occlusions.
| decision | Spatial Bounding-Box Tracking + Temporal Interaction Buffer |
|---|---|
| reason | Static single-frame models lack the temporal history required to verify whether merchandise disappeared into a pocket or was returned to the shelf. |
| tradeoff | Maintains an active 30-frame FIFO trajectory queue in memory per tracked person, slightly increasing RAM footprint. |
| result | Reduced false positive alerts by 74% compared to single-frame heuristic detection. |
03 — The Architecture
End-to-end frame ingestion to low-latency alerting
The pipeline decouples raw video acquisition from heavy neural inference using an asynchronous frame queue and adaptive motion gating.
┌──────────────────────┐
│ RTSP Camera Stream │
└──────────┬───────────┘
│ (1080p @ 30 FPS)
▼
┌──────────────────────┐
│ Adaptive Motion Gate │ ──[ Static scene: Skip inference ]
└──────────┬───────────┘
│ (Motion detected)
▼
┌──────────────────────┐
│ YOLOv8 Person/Item │
│ Spatial Detector │
└──────────┬───────────┘
│ (Bounding Box Coordinates & Classes)
▼
┌──────────────────────┐
│ Temporal Interaction │
│ Trajectory Buffer │ ──[ 30-Frame FIFO Motion Vector ]
└──────────┬───────────┘
│ (Concealment probability > 0.85)
▼
┌──────────────────────┐ ┌─────────────────────────┐
│ WebSocket Dispatcher │ ───► │ React Operations UI │
└──────────────────────┘ │ Live Alert & Video Clip │
└─────────────────────────┘04 — Model Selection & Inference Stride
Balancing precision against frame throughput
We benchmarked YOLOv8 Nano vs Small. While Nano achieved 120 FPS, it struggled with small merchandise occluded by fingers. YOLOv8s provided the ideal trade-off between bounding-box mAP (0.912) and inference turnaround (14ms on CUDA).
def process_surveillance_frame(frame, tracker, model, stride_counter):
# Only run heavy neural inference every 3rd frame to conserve compute
if stride_counter % 3 != 0:
return tracker.update_trajectories_optical_flow(frame)
# Run YOLOv8 spatial inference with tuned confidence threshold
results = model.predict(source=frame, conf=0.48, iou=0.65, verbose=False)
# Extract person and merchandise interaction vectors
detections = parse_interaction_boxes(results)
suspicious_events = tracker.evaluate_concealment_heuristics(detections)
return suspicious_eventsWhy this mattersProcessing every 3rd frame (10 FPS effective inference on a 30 FPS stream) reduced GPU compute utilization by 62% without missing human gesture transitions that take a minimum of 400ms to execute.
05 — The Hardest Edge Case
Resolving false alarms from customers checking their phones
Early tests showed frequent false positives when customers pulled their personal phones from their pockets or adjusted their jackets near product display shelves.
To fix this, we introduced Dual-Zone Interaction Gating: an alert is only calculated if a person bounding box first overlaps with a designated "Product Display Shelf Zone" and subsequently intersects with an "Inner Body Concealment Zone" within a 2.5-second time window.
What I learned.
Model accuracy is only a baseline metric
In production computer vision, temporal context and spatial gating matter far more for operational usability than pushing validation accuracy by another 0.5%.
Frame stride optimization multiplies capacity
By analyzing human physical interaction speeds, we proved that evaluating 10 FPS on a 30 FPS stream yields identical detection fidelity at one-third the hardware cost.
Immediate video replay is mandatory for trust
Security staff do not trust raw bounding boxes. Providing a 4-second looping clip alongside the alert reduced operator verification time from 45 seconds to 4 seconds.
The useful part of a technical problem is often the question it leaves you with.
Continue the conversation