Select a camera to load its preview.
link.json will appear here.Traffic monitoring & response
Select a camera to load its preview.
link.json will appear here.This example shows how SPE’s tracking and spatial analytics can support a traffic monitoring workflow—from a selected camera feed to lane-level telemetry and incident review.
The camera wall reads sources from examples/assets/link.json. Operators select one of six YouTube feeds or the recorded sample, choose a lane preset, and start monitoring.
YouTube links are resolved to a readable stream. The selected camera is analyzed; other wall tiles remain still previews.
Live sessions run until stopped and keep a rolling replay window. Finite clips can be sampled and exported as JSON reports.
Each sampled frame moves through detection, tracking, spatial calibration, and application-level traffic analysis.
Selected camera or recorded clip
link.json · yt-dlpDetections become persistent tracks
SPEClient · TrackerMap positions into calibrated lanes
SpatialEngineAggregate flow and incident signals
Occupancy · crossingsThe SDK supplies the tracking and spatial-analysis building blocks. The application connects them into a lane-monitoring workflow.
| Component | Role in the pipeline | Used for |
|---|---|---|
SPEClient | Calls the engine’s frame-detection endpoint in server mode. | Model-backed detections |
ModelAgnosticTracker | Associates detections over time and maintains track identity. | Track history and motion |
SpatialEngine | Calibrates the camera view and maps object positions to zones and lanes. | Lane-aware location |
ZoneOccupancyTracker | Maintains occupancy counts for spatial zones. | Zone and demand metrics |
LineCrossingCounter | Counts objects crossing virtual lane lines. | Per-lane crossings |
summarize_tracks | Builds aggregate statistics from observed tracks. | Track summaries |
Source selection, YouTube stream resolution, live-wall previews, sessions, and replay.
Lane aggregation for occupancy, queue length, crossings, congestion, and relative speed.
Application policies detect stopped vehicles, queue buildup, network congestion, and lane imbalance.
Advisory states and suggested actions are derived from the incident and telemetry history.
Detection modes: Local mode uses a lightweight OpenCV motion detector for demonstration. It is not a trained vehicle-classification model. Server mode sends frames through SPEClient to the configured SPE engine.
The core loop tracks detections first, spatializes the tracked objects, and then updates occupancy. The web layer aggregates those results into traffic events and advisories.
detections = detector.detect(frame, frame_index, timestamp)
tracked = tracker.update(detections, timestamp)["detections"]
spatial = engine.spatialize_result(
{"detections": tracked}
)["detections"]
occupancy_snapshot = occupancy.update(spatial, timestamp)
lane_snapshot = build_lane_telemetry(spatial, counters)
incidents = detect_incidents(history, policy)
“Relative speed” is indexed to camera calibration and is not a verified real-world speed measurement.