An Integrated Framework for Detection and Geolocation of Traffic Anomalies in Highway Surveillance Videos
Open-source codes of CVEO research in Intelligent Transportation System (ITS) domain.
Paper Links:
Accepted as Oral Presentation at ICTTE 2025 (International Conference on Traffic and Transportation Engineering).
Timely detection and accurate geolocation of traffic anomalies are critical for intelligent highway management and rapid emergency response. This paper presents an intelligent vision-based framework for recognizing and spatially localizing common traffic anomalies, including stopped vehicles, congestion, and pedestrian presence, using roadside non-metric surveillance videos. The framework integrates YOLOX for object detection, SORT for multi-object tracking, and rule-based strategies leveraging spatiotemporal features to identify abnormal events. To enable practical deployment, we develop a geospatial mapping module that transforms pixel-level detections into real-world coordinates via perspective transformation calibrated with sparse point pairs, further enhanced by road centerline integration for directional inference and milepost estimation.
The pipeline consists of:
- Object Detection - YOLOX end-to-end ONNX model for real-time multi-class detection (human, car, truck, bus, bike, waste, etc.)
- Multi-Object Tracking - SORT (Kalman filter + Hungarian algorithm) with per-class independent trackers
- Anomaly Event Recognition - Rule-based strategies using spatiotemporal features (velocity, IOU coverage, convex hull analysis)
- Geospatial Mapping - Perspective transformation for pixel-to-WGS84 coordinate mapping
- Milepost Estimation - Road centerline integration for direction inference and kilometer post calculation
# Clone the repository
git clone https://github.com/cveo/ITS-TrafAno.git
cd ITS-TrafAno
# Download the ONNX model (required)
# Baidu Netdisk: https://pan.baidu.com/s/13CDLsnoCmsPKs7HmTtHy9Q Extract code: cveo
# Place the downloaded end2end.onnx into the models/ directory
# Create conda environment (recommended)
conda create -n trafano python=3.10 -y
conda activate trafano
# Install dependencies
pip install -r requirements.txtRequirements:
- Python >= 3.8
- ONNX Runtime (CPU or GPU)
- CUDA (optional, for GPU acceleration)
- CUDA 11.8 recommended with
onnxruntime-gpu>=1.16.1
- CUDA 11.8 recommended with
| Package | Version |
|---|---|
| numpy | >= 1.21.0 |
| opencv-python | >= 4.5.0 |
| onnxruntime | >= 1.14.0 |
| scipy | >= 1.7.0 |
| filterpy | >= 1.4.0 |
| shapely | >= 1.8.0 |
The ONNX model file (~207MB) is hosted on Baidu Netdisk:
Link: https://pan.baidu.com/s/13CDLsnoCmsPKs7HmTtHy9Q Extract code:
cveo
After downloading, place end2end.onnx into the models/ directory:
models/
└── end2end.onnx # (~207MB, YOLOX-L)
Run object detection on a single image:
python demo.py --mode image --input assets/demo_road.jpg --output output.jpgRun the complete pipeline (detection + tracking + event recognition) on a video:
# Basic: detection + tracking + event detection
python demo.py --mode video --input assets/demo.mp4 --output output.mp4
# With geolocation (requires camera ID)
python demo.py --mode video --input assets/demo.mp4 --output output.mp4 \
--camera_id 61b5f0de4abf4d89a34630e567cc969bfrom demo import TrafficAnomalyDetector
# Initialize detector
detector = TrafficAnomalyDetector()
# --- Single image detection ---
import cv2
frame = cv2.imread("assets/demo_road.jpg")
detections = detector.detect(frame)
vis = detector.draw_detections(frame, detections)
cv2.imwrite("result.jpg", vis)
# --- Video processing ---
cap = cv2.VideoCapture("assets/demo.mp4")
temp_info, whole_track = detector.track(cap, cam_id="your_camera_id")
event_dict = detector.event_strategy(whole_track, temp_info, cam_id="your_camera_id")
print(event_dict) # {'carstop': {...}, 'jam': {...}, 'personstop': {...}, 'debris': {...}}ITS-TrafAno/
├── demo.py # Main entry point: detection, tracking, events, geolocation
├── sort.py # SORT multi-object tracker (Kalman filter + Hungarian)
├── config.py # Configuration: model paths, thresholds, geo parameters
├── requirements.txt # Python dependencies
├── models/
│ └── end2end.onnx # YOLOX-L object detection model (ONNX)
├── road_mask/ # Road region masks per camera (PNG)
│ ├── 04677acf458a4d22a01c98a1ae505a3b.png
│ ├── 08a47681d5ef4922a0c48fe8a3060d97.png
│ └── ... # (23 camera masks)
├── assets/ # Demo input files
│ ├── demo.mp4 # Sample highway surveillance video
│ ├── demo_road.jpg # Sample road scene image
│ └── demo_detection.jpg # Detection result visualization
├── docs/ # Paper figures
│ ├── method.png
│ ├── event.png
│ └── table.png
└── refs/
└── ... (paper PDF)
The YOLOX model detects 11 classes of road objects:
| ID | Class | Chinese |
|---|---|---|
| 0 | human | 行人 |
| 1 | car | 汽车 |
| 2 | truck | 卡车 |
| 3 | bus | 公交 |
| 4 | train | 火车 |
| 5 | bike | 非机动车 |
| 6 | light | 路灯 |
| 7 | sign | 标牌 |
| 8 | waste | 抛洒物 |
| 9 | bag | 塑料袋 |
| 10 | bottle | 瓶子 |
| Event | Description | Key Indicators |
|---|---|---|
| Car Stop | Vehicle stationary on highway | Velocity < 10px/frame, IOU coverage > 0.7, area in [1200, 27000] |
| Traffic Jam | Congestion with dense slow traffic | >30 tracks, normalized velocity < 1.2, convex hull analysis |
| Person Stop | Pedestrian standing on highway | Velocity < 10px/frame, IOU coverage > 0.65, area < 5000 |
| Debris | Road surface debris (waste/bag/bottle) | Velocity < 10px/frame, IOU coverage > 0.65, area < 20000 |
The geolocation module provides two outputs:
- WGS84 coordinates (longitude, latitude) via perspective transformation
- Milepost + Direction (e.g., "K5+802 上行") via road centerline intersection
Camera-specific perspective transformation parameters and the road centerline geometry are stored in config.py.
If you find this work useful, please cite:
@inproceedings{tan2025integrated,
title={An Integrated Framework for Detection and Geolocation of Traffic Anomalies in Highway Surveillance Videos},
author={Tan, Xiaoliang and others},
booktitle={International Conference on Traffic and Transportation Engineering (ICTTE)},
year={2025},
organization={IET}
}This project is released for academic research purposes.


