MAARG Traffic Intelligence

An interactive simulation of the pipeline from camera video to edge AI, streaming, cloud analytics, and dynamic signal control.

Live system · CAM 01 → J-01 → CAM 02 → J-02Simulation
J-01EW 14sJ-02NS 10sRAW VIDEO · localRAW VIDEO · localEDGE_J01YOLO · ByteTrack · OCRvideo → observationsEDGE_J02YOLO · ByteTrack · OCRvideo → observationsAPACHE KAFKAtopic maarg.observations · 10,420 eventsMAARG CITY INTELLIGENCE CLOUDIngestionAssociationTrajectoryAnalyticsPredictionSignal optimisationSIGNAL CONTROLLERJ-02 cabinetsafety interlock · fallbackplan from MAARG
Raw video
Camera → nearby edge server only. Processed locally.
Structured observation
~0.5 KB event per vehicle → Kafka → MAARG cloud.
Timing plan
Cloud decision → signal controller → the upcoming signal (J-02).

01 · Physical road

Camera capture: what the CCTV camera actually sees

Everything starts with pixels. The camera records continuous video. Information such as vehicle type, plate and speed is not 'sent by the camera' — it is extracted from those pixels by the edge AI server next to the camera.

CAM_07 · live frame
Simulation
virtual count lineLANE 1LANE 2LANE 3CAM_07 · REC08:42:16 ISTLane 2 · Northbound ↑GPS 30.7046 N, 76.7179 E
Observations generated: 0
Vehicles in frame: 0
Boxes drawn by: edge AI (overlay)
Vehicle detected
LAST AT COUNT LINE

Waiting for a vehicle to cross the count line…

What is observed
  • Video frames25 fps · 1920×1080sensor
  • Vehicle position—edge AI
  • Vehicle type—edge AI
  • License plate—edge AI
  • Lane—edge AI
  • DirectionNorthboundedge AI
  • Timestamp08:42:16config
  • Approx. speed—edge AI
  • Camera IDCAM_07config
  • GPS / location30.7046, 76.7179config
  • Confidence—edge AI
RAW VIDEO~4 Mbit/s
local network (metres away)
EDGE SERVERat the junction

The camera does not stream every frame to the cloud for analysis. Its video goes to a small AI computer at the junction (the edge server), which watches the video and writes down short facts about each vehicle. Only those facts travel to the city system.

07 · Multi-camera association

Is this the same vehicle? Connecting observations into one journey

Track IDs from the edge are only valid inside one camera. The cloud compares observations from different cameras using identity, time, place, direction and speed — and the road graph.

Incoming observations · plate DL01AB1234
Simulation
  1. CAM_0108:41:18DL01AB1234car · north · 38 km/h
  2. CAM_0708:42:16DL01AB1234car · north · 42 km/h
  3. CAM_0908:42:40DL01AB1234car · north · 40 km/h
  4. CAM_1408:43:05DL01AB1234car · east · 33 km/h
  5. CAM_2208:44:02DL01AB1234car · east · 36 km/h
Journey on the road graph
J-06J-07J-10J-04J-08J-09J-02J-03J-05S-INW-INE-OUTCAM_01CAM_07CAM_14CAM_22CAM_03CAM_09CAM_11CAM_05
Comparison

Press "Run association" to compare: vehicle identity, license plate, timestamp, location, direction, speed, spatial relationship and temporal relationship.

MAARG checks whether the same car could really have driven from one camera to the next in that time, on those roads, in that direction. If yes, the sightings are joined into one trip. A same-plate sighting that is physically impossible is rejected and flagged.

02 · Edge AI perception

Edge AI server: video becomes structured observations

A GPU server installed close to the cameras (in or near the junction cabinet) runs the perception pipeline. This is where the heavy video processing happens, with low latency and without sending raw video across the city.

EDGE AI SERVER
EDGE_J04 · junction cabinet
  • Inputs4 camera streams
  • ComputeGPU inference
  • RuntimePython
  • Outputobservations
Simulation

Processing pipeline · click a stage for details

Output leaving the edge: one compact observation per vehicle passage — not the video.

Think of the edge server as a traffic officer standing at the junction who watches the video and writes a short note for every vehicle: "white car, DL01AB1234, lane 2, going north, 42 km/h, 08:42:16". Only the note is sent onward.

04 · Real-time streaming

Apache Kafka: the real-time event bus

Kafka allows observations from many intersections to continuously reach the central intelligence layer — durably, in order, and without overloading any single service.

Topic maarg.observations · 4 partitions
Simulation
EDGE CAM_01
producer · 0 sent
EDGE CAM_02
producer · 0 sent
EDGE CAM_03
producer · 0 sent
EDGE CAM_04
producer · 0 sent
KAFKA CLUSTERretention 7 days · replication 3
P0
OBS-10400
OBS-10401
OBS-10402
OBS-10403
OBS-10404
OBS-10405
P1
OBS-10406
OBS-10407
OBS-10408
OBS-10409
OBS-10410
OBS-10411
P2
OBS-10412
OBS-10413
OBS-10414
OBS-10415
OBS-10416
OBS-10417
P3
OBS-10418
OBS-10419
OBS-10420
OBS-10421
OBS-10422
OBS-10423

Partition key = camera / junction · order preserved within a partition · newest on the right

Ingestion & storage
consumer group · validate · enrich · store
Traffic analytics
consumer group · counts · queues · speeds
Alert engine
consumer group · emergency · congestion
→ MAARG CLOUD SERVICES

Kafka is like a high-speed conveyor belt. Every junction drops its notes on the belt, and every department in the city system picks up the notes it needs, at its own pace — nothing gets lost if one department is busy.

05 · Central intelligence

MAARG City Intelligence Cloud

The edge understands one junction. The cloud sees every junction at once — it connects observations into journeys, measures the network and decides what the signals should do next.

Edge = local perception

One junction · video in · milliseconds · "what is in front of this camera?"

Cloud = city-wide intelligence

All junctions · observations in · history + road graph · "what will happen next, and what should we do?"

MAARG CITY INTELLIGENCE CLOUD
1,840 obs/s ingestedSimulation
1Receive
2Connect
3Understand
4Decide

The cloud is the city's control room brain. It receives notes from every junction, recognises the same vehicle at different places, measures how traffic is moving, predicts what comes next and tells signals how to adjust.

09 · Traffic intelligence

Zoom out: the whole network, measured live

Observations from every camera become network-wide metrics. Click any intersection to see what MAARG knows about it right now.

Vehicle count
—
Traffic density
—%
Average speed
—km/h
Lane occupancy
—%
Stopped
—veh
Congestion
—
Queue (all)
0veh
Arrivals 20 s
—
12-junction network · density heatmap
Simulation
GREEN = free flowYELLOW = slowing / buildingRED = congested
Intersection detail

Click an intersection on the map.

Every road is coloured by how full it is. MAARG also counts what is waiting at each junction and what is about to arrive — the numbers it uses to time the lights.

10 · The core USP

Dynamic signal timing from upstream traffic

MAARG does not only react to the queue already at a signal. It looks at cameras before the junction, estimates how many vehicles are coming and when they arrive, checks the cross street and the road ahead, and then times the upcoming signal.

Intersection J-04
Simulation
180 mCAM_02 · 420 m south ↓ · 31 vehMAARGprediction · optimiserJ-04 · t = 0.0 s18sNS GREEN
NS green plan
30 s
Platoon vehicles stopped
0 / 42
Passed stop line
0 / 42
Current signal plan · J-04
Green (NS)
30 s
Yellow
5 s
Red (NS)
45 s
Upstream cameras feeding J-04
  • N
    CAM_01: 42 vehicles approachingNS phase
    180 m · 36 km/h · ETA 18.0 s · platoon passes in ~18 s
  • S
    CAM_02: 31 vehicles approachingNS phase
    420 m · 30 km/h · ETA 50.4 s · platoon passes in ~14 s
  • E
    CAM_03: 18 vehicles approachingEW phase
    300 m · 27 km/h · ETA 40.0 s · platoon passes in ~8 s
Traffic prediction engine · decision logic
conceptual simulation
Input
  • Upstream camera data
    CAM_01 42 · CAM_02 31 · CAM_03 18
  • + Current signal state
    NS green, 12 s elapsed of 30 s (18 s left)
  • + Vehicle speed
    36 km/h (CAM_01 platoon)
  • + Distance
    180 m CAM_01 → stop line (PostGIS)
  • + Queue length
    EW 12 vehicles waiting
  • + Downstream capacity
    J-05 54% occupied
  • + Historical pattern
    Tue 08:40 profile × 1.00
Prediction

Predicted arrival: 42 vehicles from CAM_01 expected in 18 s

"Estimated vehicles reaching J-04 in next 30 s: 28"

ETA = distance ÷ speed = 180 ÷ 10.0 m/s = 18.0 s
pass = ⌈42 ÷ 3 lanes⌉ × 1.3 s = 18.2 s
Decision engine

"Extend North–South GREEN by 18 s"

42 vehicles from CAM_01 arrive in ~18 s and need ~18 s to pass. Current green ends in 18 s.

ext = ETA + pass − remaining green
cap = min(max green 60 s, EW red ≤ 75 s) → 30 s
spillback check: J-05 < 85% ✓
Signal controller
GREEN: 48 s

Yellow 5 s and all-red clearance unchanged; local interlock enforces safety.

MAARG sees a big group of cars just one block away. If the light turned red now, almost all of them would have to stop. So it keeps the light green a little longer — but only as long as the cross street can afford to wait and the road ahead has room.

"The signal is not using a fixed timer. MAARG is dynamically adapting it based on upstream traffic." With the current inputs, a fixed timer stops 39 of the 42 CAM_01 vehicles; MAARG stops 0.