Fixed-camera traffic intelligence
Traffic event detection& accident anticipation
RoadGuard AI reads a single fixed CCTV camera, names the dangerous things that happen on the road, places each one on a timeline — and estimates how likely a collision is in the next 5 seconds, before it starts.
- 14
- event classes
- 5 s
- risk horizon
- Offline
- no hosted AI at evaluation
The preview above is the real interface running on a sample clip. Because no footage is published yet, the frame is a reconstruction drawn from exported tracks over the calibrated scene.
14
Event classes
The full official taxonomy, from collisions to fire and smoke.
5 s
Anticipation horizon
Risk answers one question: will an accident start within 5 seconds?
Offline
Evaluation mode
Inference runs locally. No hosted AI service is required to score.
Fixed
Camera model
Lanes, stop lines and crossings are calibrated once, then reused.
The problem
One video in, a labelled timeline out
A traffic camera produces hours of footage that nobody watches. The task is to turn that footage into a short list of moments worth someone's attention — and to say how dangerous each moment was.
Input
An MP4 from one fixed road camera. Nothing else — no maps, no sensors, no second view.
Output
Time-segment events, each with a start, an end and one of 14 class labels.
- 00:12.4 → 00:18.9Collision
- 00:40.0 → 00:43.5Red-light running
- 01:12.2 → 01:17.4Wrong-way driving
Wire format
[ [12.4, 18.9, "accident"], [40.0, 43.5, "red_light"], [72.2, 77.4, "wrong_way"] ]
The second task
At every frame, one number
Alongside the event list, the system reports a risk score between 0 and 1: the probability that an accident starts within the next 5 seconds.
That word — starts — is the whole difficulty. The score has to be built from what is visible now: closing speeds, converging paths, whether anyone is braking. It cannot look ahead, so it has to infer.
- 0.00–0.25
- Nominal — no conflict developing.
- 0.25–0.50
- Elevated — paths converging.
- 0.50–1.00
- Alarm — an operator should be looking at this camera.
Illustration of the intended behaviour, not measured output. A useful curve has to cross the alarm line before the red band, inside the 5-second horizon — a curve that spikes after impact has detected a crash, not anticipated one.
Approach
How a clip becomes a timeline
Four stages are shared by everything: decode, detect, track. After tracking the pipeline forks — one branch asks what rule was broken, the other asks how close this came to a collision.
- 01
Video
One MP4 from the fixed camera.
- 02
Frame sampling
Decode at a fixed rate, keep timestamps exact.
- 03
Object detection
Cars, trucks, buses, two-wheelers, pedestrians.
- 04
Multi-object tracking
Persistent IDs across frames.
Branch A — rules and geometry
Produces the event segments that get submitted.
- A·1
Trajectory history
Position, speed and heading over time, per ID.
- A·2
Scene geometry
Lanes, stop lines, crossings, signal region.
- A·3
Rules and learned models
Geometry decides violations; models decide conflicts.
- A·4
Temporal post-processing
Merge fragments, drop noise, fix boundaries.
- A·5
Event segments
start, end, label — the submitted output.
Branch B — accident anticipation
Produces one causal risk score per sampled frame.
- B·1
Relative motion
Every pair of nearby road users.
- B·2
Path intersection
Do the projected paths cross?
- B·3
Time to collision
How long until they would meet.
- B·4
Conflict features
Braking, heading change, occlusion, density.
- B·5
Risk score 0–1
Probability of an accident within 5 seconds.
Components
What each part is responsible for
Six pieces, each with one job. The split matters because it decides where a failure gets fixed: a missed pedestrian is a detector problem, a wrong-way false positive is usually a calibration problem.
Detection
Find every road user in the frame, including the ones that are small, partly hidden or barely lit.
- Six classes: car, truck, bus, motorcycle, bicycle, pedestrian
- Resolution is chosen by the smallest pedestrian that must survive
- Night and dusk clips set the recall floor
Tracking
Turn per-frame boxes into road users with a history, which is what every rule actually reads.
- One persistent ID per road user
- Short occlusions are bridged rather than starting a new ID
- Trajectories carry position, speed and heading
Scene geometry
Calibrate the road once, then reuse it. A fixed camera makes this the cheapest accuracy available.
- Road and lane polygons, with an expected direction per lane
- Stop lines, crosswalks, the intersection box, solid markings
- A region the signal colour is read from
Rule engine
Where the traffic code gives a crisp definition, encode the definition instead of learning it.
- Deterministic, inspectable and cheap to run
- Each rule states the geometry it depends on
- A failing rule points at a calibration error, not a mystery
Learned interaction models
Some classes have no clean geometric definition. Those are learned from interaction features.
- Collision and near miss, from relative motion between tracks
- Fire, smoke and road obstacles, from appearance
- Used where rules were tried and did not generalise
Temporal processing
The difference between a noisy per-frame signal and a segment an evaluator can score.
- Fragments of one class merged across short gaps
- Sub-threshold blips dropped
- No overlapping segments within a single class
Rules, written out
Where the traffic code is precise, the code is too. These are the conditions, not paraphrases of them.
- Wrong-way driving
Track heading stays opposite the lane's calibrated direction for a sustained window.
- Stopped vehicle
Displacement under a small threshold for at least 10 seconds, inside the road polygon.
- Pedestrian on roadway
Pedestrian centroid inside the road polygon and outside every crosswalk polygon.
- Red-light running
Stop-line crossing timestamp falls inside a window where the signal region reads red.
- Solid-line crossing
Track polyline intersects a calibrated solid line, with hysteresis so jitter does not fire.
- Illegal U-turn
Heading rotates through roughly 180 degrees inside a region flagged no-U-turn.
Taxonomy
The 14 classes, and how each is decided
Some of these are geometry problems with exact answers. Others are judgement calls that a rule cannot express. Grouping them by category is how the work was divided.
Collision
accidentTwo or more road users make contact.
How it is decided
Learned interaction model over tracked pairs: sudden velocity loss, box overlap, and post-impact scatter.
CriticalSafetyFire or smoke
fire_smokeVisible fire or smoke in the scene.
How it is decided
Appearance classifier on candidate regions, gated by texture motion so exhaust plumes do not count.
CriticalRoad conditionNear miss
near_missA collision was narrowly avoided.
How it is decided
Time-to-collision falls below threshold while both tracks survive and never overlap.
HighSafetyRed-light running
red_lightA vehicle crosses the stop line while the signal is red.
How it is decided
Stop-line crossing timestamp compared against signal state read from the traffic-light region.
HighTraffic ruleWrong-way driving
wrong_wayA vehicle travels against the lane's expected direction.
How it is decided
Track heading stays opposite to the calibrated lane-direction vector for a sustained window.
HighTraffic ruleIllegal U-turn
illegal_u_turnA vehicle reverses direction where the manoeuvre is forbidden.
How it is decided
Trajectory heading rotates through roughly 180 degrees inside a region flagged no-U-turn.
HighTraffic ruleIllegal turn
illegal_turnA vehicle turns where that movement is not permitted.
How it is decided
Entry and exit lanes of the track are checked against the intersection's permitted-movement table.
HighTraffic ruleSolid-line crossing
solid_line_crossingA vehicle crosses a solid lane marking.
How it is decided
Track polyline intersects a calibrated solid-line segment, with a hysteresis margin for jitter.
HighTraffic ruleStop-line violation
stop_lineA vehicle fails to stop behind the stop line when required.
How it is decided
No standstill frame is found behind the stop line before the track passes it.
HighTraffic rulePedestrian on roadway
jaywalkingA pedestrian is in the carriageway away from a crossing.
How it is decided
Pedestrian track centroid falls inside the road polygon and outside every crosswalk polygon.
HighPedestrianNot yielding to pedestrian
failure_to_yieldA vehicle does not give way to a pedestrian who has priority.
How it is decided
Vehicle enters the crosswalk while a pedestrian occupies it, without decelerating.
HighPedestrianStopped vehicle
stopped_vehicleA vehicle stands still in the carriageway.
How it is decided
Track displacement stays under a small threshold for at least 10 seconds inside the road polygon.
ModerateRoad conditionCongestion
congestionTraffic slows to a crawl and density rises.
How it is decided
Lane occupancy above threshold together with median speed below threshold, smoothed over a window.
ModerateRoad conditionObstacle on road
road_obstacleDebris or an object blocks part of the carriageway.
How it is decided
A static foreground region persists inside the road polygon without matching any road-user class.
ModerateRoad condition
Sample results
Four clips, all visualised
Each clip has a full result page: player, event timeline, risk curve and event log, all on one clock.
Four-way intersection, midday
01:32 · Daylight · 8 events
Busiest of the four clips and the only one containing a collision. Used to sanity-check that risk rises before impact rather than after it.
event segments across the clip
Arterial approach, dusk
01:58 · Dusk · 6 events
Falling light with headlights on. No collision, but two conflicts that the anticipation head flags. Good test for whether risk peaks without an accident following.
event segments across the clip
Night crossing
01:04 · Night · 4 events
Lowest-light clip and the hardest for the detector. Small distant pedestrians are the dominant failure mode here — see the report's limitations section.
event segments across the clip
Overcast, clear run
00:48 · Overcast · no events
A deliberately uneventful clip. It is included because a clean run is the case most likely to produce false positives, and because the site should handle an empty event list without looking broken.
clean run — kept as a false-positive check
Live demo
Run it on your own clip
Upload an MP4 up to 100 MB and 2 minutes and you get the same interface: events on a timeline, a risk curve, and a player that follows both.