Problem and approach
Detector, tracker, aligned scene map, rules
[start_sec, end_sec, label] over 14 classes, scored by temporal-IoU F1 at 0.3, 0.5 and 0.7. We manually labelled event intervals in all four sample clips and fine-tuned the object detector on annotated frames. Traffic rules use tracked objects and a scene map.Pipeline
- MP4 video4K, 29.97 fps, fixed camera
- Frame samplingRule-based2 FPS on every device, stops at 2.7× clip length
- YOLO detectorLearnedFine-tuned, 8 classes incl. red/green signal heads
- ByteTrackRule-basedTrack ids and trajectories per road user
- Scene alignmentRule-basedSIFT + RANSAC homography maps scene.json onto the clip
- Event rulesRule-basedPer-class geometry and timing rules on tracks and zones
- Segment mergingRule-basedMerge same-class gaps under 1.5 s (8 s for jaywalking)
- Events[start_sec, end_sec, label]
Blue border = learned component. Everything else is deterministic code whose thresholds are listed below.
What is learned and what is rule-based
Learned: the object detector only. Rule-based: tracking association, scene alignment, every event decision and segment post-processing. Rules are inspectable and need no event labels, and the camera angle is fixed, so one scene map, re-aligned per clip, covers the hidden test set.
Models and data
- YOLO (Ultralytics), fine-tuned: 8 classes: car, bus, truck, motorcycle, bicycle, person, red light, green light. Weights ship in
weights/. Signal heads as detector classes let rules know the phase without a separate classifier. - ByteTrack (via Ultralytics) links detections into tracks, which every rule needs for direction, speed and dwell time.
- OpenCV SIFT + RANSAC estimates one homography per clip from stationary features against a bundled reference frame.
- Fine-tuning used annotated frames from the four organizer-provided videos only. No public dataset was added.
Why this design
- Four manually labelled clips give us a small dev set for tuning, while explicit rules use the scene layout directly.
- The hidden set uses the same camera and angle, so a hand-drawn map of lanes, stop lines, crossings and the island transfers, once alignment absorbs the small framing shifts we measured.
- Boundaries decide the score at IoU 0.7. Rules give exact start and end frames tied to the task's own conventions (for example red_light starts when the front crosses the stop line).
- One detector pass shares tracks across all implemented rules, reducing repeated inference.
Per-class logic
7 of 14 classes have a detector today. The others are listed with the approach we would try next. The harness only scores classes we predict or that occur, so we do not emit guesses.
| Class | Status | How it is decided |
|---|---|---|
| Collisionaccident | Not yet | Not detected yet. Part B’s time-to-collision score anticipates collisions; an accident event would add box contact plus an abrupt stop of both tracks. |
| Near missnear_miss | Rule | A vehicle brakes hard (speed roughly halves within 0.5 s) or swerves (heading turns more than about 45°) while another road user’s projected closest approach is under 0.85 box widths within 1.25 s. Pairs whose boxes overlap for two or more samples are dropped as possible contact. |
| Red-light runningred_light | Rule | The front edge of a vehicle crosses a stop line while the signal counts as red: a red head is detected, or no green head was seen in the last 25 processed frames. Confirmed once the rear clears the line; the event starts at the front crossing and ends when the vehicle leaves the junction. Stopping on the line cancels it. |
| Wrong-way drivingwrong_way | Computed, not reported | A vehicle’s ~1 s displacement points more than 120° away from its lane’s drawn direction for 1.5 s. The event starts when the opposing motion is first seen. Not reported: normal flow through lane_2 does not follow its drawn direction (43 false positives, 0 labelled events). |
| Illegal U-turnillegal_u_turn | Not yet | Not detected yet. Candidate: heading change above 150° inside a no-U-turn zone. |
| Stopped vehiclestopped_vehicle | Computed, not reported | A vehicle’s road contact point stays still for 10 s or more in a lane or the junction. Stops in signal approach lanes during red or congestion, or next to another stopped vehicle, count as queues and are excluded. Not reported: 10 false positives, 0 labelled events. |
| Pedestrian on roadwayjaywalking | Rule | A person’s foot point is inside the carriageway and outside every crossing, refuge island and kerb waiting zone. Crossings get a 0.5 m margin, scaled from the person’s box height. One person’s segments merge across tracking gaps under 8 s. |
| Not yielding to a pedestrianfailure_to_yield | Rule | A vehicle is on a crossing while a person on the same crossing stands in its path: up to 3 vehicle widths ahead along its heading, within its width sideways. Flagged until the vehicle leaves the crossing. |
| Illegal turnillegal_turn | Rule | A vehicle first seen in an approach lane other than lane_2 enters the junction, leaves it and then reaches the south-east crossing, a turn the markings prohibit from those lanes. Flagged while it is on that crossing. |
| Solid line crossingsolid_line_crossing | Rule | The midpoint of a vehicle’s bottom edge moves across a solid marking segment. The event lasts until all four box corners are inside a lane other than the one it came from. |
| Stop-line violationstop_line | Rule | During red, a vehicle’s road contact point stays within 20 px of a stop line, moving under 8 px/s, for at least 0.5 s. The event starts when it stopped and lasts while the signal is red. |
| Congestioncongestion | Computed, not reported | At least five slow vehicles (under 0.6 box heights per second) in a close chain within one lane direction, confirmed after 2 s and closed after 1 s clear. stopped_vehicle also uses it to recognise queues. Not reported: it fired on ordinary red-light queues (37 false positives, 1 labelled event). |
| Obstacle on roadroad_obstacle | Not yet | Not detected yet. Needs a detector beyond the 8 road-user classes. |
| Fire or smokefire_smoke | Not yet | Not detected yet. Needs a smoke/fire classifier. |
Part B: accident anticipation
RiskEstimator runs the same detector with its own tracker at 5 FPS and only sees frames up to the current one. Every pair of road users that includes a vehicle is projected forward at constant velocity. A pair adds risk when it closes faster than 2 box widths per second on crossing (not parallel) headings, and its closest approach is within 0.3 of the larger box width and under 5 s away. Risk grows as that time and distance shrink, and a hard brake or swerve adds 0.25. The frame score is the worst pair, averaged over the last second so a single tracker glitch cannot cross 0.5.
- The sample clips contain no accidents, so thresholds were set to keep false alarms rare on normal traffic, not calibrated against real crashes.
- Part B only runs when Part A's measured decode and inference speed show that the harness's full decode still fits the 3× time budget on a GPU. Otherwise it steps aside and Part A's events are kept.
Scene map
Polygons and lines in normalised coordinates, drawn once on a 1280×720 reference frame from C3897 (scene_reference.jpg) and stored in scene.json: carriageway, lanes with travel direction, junction area, crossings, refuge islands, kerb waiting zones, stop lines and solid markings.
