An AI-powered real-time vehicle detection and classification system designed specifically for Lagos, Nigeria roads. Detects and classifies Lagos-specific vehicle types including Okada, Danfo, BRT, Keke Napep, and more.
# 🚦 Lagos Traffic Analysis System
An AI-powered real-time vehicle detection and classification system designed specifically for Lagos, Nigeria roads. Detects and classifies Lagos-specific vehicle types including Okada, Danfo, BRT, Keke Napep, and more.
## 🎯 Features
- **Real-time Vehicle Detection** - Live video stream processing with YOLOv8
- **Lagos-Specific Classification** - Identifies local vehicle types:
- 🏍️ Okada (Motorcycles)
- 🚐 Danfo (Yellow Minibuses)
- 🚌 BRT (Blue Rapid Transit Buses)
- 🛺 Keke Napep (Yellow Tricycles)
- 🚍 Other Buses
- 🚚 Trucks
- 🚗 Private Cars
- **Unique Vehicle Counting** - IoU-based tracking counts each vehicle once
- **Professional Web Dashboard** - Modern UI with Tailwind CSS
- **Real-time Analytics** - Live charts and statistics
- **Database Logging** - SQLite storage for historical analysis
## 🖼️ Screenshots
*Add your screenshots here*
## 🛠️ Tech Stack
- **Detection**: YOLOv8 (Ultralytics)
- **Backend**: FastAPI + Uvicorn
- **Video Processing**: OpenCV
- **Database**: SQLite
- **Frontend**: HTML5 + Tailwind CSS + Chart.js
- **Real-time Updates**: WebSocket
## 📁 Project Structure
```
lagos_traffic/
├── config.py # Configuration settings
├── main.py # Main orchestration script
├── requirements.txt # Python dependencies
├── modules/
│ ├── detector.py # Vehicle detection & classification
│ ├── tracker.py # IoU-based vehicle tracking
│ ├── camera.py # Video/camera handling
│ └── database.py # SQLite database operations
├── dashboard/
│ ├── app.py # FastAPI backend
│ ├── templates/
│ │ └── index.html # Web dashboard UI
│ └── static/ # Static assets
├── test_videos/ # Place test videos here
├── database/ # SQLite database storage
└── logs/ # Application logs
```
## 🚀 Getting Started
### Prerequisites
- Python 3.9+
- pip
### Installation
1. **Clone the repository**
```bas …