Adaptive Traffic Light System (Final Year Project)
Design and simulate a smart traffic light system that uses object detection and a Large Language Model (LLM) to dynamically prioritize emergency vehicles at intersections.
Used YOLOv8 for object detection, local LLMs for decision-making, and SUMO with TraCI for traffic simulation and control.
Concepts:
Machine Learning, LLM, YOLO, Traci
The Goal:
The primary goal of this project is to build an intelligent, real-time traffic control system that detects emergency vehicles such as ambulances and firetrucks using computer vision and dynamically prioritizes them by adjusting traffic signals. By integrating YOLOv8 for object detection, SUMO for traffic simulation, and LLMs for decision-making, the system ensures emergency vehicles receive the fastest possible clearance while minimizing disruption to regular traffic flow. Designed for smart city infrastructure and intelligent traffic management, this solution aims to save critical response time and enhance public safety. ✅ Step-by-Step Process: • Scene Setup & Simulation A 4-way traffic intersection is simulated using SUMO (Simulation of Urban MObility) and visualized in Unity or Blender. It includes normal and emergency vehicles moving through predefined routes. • Emergency Vehicle Detection Using YOLOv8 Real-time camera frames or simulated renders are processed using a custom-trained YOLOv8 model to detect emergency vehicles (ambulances, firetrucks) and distinguish them from normal ones. • Metadata Extraction: Once an emergency vehicle is detected, metadata such as its position, direction, and type is extracted from the YOLO model's output. • Event Generation: The detection result is converted into structured event data (e.g., “Ambulance approaching from East at 98.4, 195.4”). • Decision Making via LLM: The event data is sent to a Large Language Model (LLM), which decides: → Which traffic light should turn green → How long it should stay green → Which other lanes should wait • Real-Time Signal Control Execution: The LLM’s decision is instantly communicated back to the SUMO simulation and Unity/Blender scene to reflect the light change in real time. • End-to-End Feedback Loop: The system continuously detects, decides, and updates the environment—creating an adaptive, responsive traffic system powered by AI.
1
The Challenge:
In congested urban environments, emergency vehicles often struggle to navigate traffic due to static traffic signal timings. Existing traffic control systems lack real-time adaptability and intelligence. This project tackles the challenge by combining cutting-edge AI technologies: YOLOv8 detects emergency vehicles in live traffic scenes, SUMO simulates realistic traffic behavior, and LLMs make contextual traffic signal decisions. The real challenge lies in integrating these components seamlessly and ensuring decisions are made fast enough to influence signal behavior in real time, all while preserving normal traffic efficiency.
2
The Result
The integrated system successfully demonstrated real-time emergency vehicle detection and intelligent traffic signal control in a simulated urban environment. Using YOLOv8, the model achieved high accuracy in identifying ambulances and firetrucks even in visually complex scenes. The LLM-based decision logic dynamically adjusted traffic light phases, giving priority to emergency vehicles with minimal disruption to regular flow. ✅ Emergency vehicles experienced significantly reduced wait times at intersections. ✅ Normal traffic remained stable with optimized signal phasing. ✅ The system maintained real-time performance, with frame-by-frame detection and response. ✅ A simulated 4-way intersection built in Unity/Blender reflected SUMO signal changes visually, proving system synchronization. This result validates the feasibility of deploying AI-driven traffic management solutions in smart cities to enhance public safety and emergency response efficiency.
3




