From aerial footage of an intersection, a YOLOv4 + tracking pipeline recovers each vehicle's trajectory and counts vehicles per origin–destination pair, with a 7.53% average counting error.
Problem
Traffic lights can be controlled with reinforcement learning (RL), but an RL controller needs a description of what is happening at the intersection. One of the most useful signals is where each vehicle came from and where it is going: its origin–destination (OD) pair. Road sensors, GPS and radar can provide it, but they are expensive and intrusive. Cameras are cheaper to deploy, yet earlier computer-vision work mostly stopped at detecting and counting vehicles.
This paper proposes a deep learning pipeline that goes one step further: from aerial footage of an intersection, it recovers each vehicle's trajectory and counts vehicles per origin–destination pair.
Approach
The pipeline has three stages:
- Detection. A YOLOv4 network pre-trained on COCO and fine-tuned on the UAVDT dataset. The first 136 layers were frozen, and the input was enlarged from 512×512 to 832×832 pixels to help with distant, small vehicles.
- Tracking. An IoU-based tracker links detections across frames: a detection that overlaps strongly with one from the previous frame keeps its ID, otherwise it gets a new one. The result is a trajectory (a sequence of centroids) per vehicle.
- Origin and destination. Virtual lines are placed at the entrances and exits of the intersection. When a trajectory crosses a line, the vehicle ID is stored and a counter is incremented. The entry line and the exit line give the vehicle's OD pair.
Data
UAVDT has 50 traffic scenes and more than 80,000 frames, shot by drones at different altitudes and angles. We kept only the scenes where the whole intersection is visible (front or side views at medium altitude or higher, and bird's-eye views at any altitude). The pipeline was evaluated on two scenes it had not seen, M0403 and M0603.
Results
Detection and tracking, averaged over the two scenes, against a state-of-the-art baseline from the literature:
| Metric | This pipeline | Baseline |
|---|---|---|
| Detection recall | 98.2% | – |
| Detection precision | 79.5% | – |
| IDF1 | 85.7% | 62.6% |
| IDR | 95.8% | 58.0% |
| IDP | 77.5% | 76.0% |
| MOTA | 72.6% | 43.1% |
| MOTP | 74.4% | 78.5% |
The baseline is better only on MOTP (localization precision).
For the whole pipeline we propose an OD counting error: the share of vehicles whose origin–destination pair was miscounted. It was 10.71% on M0603 and 4.35% on M0403, 7.53% on average. No earlier work addresses OD identification, so there is no baseline for this step.
Where it fails
- Occlusion. On M0603, five vehicles going from E to D were missed because part of the scene is occluded and the detector never saw them.
- Identity switches. One vehicle from A to F was missed because the detector lost it in a single frame, and the tracker gave it a new ID when it reappeared.
- Trucks and buses. They fail more often than cars, because UAVDT has far fewer examples of them.
Limitations
- Only two scenes were evaluated.
- The virtual lines are drawn by hand for each scene.
- Precision is 79.5%: the detector produces many false positives (19,328 against 1,403 misses), which a larger network or more truck and bus examples could reduce.
Paper
Fraga, V. A., Schreiber, L. V., Kunst, R., Barbosa, J. L. V., Ramos, G. de O. A machine learning pipeline for extracting decision-support features from traffic scenes. Workshop Agents in Traffic and Transportation (ATT'22), Vienna, 2022. CEUR Workshop Proceedings, vol. 3173. Licensed CC BY 4.0.