Project Overview: Smart Flow is an AI-driven traffic management system that uses deep learning techniques to monitor real-time traffic, detect vehicles, and optimize traffic signals. This project leverages YOLOv3-tiny for vehicle detection, tracking, and counting. It aims to provide efficient traffic management at intersections by adjusting traffic signals based on real-time vehicle data.
- Real-Time Vehicle Detection: Detects cars, trucks, buses, and motorcycles using the YOLOv3-tiny model.
- Vehicle Counting: Counts the number of vehicles detected in each lane.
- Dynamic Traffic Signal Management: Assigns green signals to lanes with the highest vehicle count, ensuring optimal traffic flow.
- Deadlock Prevention: Implements a mechanism to avoid deadlock situations by considering lanes that have waited for long periods.
- Prediction-Based Signal Assignment: Predicts and assigns green signals based on real-time vehicle counts.
- Vehicle Tracking: Continuously tracks vehicles with a bounding box, displaying their probability of being a vehicle.
- Deep Learning: YOLOv3-tiny for vehicle detection.
- OpenCV: For video processing and displaying real-time results.
- MoviePy: For video frame extraction and parallel processing.
- Python: Programming language used for implementation.
-
Clone the Repository:
git clone https://github.com/your-username/Smart-Flow-Traffic-Management.git cd Smart-Flow-Traffic-Management
-
Install Dependencies:
- Install required Python packages using pip:
pip install -r requirements.txt
-
Download YOLOv8 Model Weights:
- Download the YOLOv8 model weights and place them in the project folder.
wget https://path-to-yolov8-model/yolov8n.pt
-
Prepare Input Video:
- Place your video file (e.g.,
rush.mp4
) in thevideos/
directory.
- Place your video file (e.g.,
-
Run the System:
- Run the Python script to start processing the video:
python traffic_management.py
- Video Input: The system takes a video input of the traffic scene with multiple lanes.
- Frame Extraction: The video is processed frame-by-frame to detect vehicles.
- Vehicle Detection: YOLOv3-tiny is used to detect vehicles (cars, buses, trucks, and motorcycles).
- Vehicle Tracking and Counting: Each detected vehicle is tracked and counted for each lane.
- Traffic Signal Management: The lane with the highest vehicle count is assigned a green signal. The system dynamically updates signals based on vehicle counts.
- Deadlock Prevention: If a lane has not received a green signal for a while, it is given priority to avoid deadlock.
- Criminal Tracking: Detect traffic rule violations and alert the nearest police station.
- Collision Detection: Predict and prevent potential traffic collisions.
- Number Plate Recognition: Integrate number plate recognition for vehicle identification.
- Emergency Vehicle Detection: Detect and prioritize emergency vehicles like ambulances and police cars.