An AI-powered Smart City Traffic Management System built using Python, Flask, OpenCV, and YOLOv8. The application combines real-time vehicle detection, adaptive traffic signal simulation, congestion analytics, and an interactive dashboard into a single web application.
Designed as an educational and portfolio project, the system demonstrates how computer vision and traffic simulation can be integrated to create an intelligent traffic management solution without relying on paid APIs or cloud services.
- 🚗 Real-time vehicle detection using YOLOv8
- 📹 Support for multiple traffic video feeds
- 🚦 Adaptive traffic signal simulation
- 🚑 Emergency vehicle priority override
- 📊 Live analytics dashboard
- 📈 Traffic comparison and congestion metrics
- 🌐 Single-page Flask web application
- ⚡ Runs completely on local hardware
Modern landing page introducing the system and highlighting key metrics.
The simulation engine visualizes vehicle movement, adaptive traffic lights, congestion, and emergency vehicle prioritization in real time.
Compare traffic density, congestion levels, and analytics across multiple lanes.
Real-time AI vehicle detection powered by YOLOv8.
Features include:
- Vehicle Detection
- Vehicle Counting
- Lane Monitoring
- Live Bounding Boxes
- Traffic Density Estimation
Sample Videos/ Real time video
│
▼
YOLOv8 Detection Engine
│
▼
Vehicle Counts
│
▼
Traffic Simulation Engine
│
▼
Adaptive Signal Controller
│
▼
Flask Backend
│
▼
Interactive Dashboard
smart-city-traffic-management/
│
├── app.py
├── sim_engine.py
├── yolo_engine.py
│
├── templates/
│ └── index.html
│
├── sample_videos/
│
├
│
├── simulation-demo.mp4
└── README.md
Clone the repository
git clone https://github.com/tdizhere/smart-city-traffic-management.git
cd smart-city-traffic-managementCreate a virtual environment
python -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activateInstall dependencies
pip install Flask Flask-SocketIO Flask-Cors opencv-python numpy ultralytics requestspython app.pyOpen your browser:
http://127.0.0.1:5000
- Python
- Flask
- Flask-SocketIO
- OpenCV
- Ultralytics YOLOv8nano
- HTML
- CSS
- JavaScript
- Socket.IO
- Multi-camera monitoring
- Reinforcement learning traffic optimization
- Live CCTV integration
- Database support
- Historical analytics
- Automatic accident detection
- Smart parking integration
- IoT sensor support
This project is intended for educational, research, and portfolio purposes.
Developed as a demonstration of AI-assisted Smart City Traffic Management using Python, Flask, YOLOv8, OpenCV, and real-time traffic simulation.






