Skip to content

Repository files navigation

🚦 Smart City Traffic Management System

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.


✨ Features

  • 🚗 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

📸 Landing Page

Modern landing page introducing the system and highlighting key metrics.


🎥 Traffic Simulation

The simulation engine visualizes vehicle movement, adaptive traffic lights, congestion, and emergency vehicle prioritization in real time.


📊 Traffic Comparison Dashboard

Compare traffic density, congestion levels, and analytics across multiple lanes.


🤖 YOLO Vehicle Detection

Real-time AI vehicle detection powered by YOLOv8.

Features include:

  • Vehicle Detection
  • Vehicle Counting
  • Lane Monitoring
  • Live Bounding Boxes
  • Traffic Density Estimation


🏗 Project Architecture

Sample Videos/ Real time video 
      │
      ▼
YOLOv8 Detection Engine
      │
      ▼
Vehicle Counts
      │
      ▼
Traffic Simulation Engine
      │
      ▼
Adaptive Signal Controller
      │
      ▼
Flask Backend
      │
      ▼
Interactive Dashboard

📂 Project Structure

smart-city-traffic-management/
│
├── app.py
├── sim_engine.py
├── yolo_engine.py
│
├── templates/
│   └── index.html
│
├── sample_videos/
│
├
│
├── simulation-demo.mp4
└── README.md

⚙️ Installation

Clone the repository

git clone https://github.com/tdizhere/smart-city-traffic-management.git
cd smart-city-traffic-management

Create a virtual environment

Windows

python -m venv venv
venv\Scripts\activate

Linux / macOS

python3 -m venv venv
source venv/bin/activate

Install dependencies

pip install Flask Flask-SocketIO Flask-Cors opencv-python numpy ultralytics requests

▶️ Run the Project

python app.py

Open your browser:

http://127.0.0.1:5000

🛠 Technology Stack

Backend

  • Python
  • Flask
  • Flask-SocketIO

Computer Vision

  • OpenCV
  • Ultralytics YOLOv8nano

Frontend

  • HTML
  • CSS
  • JavaScript

Communication

  • Socket.IO

🚀 Future Improvements

  • Multi-camera monitoring
  • Reinforcement learning traffic optimization
  • Live CCTV integration
  • Database support
  • Historical analytics
  • Automatic accident detection
  • Smart parking integration
  • IoT sensor support

📄 License

This project is intended for educational, research, and portfolio purposes.


👨‍💻 Author

Developed as a demonstration of AI-assisted Smart City Traffic Management using Python, Flask, YOLOv8, OpenCV, and real-time traffic simulation.

About

Real-time Intelligent Traffic Management System built with Python, Flask, YOLOv8, OpenCV, and Socket.IO featuring AI vehicle detection, adaptive signal control, congestion analysis, emergency override, and interactive traffic simulation.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages