iju123/AL_Assisted_Traffic_light_Control_system
0
๐ฆ AI-Assisted Traffic Light Control System
This is a real-time AI traffic light controller built with YOLOv8 + PyTorch + Gradio. It detects cars, trucks, and ambulances from camera feeds and gives priority to ambulances in traffic.
โจ Features
- Detects cars, trucks, ambulances from live video/images
- If an ambulance is detected โ traffic light turns GREEN โ
- Trucks can be double-checked with an optional ambulance classifier
- Built with Gradio for easy deployment and usage
- Runs on Hugging Face Spaces (no setup needed)
๐ ๏ธ How It Works
- YOLOv8 model detects vehicles in the frame.
- If YOLO labels a vehicle as a
truck, we optionally pass it to a small CNN classifier: ambulance_classifier.pthโ determines if it's an ambulance.- If missing โ fallback to YOLO only.
- Traffic rules (`traffic_logic.py`):
- Ambulance โ ๐ฆ GREEN LIGHT (priority passage)
- Otherwise โ ๐ฆ Normal rules for cars & trucks.
๐ Run Locally
Clone the repo and install dependencies:
git clone https://huggingface.co/spaces/your-username/traffic-light-ai
cd traffic-light-ai
pip install -r requirements.txt
