Traffic Accident Severity Prediction System using Machine Learning with SHAP Explainability and Flask Web App

Traffic Accident Severity Prediction System using Machine Learning with SHAP Explainability and Flask Web App

Predict whether a road accident will be Slight, Serious, or Fatal using 32 real-world features covering driver profile, vehicle data, road conditions, and environment

Technology Used

Python | Flask | scikit-learn | XGBoost | LightGBM | Pandas | NumPy | SMOTE (imbalanced-learn) | SHAP | Matplotlib | Seaborn | Jupyter Notebook | HTML | CSS

codeAj
codeAjVerified
🏆2K+ Projects Sold
Google Review

499

1999

Get complete project source code + Installation guide + chat support

Project Files

Get Project Files

Traffic Accident Severity Prediction System using Machine Learning

Road accidents are one of the biggest causes of injury and death across the world, and a huge chunk of that damage comes down to how quickly emergency teams understand the seriousness of a crash. This Traffic Accident Severity Prediction System tackles that exact problem. It uses machine learning to look at 32 different details about an accident, like the driver's age, vehicle type, road surface, lighting, and weather, and then predicts whether the accident is likely to be Slight, Serious, or Fatal. The whole thing runs inside a clean Flask web application, so you do not just get a model sitting in a notebook, you get a working product you can actually demo in front of your examiner.

What makes this project stand out as a final year project is that it does not stop at accuracy. It also explains why the model made a decision using SHAP, which is exactly the kind of depth that turns an average submission into a top-grade one. If you want a project that looks polished, runs end to end, and gives you plenty to talk about during your viva, this one delivers. You can explore more options like this in our AI and Machine Learning projects collection.

Key Features

  • 32-Feature Prediction Engine covering driver profile, vehicle information, road conditions, and environmental factors for realistic, real-world predictions.
  • 8 Machine Learning Models Compared including Logistic Regression, Decision Tree, Random Forest, XGBoost, LightGBM, SVM, KNN, and Gradient Boosting, with the best one auto-selected by weighted F1 score.
  • SMOTE Class Balancing so rare but critical Fatal cases are not ignored by the model, a common weakness in accident datasets.
  • SHAP Explainability with global feature importance, summary plots, waterfall charts, and interactive force plots that show exactly which factors pushed a prediction toward Serious or Fatal.
  • Smart Feature Engineering like Time Category, Peak Hour flag, Weekend flag, Road Risk Score, Light Risk, and Vehicle Age Risk, derived automatically from raw data.
  • Flask Web Dashboard with a Home page, a 3-column prediction form, a 5-tab EDA dashboard, and a full model performance page.
  • Obsidian Gold Dark Theme giving the app a premium, modern look that stands out from the usual plain college submissions.
  • Probability Output shown as clean visual bars so the result is easy to read and easy to explain.

How It Works

The pipeline starts by cleaning the raw accident dataset and engineering new features from the time, road, and vehicle columns. The data is then balanced using SMOTE so that Fatal cases get fair representation during training. Eight models are trained and compared, and the strongest performer is saved as the final model. When a user fills in the prediction form on the website, the same preprocessing runs behind the scenes, the saved model predicts the severity class, and SHAP breaks down the reasoning so the output is transparent instead of being a black box.

Applications

  • Traffic Management Departments can prioritise emergency response based on predicted severity.
  • Insurance Companies can use severity estimates for faster claim assessment and risk scoring.
  • Road Safety Research teams can identify which conditions most strongly drive serious accidents.
  • Smart City Systems can integrate this as a module for automated accident reporting and alerting.
  • Academic Demonstration of a full ML lifecycle: data, models, explainability, and deployment in one place.

Why Choose This Project

This is a complete, submission-ready package. You receive the full source code, the dataset, four organised Jupyter notebooks, the trained model files, and the Flask app, all documented so you can run it without getting stuck. It is ideal for Computer Science, AI, Data Science, and IT students who want something that genuinely impresses. If you would like us to set it up for you, explain the code line by line, or prepare your report and presentation, take a look at our add-on services. You can also browse the complete final year projects collection or reach out through our contact page if you need help picking the right one.

Extra Add-Ons Available – Elevate Your Project

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

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

⭐ 98% SUCCESS RATE
  • Full Development
  • Documentation
  • Presentation Prep
  • 24/7 Support
Chat with us