Traffic Reducer is an open-source AI system that replaces static traffic light timers with real-time, vision-based signal control. A YOLOv8 model counts vehicles in each of four directional lanes (North, South, East, West), detects pedestrians and emergency vehicles, and applies a priority-aware decision algorithm to determine which signal should turn green — automatically, every cycle.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Xander44-4/traffic_reducer/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
Run the full system locally in under five minutes with one command.
Installation
Full dependency setup for Python 3.10/3.11, YOLOv8, FFmpeg, and Flask.
How It Works
Understand the YOLOv8 detection pipeline, zone mapping, and signal logic.
API Reference
Query live traffic data and trigger predictions via the REST API.
Using the Dashboard
Explore the live camera feed, intersection view, and manual controls.
Configuration
Choose your YOLO model variant and tune detection zone geometry.
How Traffic Reducer works
Capture video
Traffic Reducer ingests a live YouTube stream or a local drone-view video file. FFmpeg pipes raw frames into the Python process at up to 25 FPS.
Detect vehicles and hazards
Each frame is passed to a YOLOv8 model (nano, small, or medium). Cars, buses, trucks, motorcycles, pedestrians, and emergency vehicles are detected and assigned to one of four directional zones.
Decide the green light
The lane with the highest vehicle count gets the green signal. Pedestrian crossings and emergency vehicles trigger immediate priority overrides.
Key capabilities
YOLOv8 Detection
Supports yolov8n, yolov8s, and yolov8m — automatically selects the best available model weight file at startup.
Zone-Based Counting
Four polygon zones map the camera field of view to real-world intersection directions with configurable geometry.
Emergency Priority
HSV color analysis identifies red/yellow/blue emergency lights and overrides normal signal logic immediately.
Live & Local Sources
Stream from a YouTube live traffic camera or loop a local MP4 file at adjustable speed — switchable at runtime.
REST API
Eight endpoints expose counts, predictions, source control, and simulation data for programmatic integration.
Interactive Dashboard
Browser-based UI shows the annotated camera feed, per-lane vehicle counts, and a real-time intersection graphic.
Traffic Reducer requires Python 3.10 or 3.11 and an internet connection when using the YouTube live stream mode. See the Installation guide for the full requirements list.