A high-performance, edge-native Computer Vision system for real-time traffic sensing, person tracking, and multi-class object counting. This project implements state-of-the-art YOLO-based perception in both Python and Rust.
- Real-time Traffic Analysis: Calculate vehicle speeds (km/h), detect traffic jams, and monitor flow patterns.
- Physics-Informed Tracking: USes homography (in-progress) and pixel-to-meter calibration for science-grade speed data.
- Dual-Stack Architecture:
- Python: Easy prototyping with
UltralyticsandDeepFace(adds gender analysis). - Rust: High-performance, edge-optimized inference using
ort(ONNX Runtime) andOpenCV.
- Python: Easy prototyping with
- Edge-Native: Designed to run locally on low-power devices (e.g., NVIDIA Jetson) to ensure data privacy and zero latency.
- Automatic Reconnect: Smart reconnection logic for unstable V4L2/RTSP camera streams.
The Python version is the primary implementation and includes people tracking plus gender detection using DeepFace.
Setup:
- Ensure you have Python 3.10+ and a webcam connected.
- Activate the virtual environment:
source venv/bin/activate - Run the desired script:
python main.py: Attendance with gender analysis.python traffic_analyzer.py: Road traffic monitor.
The Rust version is a high-performance port located in the rust_cv directory. It uses ONNX Runtime and OpenCV with direct V4L2 support on Linux.
Setup:
- Install system dependencies (e.g.,
libopencv-devon Debian/Ubuntu). - Ensure
yolov8s.onnxandyolov8m.onnxare in the project root. - Navigate to the Rust directory:
cd rust_cv - Run a specific binary in release mode:
- Traffic:
cargo run --release --bin traffic_analyzer - Attendance:
cargo run --release --bin attendance - Objects:
cargo run --release --bin object_counter
- Traffic:
.
├── rust_cv/ # Rust source code and Cargo projects
│ ├── src/bin/ # Executables (traffic_analyzer, attendance, etc.)
│ └── src/lib/ # Perception & Tracking library
├── main.py # Main Python attendance entry point
├── traffic_analyzer.py # Python traffic sensing prototype
├── tracker.py # Base Python tracking logic
├── yolov8s.onnx # Compiled ONNX model (Small)
└── yolov8m.onnx # Compiled ONNX model (Medium)
This project is evolving into a city-scale sensing layer. Key milestones include:
- Homography Transform: Automated birds-eye-view mapping for sub-1km/h speed accuracy.
- RTSP Support: Integration with municipal IP camera infrastructure.
- DB Integration: Sending real-time mobility events to PostgreSQL/MQTT.
- Model Distillation: Optimizing models for ultra-low power hardware (NVIDIA Jetson).
Open-sourced for urban science and public mobility research.