How bhushanchavan04/ai---smart-control-traffic-light works
This repository combines a PyGame four-way traffic simulation with a separate YOLO vehicle-counting script and a standalone distance-based tracker. The documented product workflow is vehicle detection and classification, density-based signal timing, then simulated traffic movement and visualization. The excerpts show the simulator’s thread startup and the detector’s video/model processing, but do not show the detector wired into the simulator; that integration is therefore not represented as an implemented connection.
Main entry points: vehicle_count.py YOLO Detection · simulation.py Simulation Main · tracker.py Distance Tracker · video.mp4 Video Input
Components 11
Traffic Simulation
- Simulation Main
simulation.py - Signal Timing
simulation.py - Vehicle Movement
simulation.py - PyGame Display
simulation.py
Vehicle Detection
- YOLO Detection
vehicle_count.py - Line Counting
vehicle_count.py
Object Tracking
- Distance Tracker
tracker.py
Input Data
- Video Input
video.mp4 - YOLO Weights
yolov8s.pt - COCO Labels
coco.names
Other components
- Operator
Connections 10
- Operator → Simulation Main: runs
README.md - Simulation Main → Signal Timing: starts thread
simulation.py - Simulation Main → Vehicle Movement: starts thread
simulation.py - Simulation Main → PyGame Display: runs display
simulation.py - Signal Timing → Vehicle Movement: controls movement
README.md - YOLO Detection → Video Input: reads frames
vehicle_count.py - YOLO Detection → YOLO Weights: loads model
vehicle_count.py - YOLO Detection → COCO Labels: reads labels
vehicle_count.py - YOLO Detection → Line Counting: tracks crossings
vehicle_count.py - Distance Tracker → Operator: provides IDs