A two-server traffic enforcement system that helps traffic officers verify driver and vehicle information quickly using OCR, computer vision, and a centralized MySQL database.
The project has three main parts:
- Dummy Data Setup — prepares the MySQL schema and sample records used by the system.
- Server 1: Django (
DL_Detection) — handles driver’s license image upload, OCR extraction, database lookup, and API responses. - Server 2: Flask (
Number Plate Detection) — monitors live camera input, detects number plates in real time, and fetches vehicle details from Server 1.
This project automates two important traffic enforcement workflows:
-
Driver’s License Detection
- Upload a driver’s license image.
- Extract details using OCR.
- Match the extracted data against the database.
- Show owner, license, vehicle, and face details.
-
Number Plate Detection
- Read live vehicle feed from an IP camera.
- Detect number plates in real time using a pre-trained YOLO model.
- Cross-check the plate against the database.
- Flag suspicious, expired, or wanted records for officers.
Traffic_surveillance_Project/
├── 1_DummyData/
├── 2_DL_Detection_Server1/
├── 3_NumberPlate_Detection_Server2/
└── TrafficSurveillanceProject_Wireframe_ss/
-
1_DummyData/
Contains MySQL schema and database import instructions for the sample dataset used by both servers. -
2_DL_Detection_Server1/
Django backend for driver’s license detection, OCR, admin access, and APIs. -
3_NumberPlate_Detection_Server2/
Flask application for live number plate detection and real-time alerts. -
TrafficSurveillanceProject_Wireframe_ss/
Contains architecture diagrams, schema diagram, and UI preview screenshots.
Mobile / IP Camera
│
▼
Flask Server (Number Plate Detection)
│
├── detects plate in live feed
├── flags vehicle status
▼
Django Server (DL Detection / API Layer)
│
├── database lookup
├── vehicle + license data
├── face image / suspicious status
▼
MySQL Database
- Server 2 continuously watches the road feed.
- When a plate is detected, Server 2 calls Server 1 API.
- Server 1 reads the database and returns the relevant vehicle/driver details.
- The Flask UI displays the result instantly for traffic officers.
- Frontend/UI: Django templates, Flask templates
- Backend: Django, Flask
- Database: MySQL
- Computer Vision: OpenCV, YOLO
- OCR: Tesseract OCR
- Integration: REST APIs, IP camera stream, ngrok for public tunneling when needed
Use the dummy data folder to create and populate the MySQL database.
- Create the database schema
- Insert sample records
- Ensure both servers can query the same dataset
Server 1 provides:
- Driver’s license image upload
- OCR-based extraction
- Database lookup
- APIs for vehicle details and license details
- Optional Django admin panel for managing records
Server 2 provides:
- Live number plate detection
- Real-time vehicle flagging
- Officer-facing monitoring interface
- On-demand fetching of vehicle details from Django
Both servers should point to the same MySQL database and should be configured with the correct local or ngrok URL when needed.
-
POST /get_vehicle_details/- Input: number plate
- Output: vehicle details, suspicious status, face image URL
-
POST /get_data_from_license_image/- Input: license image file
- Output: owner details, DL details, vehicle details, suspicious person details, face image URL
- Flask sends the detected number plate to Django.
- Django returns the vehicle and person status.
- Flask shows the status on the monitoring page.
- Green & Yellow → minor felony such as expired PUC
- Orange → bad history
- Red → wanted currently
Person 1 — Green |
Person 1 — Continued |
Person 2 — Orange |
Person 2 — Continued |
Person 3 — Red |
Person 3 — Continued |
Detecting 1st flagged car |
Detecting 2nd flagged car |
Detecting 4th flagged car |
Vehicle details — Yellow |
Vehicle details — Orange |
Vehicle details — Red |
This project combines database-driven verification and real-time computer vision to assist traffic officers in making faster and more reliable decisions.
- Server 1 focuses on driver identity and document verification.
- Server 2 focuses on live road monitoring and vehicle flagging.
- MySQL acts as the shared data layer.
- The UI is designed for practical, mobile-friendly field usage.
- Use the correct local IP or ngrok URL when connecting Server 2 to Server 1.
- Make sure the phone camera and laptop are on the same Wi-Fi network for live stream-based use.
- The same database must be available to both servers.
- Tesseract OCR and YOLO dependencies must be installed correctly for the two detection flows.
The planning-stage diagrams below were created during early design work and are included here as a nice record of the project’s evolution, even though they are not central to the current runtime scope.

















