MahaTraffic: AI Traffic Prediction and Smart Signal System for Pune (Django + LightGBM + YOLOv8)

MahaTraffic: AI Traffic Prediction and Smart Signal System for Pune (Django + LightGBM + YOLOv8)

Predict tomorrow's traffic jams at 16 Pune junctions, auto-suggest signal timings and count vehicles from photos with YOLOv8. A Django AI final year project that actually runs.

Technology Used

Python | Django 5.2 | Django Channels | Daphne | LightGBM | scikit-learn | YOLOv8 | pandas | SQLite | Leaflet | Chart.js | OpenRouteService API | TomTom API | Docker | Nginx

codeAj
✓
codeAjVerified
🏆5K+ Projects Sold
Google Review
₹499₹1999

Get complete project source code + Installation guide + chat support


Abstract

MahaTraffic is a full-stack Django application that predicts next-day traffic congestion and vehicle volume across 16 major intersections in Pune, Maharashtra. It's trained on a 66,913-row Maharashtra traffic dataset, turns 16 raw columns into 83 engineered features, and compares 31 machine learning models before picking the winners: a LightGBM classifier for congestion class and a RandomForest regressor for traffic volume. On top of the predictions, the app recommends adaptive signal green times, scores driving routes against forecasted bottlenecks, handles emergency vehicle alerts over WebSockets, and detects vehicles in uploaded road images using YOLOv8. Everything sits behind a saffron-accented dark dashboard with role-based login for Admins and Operators.

What This Project Actually Does

Think of it as a control room for Pune's traffic. Small, but real.

Every day, the system looks at the last few weeks of traffic history for places like Hinjawadi Phase 3, Swargate, Shivajinagar and Katraj, and answers two questions: how many vehicles will pass through tomorrow, and how bad will the congestion be? It sorts congestion into four buckets (Low, Moderate, High, Severe), and each bucket maps to a recommended signal green time, anywhere from 30 seconds up to 75.

Then it puts those predictions to work. The live map colours each junction green, amber, orange or red. The route planner checks whether your route passes within 500 metres of a junction that's predicted to choke up, and if it does, it inflates the ETA so you can pick a smarter path. And if you upload a photo of a road, YOLOv8 draws boxes around every car, bus, truck and bike and gives you a count. That's the whole thing, really. It's not a demo that shows one chart and calls it AI.

Key Features

Prediction and Machine Learning

  • Next-day congestion class prediction with a tuned LightGBM model (73.08% test accuracy, 0.871 ROC AUC across 4 classes)
  • Next-day vehicle volume prediction with RandomForest, landing at roughly 5,200 vehicles mean absolute error on the test set
  • 83 engineered features including lag values, 3/7/14-day rolling stats, Indian holiday flags, weather encodings and neighbourhood congestion signals
  • 31 trained models stored as .pkl files, loaded once at startup by a ModelRegistry singleton so predictions don't reload models on every request
  • Time-based train/validation/test split (70/15/15), so there's no data leakage from the future into training. Your examiner will probably ask about this. Now you have an answer.

Dashboard and Live Map

  • Summary cards for active intersections, high/severe counts, mean volume and open emergencies
  • 30-day volume trend line chart and a congestion doughnut chart built with Chart.js
  • Leaflet map on CartoDB dark tiles, centred on Pune, with clickable colour-coded markers and a class filter legend
  • WebSocket updates through Django Channels, with automatic reconnect and a 60-second polling fallback if the socket drops

Smart Routing and Signals

  • Type a From and To location, get geocoded results via Nominatim and directions from OpenRouteService
  • Route scoring that applies penalties of 1.0x, 1.15x, 1.4x and 1.8x depending on predicted congestion near each junction
  • Signal control page comparing recommended vs actual green time, plus a manual override form that writes an audit entry to SystemLog
  • Emergency vehicle reporting that overrides the signal, broadcasts to every connected screen instantly, and restores the signal once resolved

Computer Vision

  • Drag-and-drop image upload on /vision/ with AJAX processing, so the page doesn't reload
  • YOLOv8n inference returns an annotated image plus separate counts for cars, trucks, buses and motorcycles
  • A history table of recent detections and a simple heuristic to flag possible emergency vehicles

Transparency and Access Control

  • An Analytics page with full model leaderboards, a confusion matrix heatmap, the top 25 feature importances and an "honesty panel" that shows where the model falls short
  • Two roles: Admin gets everything including Django admin, Operator only sees the dashboard, map and intersection pages
  • 8 pytest tests covering role permissions, the feature contract, registry loading, seed idempotency and route penalty logic

Model Performance (The Honest Numbers)

We're not going to tell you this predicts traffic with 99% accuracy. Nobody's traffic model does that, and if a project claims it, the examiner will smell it immediately.

TaskBest ModelKey Test Metrics
Congestion class (4 classes)LightGBMAccuracy 73.08%, Macro F1 0.686, ROC AUC 0.871, Cohen's Kappa 0.595
Traffic volume (regression)RandomForestMAE 5,200, RMSE 7,685, R-squared 0.588, MAPE 23.84%

The models were picked from leaderboards that include XGBoost, HistGradientBoost, ExtraTrees, SVR, MLP and an LSTM. Test scores sit very close to validation scores, which tells you the models generalise rather than memorise. That's a good talking point for your viva.

Intersections Covered

Hinjawadi Phase 3, Pune Station, Shivajinagar, Deccan Gymkhana, Hadapsar Gadital, Swargate, Katraj, Chinchwad, Pimpri, Kothrud, Baner, Pashan, Kondhwa, Marketyard, Sangvi and Balewadi. IT corridors, bus terminals, wholesale markets, residential belts. A decent mix of how traffic actually behaves in a growing Indian city.

Tech Stack

  • Backend: Django 5.2, Daphne 4.2 (ASGI), Django Channels, django-apscheduler, WhiteNoise
  • Machine learning: LightGBM 4.6, scikit-learn 1.6, pandas 2.3, joblib, ultralytics YOLOv8n
  • Database: SQLite in WAL mode
  • Frontend: Django templates, Leaflet, Chart.js, a custom "Signal Grid" CSS design system
  • External APIs: TomTom Traffic Flow, Open-Meteo, OpenRouteService, Overpass (OSM), Nominatim
  • Deployment: Docker Compose with Nginx reverse proxy, or systemd + Nginx

Real-World Applications

  • Pune Municipal Corporation or PCMC traffic cells planning signal timings a day ahead of expected rush, especially during Ganesh Chaturthi or monsoon weeks
  • Ambulance and fire services getting signal priority through the emergency override
  • IT parks in Hinjawadi or Baner advising employees on which routes to avoid tomorrow morning
  • Logistics companies running delivery fleets around Marketyard and Chinchwad picking routes with lower congestion penalties
  • Smart city research labs using the 83-feature pipeline as a baseline before testing their own models

What's Hard About This Project (and What Isn't)

Honestly, the hardest part is the ML artifacts folder. It's about 1 GB, holds 31 trained models plus encoders and metadata, and it has to sit in exactly the right place (ml/artifacts/) or the registry won't load. There's also a rule you can't break: the app has to run as a single Daphne process because SQLite and the in-memory channel layer don't support multiple workers. Run it with Gunicorn and four workers and you'll get weird behaviour.

But here's what makes it easier than it looks. You don't need a single API key to get it running. Without TomTom or ORS keys, the app switches to simulated mode, seeds 35 days of Maharashtra traffic data, runs predictions on command, shows everything on the map, and YOLOv8 detection works fully offline after the first model download. So your demo won't die because some API quota ran out the night before submission.

Who Should Buy This

If you're a student who needs a working project for your college submission, final-year project, semester project, internship, or academic demonstration, this is for you. Whether you're studying BCA, B.Tech, MCA, M.Tech, Computer Science, IT, AI, Data Science, or another related field, you can choose a project that fits your requirements. If you need the source code, project report, documentation, or help setting up and running the project, CodeAj gives you the resources and support to get started faster.

This one fits best if your guide wants "real ML, not just an API call," or if you want a project with three demo-able wow moments: the colour-coded map, the image detection, and the emergency broadcast hitting two browser windows at once. If you're looking around for more options first, browse our AI and ML final year projects or the full set of Django projects with source code.

Why CodeAj

You get the complete source code, the trained model artifacts, the Jupyter training notebook and a project report you can adapt for your college format, so you're not writing 60 pages from zero the week before submission. If setup goes sideways on your laptop, our team will help you get it running, whether that's a dependency mismatch on Windows or the artifacts folder sitting one level too deep. We've seen most of the ways this breaks. If you want to compare it with other model-heavy builds, our machine learning projects collection is a good place to look.

Frequently Asked Questions

You will get the complete source code along with an installation guide and chat support to help you set up and understand the project.
All our projects are thoroughly tested multiple times, so the code is completely error-free. But in case you still face any issue, you can reach out to us on WhatsApp (+91 8603862290) and we will fix it and provide you the updated code.
You can book a 1-on-1 Setup & Explanation Session where we connect via AnyDesk and Google Meet, set up the project on your laptop, and explain the complete code working and flow.
No, you cannot re-sell the project. This is completely illegal and a violation of our terms. If we find any such activity, we will take legal action.
Mostly, yeah. Without internet or API keys it drops into simulated mode, so the dashboard, predictions, intersection pages and YOLOv8 detection all keep working. The route planner and the map tiles need internet though. Run one detection at home first so the YOLO weights get downloaded, and you're covered.
For predicting tomorrow's congestion across 4 classes, it's solid. The ROC AUC is 0.871 and the test score is almost the same as validation, which proves the model isn't just memorising. Honestly, explaining why it isn't 99% will impress an examiner more than a suspicious perfect score.
Nope. All the trained models sit in the artifacts folder and load once when the server starts. The Jupyter notebook is included if you want to show training live or tweak something, but you don't need to touch it to get the app working.
You can, but plan for a few days, not a few minutes. You'd need traffic data for your junctions in the same column format, then retrain through the notebook and reseed the database. If your guide insists on a local city, reach out and we'll tell you exactly what's involved.
Upload a photo of a road and it counts cars, trucks, buses and motorcycles, draws boxes around each one, and stores the result in a history table. It's image-based, not live CCTV video. Keep that straight when you explain it so nobody asks for a live camera demo.
Because SQLite and the in-memory channel layer only behave in a single process. Multiple workers means WebSocket messages and database writes go weird. Stick to one Daphne process, which is what the Docker setup already does. For real production you'd swap to PostgreSQL and Redis.
Open ml/features.py and the training notebook side by side. You've got 83 features in 8 groups, things like 7-day volume lags, rolling congestion averages and an Indian holiday flag, plus 24 charts from EDA and model comparison. Drop a few of those charts straight into your report.
Installation Guide

Extra Add-Ons Available – Elevate Your Project

Add any of these professional upgrades to save time and impress your evaluators.

Live 1-on-1 Mentorship

Personal session with an expert developer

Project Setup

We'll install and configure the project on your PC via remote session (Google Meet, Zoom, or AnyDesk).

Source Code Explanation

1-hour live session to explain logic, flow, database design, and key features.

Want to know exactly how the setup works? Review our detailed step-by-step process before scheduling your session.

₹999

Custom Documents (College-Tailored)

  • Custom Project Report: ₹1,500
  • Custom Research Paper: ₹1,000
  • Custom PPT: ₹800

Fully customized to match your college format, guidelines, and submission standards.

Project Modification

Need feature changes, UI updates, or new features added?

Charges vary based on complexity.

We'll review your request and provide a clear quote before starting work.

Project Files

GoogleReviews

What Our Students Say

5(38+ reviews)
S
Sujit Chavan
a month ago

He explained the project clearly and thoroughly. He was very supportive throughout the process and was always available to help when needed. His guidance and assistance made it easier to understand the project and complete tasks effectively.

Y
Yash Baisware
4 months ago

I had a very good experience with CodeAj Marketplace. The team is professional and supportive, especially Ajay Pandit sir who guides clearly throughout the project. The work was completed neatly and according to requirements. A great place for learning and project development. Highly recommended for students and developers.

R
Ravi Singh
3 months ago

Excellent explanation! Concepts are explained in a very simple and understandable way. It really helped me a lot in improving my knowledge. Great work!

K
Keerthika S
a year ago

Codeaj was really helpful with my project, especially during the customization part. He didn't just do the work but also took the time to explain everything, from the project structure and database to the code itself. It was a huge help, especially for students trying to understand how everything fits together. I really appreciated his support and the way he made things easier to follow.

S
Sprillxstone
10 months ago

Working with CodeAj Marketplace has been such a positive experience. The projects delivered are original, carefully crafted from scratch, and tailored to meet expectations with impressive attention to detail. What really makes him stand out is his willingness to go the extra mile — not just in creating outstanding work, but also in helping others understand how everything functions. He explains things clearly, addresses questions patiently, and ensures the whole process feels like a learning journey instead of just a handover. On top of the technical expertise, his calm and approachable personality makes communication effortless. No unnecessary stress, just smooth collaboration and genuine support. I truly value the dedication he brings to his work and would highly recommend him to anyone in search of high-quality, authentic projects.

A
Abdullah ATK
11 months ago

I purchased a project from him recently and I have to say it's one of the best decisions I've made. The project was absolutely beautiful, built completely from scratch with no shortcuts, and perfectly matched what I wanted. What makes him stand out is not just his ability to create anything we ask for, no matter how complex, but also the way he helps us understand every part of it. He patiently explains the process, clears doubts, and makes sure we actually learn from the project instead of just using it. On top of his skills, his personality is amazing — he's calm, chill, and very friendly to talk to. There's no stress when working with him, only smooth communication and genuine support. I truly appreciate the effort he puts in and would highly recommend him to anyone looking for original, high-quality projects.

J
Jaya shree
9 months ago

I received my project from CodeAJ Marketplace on time, and the work was very neat and well-presented. The team maintained good communication and delivered everything as promised. I appreciate their timely completion and professional approach.

T
taha vohra
a year ago

I sincerely thank Mr. Ajay Pandit for his constant support and valuable guidance throughout the project. His timely advice, encouragement, and expertise greatly contributed to the successful completion of the work. I'm truly grateful for his mentorship.

S
Sonal
10 months ago

I had an outstanding experience with CodeAj while developing my mobile app. Their team was incredibly cooperative, ensuring every customization I requested was implemented flawlessly. The service was top-notch, and the final product exceeded my expectations. Highly recommend CodeAj for anyone seeking professional and reliable app development services! 11/10

R
Rutik Jagtap
a year ago

I would like to sincerely thank Ajay Pandit for providing me with the project. His guidance and explanation of the system's architecture, modules, and AI integration were extremely helpful in understanding the project thoroughly. Ajay's support played a key role in helping me implement the hotel booking and payment module effectively. His willingness to clarify concepts and walk me through complex logic made the learning process smooth and insightful. I truly appreciate his mentorship and the time he dedicated to ensuring I was well-prepared for both the development and presentation of this project.

P
Prachi Narkar
a year ago

I had a great experience with the project I purchased. It was well-structured and met all my expectations. The team was responsive and supportive throughout, addressing all my queries promptly. Highly recommended for anyone looking for quality projects and good service.

V
varshi v
11 months ago

I'm really thankful to Codeaj for helping me with my project explanation and guiding me throughout. Your support made everything much easier and clearer.

S
Sreekrutha Pasunuru
9 months ago

The project he made was wonderful, and the way he patiently listened, understood all my ideas and presented them so well in the project, was amazing. I would highly recommend him to everyone.

A
Anushka A
a year ago

I would like to sincerely thank Ajay Pandit for providing me with the project. His guidance and explanation of the system's architecture, modules, and AI integration were extremely helpful in understanding the project thoroughly.

M
Mohini Singh
11 months ago

Too good experience, I love their projects and they are available for you to help, they are incredible good. Must avail their services. I am happy customer.

R
Ramavath Parvathi
11 months ago

The team was very supportive and their explanation was very good, they are clarifying each and every doubts with lots of patience. Highly recommended for quality projects.

S
Soundarya S
6 months ago

I really like their work and they made good project in less amount.

S
Sambhaji Sonwane
a year ago

Thank you, CodeAj Bro, for supporting the Doctor Appointment System project. Your guidance during the project setup, installation, and report creation was very helpful and greatly appreciated.

M
Mukul Panwar
11 months ago

One of the best Software Developer provide the best setup environment for project, good explain skills, and good technical skills, step by step explain project through google meet and budgetly price project Available.

R
Rasika Tambe
a year ago

Thank you so much for your excellent work on our project! Your kindness and clear explanations made the entire process smooth and enjoyable. Highly recommend!

P
payal Tripathi
a year ago

Really very supportive, helpful and kind, loving nature. Available for any time for any query, highly recommend to get projects from him.

E
Evan Lavigne
a year ago

Awesome projects. They support on setting up the project after purchasing. Completely legal one. Affordable projects too.

S
Satesh kumar Nayak
a year ago

Code AJ guide team are very formal, friendly to setup project step by step and explain each question 🙂

S
sanjay mp
a year ago

Thank you codeAj, Best site to get your project done quickly, with fast responses and instant clarification of any project-related doubts.

A
ahmedafa
a year ago

I really liked the work, and they solved my issues very well too.

G
Gauri Pandey
a year ago

They provide very good service and code also running condition and they fulfill all the queries it's very helpful.

D
DasHy
a year ago

Really helpful, makes things easy to understand and very kind nature, you can look forward to get help from here.

P
Prashant Undalli
10 months ago

Thank you so much for building the Project for my requirement.

S
Sunhith Reddy
11 months ago

Looking forward to many many collaborations and always tend to buy the projects.

H
Hemant kumar Kushwaha
a year ago

I am so satisfied with codeAJ because of his help.

A
Anjali
a year ago

Thank you so much sir for your support and help.

G
Govardhan Reddy
a year ago

Ajay bro has excellent knowledge and his response is nice.

J
Janet Ase
a year ago

This is a great app I love it with good functionality.

A
Anjali Varun
a year ago

Thank you so much for your help and support.

S
Sanskruti Kalshetti
a year ago

Highly recommended for the projects.

P
Purva Chavan
a year ago

Loved the project work.

P
p.p.s. raghavendra
11 months ago

It is super for students.

P
Pranita Sandim
a month ago

I recently purchased this project online and I am very satisfied with it. The project was well-designed, properly organized, and included all the necessary files and documentation. The source code was clean, easy to understand, and worked as expected. A special appreciation for the project explanation and setup session. The session was detailed and easy to understand, covering both the project implementation and the complete setup process. All my questions were answered clearly, which helped me understand the project much better. Thanks for giving your time.

⭐ 98% SUCCESS RATE
  • ✓ Full Development
  • ✓ Documentation
  • ✓ Presentation Prep
  • ✓ 24/7 Support