A full-stack Traffic Management System built with Flask, React, MySQL, and AI. The system manages vehicles, violations, payments, and includes an AI-powered helmet violation detector with automatic license plate recognition.
- Login & registration
- Password hashing (bcrypt)
- JWT-based authorization
- Admin/user role support
- Add, view, search, and delete vehicles
- Auto-registration of unknown vehicles detected through AI or IoT
- Admin-only delete access
- Add violations manually
- View violations per vehicle
- Check violation details
- Update fine status after payment
Uses YOLOv8 + EasyOCR to automatically detect:
- Detects With Helmet / Without Helmet
- Creates bounding boxes + labels on the image
- Detects license plate
- Extracts plate number using OCR
- Auto-registers vehicle if not found
- Auto-inserts violation into MySQL
- Saves annotated evidence image
API: POST /autodetect
Simulates an IoT device reporting speeding violations:
- Validates API key
- Auto-registers unknown vehicles
- Calculates fine based on speed
- Logs "Speeding" violation
API: POST /iot/report-speeding
Provides summary stats:
- Total vehicles
- Total violations
- Total fines paid/unpaid
- Most common violation
- Username
- Role
- Violations reported
- Vehicles registered
- YOLOv8 helmet detection →
Weights/best.pt - YOLO license plate detection →
license_plate_detector.pt - OCR → EasyOCR
- OpenCV for image processing
MySQL tables:
loginuser
Vehicle
Violations
Fines
Backend: Flask, OpenCV, YOLOv8, EasyOCR, MySQL, JWT, bcrypt
Frontend: React.js, Axios, React Router
- Install Python dependencies:
pip install -r requirements.txt
- Create MySQL database
TrafficDBand importTrafficDB.sql. - Run backend:
python app.py
- Run frontend:
cd traffic-violation-frontend
npm install
npm start
Traffic-Management-System-With-Ai/
├── app.py
├── iot_radar_gun.py
├── TrafficDB.sql
├── Weights/
├── evidence_uploads/
├── traffic-violation-frontend/
└── screenshots/
Academic & educational use.
YOLOv8, EasyOCR, OpenCV, Flask, React communities.





