Road Accident Severity Prediction

A Streamlit-based predictive system that estimates road traffic accident severity from key accident and driver features, delivering interpretable class probability insights and deployment-ready inference logic.

Overview

This project is a production-aware road traffic accident severity predictor. It uses structured accident metadata and a trained inference pipeline to classify severity as Fatal injury, Serious Injury, or Slight Injury and displays confidence scores through a responsive Streamlit app.

  • Deployment-ready Streamlit UI for rapid evaluation and model demonstration
  • Structured input form aligned with the training pipeline feature contract
  • Probability visualization and severity risk messaging for non-technical users
  • Local model artifacts packaged for immediate deployment

Core Capabilities

  • Predict accident severity from 10 critical trip and driver attributes
  • Server-side inference built on a serialized scikit-learn pipeline
  • Interactive confidence metrics and probability distribution charts
  • Model diagnostics surfaced in a debug sidebar for transparency

Inputs

The app accepts concise accident details through form controls. The trained pipeline was built to preserve the same feature order and categories as the deployment inputs.

  • Collision type, driver age, gender, education, and vehicle service year
  • Day of the week and accident location context
  • Number of vehicles involved, casualties count, and hour of day
  • Preprocessed categorical features with consistent label encoding and one-hot transformation
Road Accident Severity Prediction interface
Streamlit inference interface for road accident severity prediction.

Model Output

  • Predicted accident severity label with descriptive risk messaging
  • Confidence percentage displayed with same session interaction
  • Probability distribution chart for all severity classes
  • Modeled output positioned for decision support rather than operational response

Architecture

  • Streamlit app: `app.py` provides the UX and inference flow
  • Inference pipeline: `model_pipeline.joblib` contains preprocessing and the trained model
  • Label encoder and feature names persisted to guarantee deployment compatibility
  • Metrics JSON drives transparent performance reporting in the UI

Deployment

  • Deployment artifacts included: `model_pipeline.joblib`, `label_encoder.joblib`, `feature_names.joblib`, `model_metrics.json`
  • Streamlit-compatible runtime and requirements files for easy hosting
  • Procfile support for PaaS deployment on Heroku/Render
  • Project built for rapid handoff as a demo or decision-support prototype

Business Impact

  • Enables rapid model evaluation for road-safety stakeholders
  • Supports scenario testing with structured accident attributes
  • Improves communicability of model risk through confidence and probability charts
  • Provides a clear, production-ready example of ML deployment and user-facing explainability

Tech Stack

  • Python, Streamlit, pandas, NumPy
  • scikit-learn for model training and inference pipeline serialization
  • imbalanced-learn SMOTE support for class imbalance handling
  • Matplotlib for probability visualization and model metrics reporting
  • GitHub-friendly deployment artifacts and Streamlit hosting readiness