AI Collision Detection

AI Collision Detection

Interactive road-safety platform visualizing 25,000+ CAM/DENM collision alerts on a Leaflet map, with a FastAPI backend and a scikit-learn random-forest prediction pipeline.

Tech Stack

Next.js

Next.js

Frontend application shell and routing

Leaflet

Leaflet

Interactive alert visualization on the map

FastAPI

FastAPI

Backend API serving filtered alert datasets

Python

Python

Data processing, scripting, and backend logic

scikit-learn

scikit-learn

Model training and prediction workflows

Random Forest

Random Forest

Classifier used to estimate collision risk

Machine Learning

Machine Learning

Supervised risk-detection approach built from CAM features

Architecture

Two-part platform combining a web application and a machine-learning pipeline. The web layer uses Next.js, React Leaflet, and CSS Modules, while the backend relies on FastAPI and locally stored JSON datasets. In parallel, a Python pipeline preprocesses trajectories, generates candidate pairs, labels collisions, trains a scikit-learn Random Forest model, and applies predictions to new situations.

Key Features

  • Interactive Leaflet map for vehicles, buses, cyclists, and DENM events
  • Filtering by alert type and station ID with dynamic legend updates
  • Visualization of more than 25,000 alerts extracted from CAM and DENM messages
  • FastAPI backend serving partitioned JSON datasets for smooth browsing
  • Collision-risk prediction based on CAM-derived features
  • Automatic generation of proximity pairs using spatial and temporal thresholds
  • Rule-based auto-labeling with speed, heading, and distance heuristics
  • RandomForestClassifier training pipeline with exported joblib model
  • Prediction script producing `predicted_collision` outputs for new samples
  • Evaluation with classification report, confusion matrix, and precision above 0.94
Mohamed Dyae Chellaf | Full-Stack Developer