How hploc17/edge-ai works
This repository implements an edge-to-operations traffic-monitoring system: Jetson video feeds are analyzed for vehicle counts, calibrated speed, and congestion; telemetry and snapshots are sent to a WebGIS backend, where operators inspect the fleet and issue commands. The graph includes the documented edge analytics stages and the sampled backend/frontend flow. Some edge modules and routers are represented by their exact enclosing paths because their implementations were not sampled; links to those modules are limited to documented or visible orchestration.
Main entry points: main.py Edge orchestrator · App.tsx WebGIS application · mqtt_service.py Backend MQTT service · mqtt_client.py Edge MQTT client
Components 27
Edge analytics
- Edge orchestrator
main.py - GStreamer pipeline
core/gstreamer_builder.py - ROI management
spatial/roi_manager.py - ROI geometry
spatial/geometry_utils.py - Vehicle counts
analytics/presence_counter.py - Speed estimates
analytics/speed_estimator.py - Traffic classification
analytics/traffic_classifier.py
Snapshot delivery
- Snapshot service
snap/snapshot_service.py - Offline outbox
snap/outbox.py
Edge communications
- Edge MQTT client
communication/mqtt_client.py - Command router
communication/command_router.py - System metrics
communication/system_metrics.py
WebGIS backend
- Backend API
webgis/backend/main.py - API routers
webgis/backend/routers - Backend MQTT service
webgis/backend/services/mqtt_service.py - Node data store
webgis/backend/services/data_store.py - WebSocket manager
webgis/backend/services/websocket_manager.py
WebGIS frontend
- WebGIS application
webgis/frontend/src/App.tsx - Frontend API client
webgis/frontend/src/services/api.ts - Frontend WebSocket
webgis/frontend/src/services/websocket.ts - Traffic map
webgis/frontend/src/components/Map/WebGISMap.tsx - Fleet management
webgis/frontend/src/components/Fleet/NodeManagementPanel.tsx - Congestion history
webgis/frontend/src/components/History/CongestionHistoryModal.tsx
Other components
- Operator
- Video source
- MQTT broker
- Snapshot API
Connections 31
- Video source → GStreamer pipeline: supplies frames
- Edge orchestrator → GStreamer pipeline: builds pipeline
- Edge orchestrator → ROI management: loads ROI
- ROI management → ROI geometry: uses geometry
- Edge orchestrator → Vehicle counts: computes counts
- Edge orchestrator → Speed estimates: estimates speed
- Edge orchestrator → Traffic classification: classifies traffic
- Edge orchestrator → Snapshot service: starts and updates
- Edge orchestrator → Edge MQTT client: publishes telemetry
- Edge orchestrator → Command router: routes commands
- Edge orchestrator → System metrics: collects metrics
- Snapshot service → Offline outbox: stores pending images
- Snapshot service → Snapshot API: uploads snapshots
- Edge MQTT client → MQTT broker: publishes and subscribes
- MQTT broker → Backend MQTT service: forwards telemetry and commands
- Backend MQTT service → Node data store: updates node state
- Backend MQTT service → WebSocket manager: broadcasts updates
- Backend MQTT service → MQTT broker: publishes commands
- Edge MQTT client → Command router: dispatches commands
- Command router → Edge MQTT client: reports command results
- Backend API → Backend MQTT service: starts service
- Backend API → WebSocket manager: serves WebSocket
- Backend API → API routers: registers routes
- Operator → WebGIS application: uses WebGIS
- WebGIS application → Frontend API client: requests data
- Frontend API client → API routers: calls API
- WebGIS application → Frontend WebSocket: receives live updates
- Frontend WebSocket → WebSocket manager: connects and receives
- WebGIS application → Traffic map: renders map
- WebGIS application → Fleet management: opens fleet tools
- WebGIS application → Congestion history: opens history