
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.
Python | Django 5.2 | Django Channels | Daphne | LightGBM | scikit-learn | YOLOv8 | pandas | SQLite | Leaflet | Chart.js | OpenRouteService API | TomTom API | Docker | Nginx
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.
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.
.pkl files, loaded once at startup by a ModelRegistry singleton so predictions don't reload models on every requestSystemLog/vision/ with AJAX processing, so the page doesn't reloadWe'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.
| Task | Best Model | Key Test Metrics |
|---|---|---|
| Congestion class (4 classes) | LightGBM | Accuracy 73.08%, Macro F1 0.686, ROC AUC 0.871, Cohen's Kappa 0.595 |
| Traffic volume (regression) | RandomForest | MAE 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.
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.
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.
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.
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.
Add any of these professional upgrades to save time and impress your evaluators.
Personal session with an expert developer
We'll install and configure the project on your PC via remote session (Google Meet, Zoom, or AnyDesk).
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.
Fully customized to match your college format, guidelines, and submission standards.
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.
Reviews