Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

Abstract

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.

Method

Framework Overview

Framework

The pipeline consists of:

  1. Object Detection - YOLOX end-to-end ONNX model for real-time multi-class detection (human, car, truck, bus, bike, waste, etc.)
  2. Multi-Object Tracking - SORT (Kalman filter + Hungarian algorithm) with per-class independent trackers
  3. Anomaly Event Recognition - Rule-based strategies using spatiotemporal features (velocity, IOU coverage, convex hull analysis)
  4. Geospatial Mapping - Perspective transformation for pixel-to-WGS84 coordinate mapping
  5. Milepost Estimation - Road centerline integration for direction inference and kilometer post calculation

Anomaly Event Recognition Results

Results

Evaluation

Evaluation

Quick Start

1. Environment Setup

# 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.txt

Requirements:

  • Python >= 3.8
  • ONNX Runtime (CPU or GPU)
  • CUDA (optional, for GPU acceleration)
    • CUDA 11.8 recommended with onnxruntime-gpu>=1.16.1
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

2. Model Download

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)

3. Single Image Detection

Run object detection on a single image:

python demo.py --mode image --input assets/demo_road.jpg --output output.jpg

4. Video Processing (Full Pipeline)

Run 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 61b5f0de4abf4d89a34630e567cc969b

5. Python API

from 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': {...}}

Project Structure

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)

Detection Classes

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 瓶子

Anomaly Event Types

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

Geolocation

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.

Citation

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}
}

License

This project is released for academic research purposes.

About

[ICTTE 2025] An Integrated Framework for Detection and Geolocation of Traffic Anomalies in Highway Surveillance Videos

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages