Skip to content

About

CNN-based car damage detection system for automated vehicle inspection.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🚗 AutoDamage.AI — Intelligent Car Damage Detection & Repair Estimator

Python 3.10+ PyTorch 2.0+ Flask 3.0+ License: MIT

A complete, production-grade automotive damage detection and repair cost estimation platform powered by Deep Residual Convolutional Neural Networks (CarDamageNet), Grad-CAM visual localization, and a modern, responsive Glassmorphic UI supporting both Dark and Light modes.


✨ Features & Capabilities

🔍 1. Multi-Category Damage Classification

  • Analyzes photos into 6 distinct categories:
    • F_Breakage: Front Breakage (Headlamps, bumper cover, front grille, windshield)
    • F_Crushed: Front Crushed (Heavy collision, crushed hood, radiator, unibody crumple)
    • F_Normal: Front Undamaged (Clean exterior)
    • R_Breakage: Rear Breakage (Taillights, rear bumper scuff, rear glass)
    • R_Crushed: Rear Crushed (Trunk crush, rear quarter panel collision)
    • R_Normal: Rear Undamaged (Clean rear)

🔥 2. AI Explainability & Grad-CAM Heatmaps

  • Real-time gradient-weighted class activation mapping (Grad-CAM) pinpointing the exact visual region where damage is located.
  • Interactive Multi-Mode Visualizer:
    • Heatmap View: Turbo/Jet colormap overlay with fine-tuned opacity slider (0–100%).
    • AI Bounding Boxes: Automatically extracts contours and draws precision bounding boxes around localized damage regions.
    • Split Comparison Slider: Interactive draggable before-and-after split slider comparing original vs. damage activation.
    • Original Image: Inspect the raw high-resolution photograph.

💰 3. Intelligent Repair Cost & Insurance Claim Estimator

  • Itemized parts and body shop labor breakdown based on automotive repair standards.
  • Estimated minimum, maximum, and expected claim cost range.
  • Dynamic Labor Rate Slider ($65 – $160 / hr) and Insurance Deductible Slider ($100 – $1,500) with live recalculation of:
    • Estimated Insurance Claim Payout
    • Estimated Out-of-Pocket Expense
  • Vehicle driveability guidance ("Safe to Drive", "Conditional Caution", "Tow to Collision Center Required").

🔄 4. 360° Multi-Angle Vehicle Inspection

  • Dedicated multi-angle auditor allowing users to upload 4+ viewpoints (Front, Rear, Driver Side, Passenger Side, Detail).
  • Generates a consolidated vehicle health score and cumulative repair estimate across all damaged zones.

📸 5. Instant Test Gallery & Live Camera Snapshot

  • 1-Click Test Gallery: 6 curated real-world vehicle scenarios from the dataset ready to test instantly without uploading.
  • Live Webcam Capture: Take photos directly from your smartphone or desktop webcam with reticle targeting.

📄 6. Official Printable Assessment Report

  • 1-click generation of a formal Automotive Damage & Insurance Claim Assessment Report complete with claim reference ID, metadata, visual evidence, itemized repair table, and printable CSS styling.

🎨 7. Modern Glassmorphic Design (Dark & Light Mode)

  • Ultra-modern frosted glass aesthetic with backdrop-filter: blur(24px), glowing neon accents, and fluid floating mesh orbs.
  • One-click animated theme toggle between Dark Mode (deep obsidian) and Light Mode (frosted pearl).
  • Fully responsive across desktop, tablet, and mobile devices.

🏗️ Architecture Overview

car-damage-detector/
├── app.py                     # Flask REST API & web server
├── inference.py               # AI inference, Grad-CAM, & repair cost engine
├── train.py                   # PyTorch training & evaluation pipeline
├── test_pipeline.py           # Automated unit and integration test suite
├── requirements.txt           # Python dependencies
├── models/
│   ├── model.py               # CarDamageNet deep residual architecture
│   ├── car_damage_model.pth   # Trained PyTorch checkpoint
│   └── model_metrics.json     # Validation metrics, confusion matrix, history
├── dataset/                   # 2,300 categorized vehicle images
│   ├── F_Breakage/ (500)
│   ├── F_Crushed/  (400)
│   ├── F_Normal/   (500)
│   ├── R_Breakage/ (300)
│   ├── R_Crushed/  (300)
│   └── R_Normal/   (300)
├── static/
│   ├── css/
│   │   └── style.css          # Glassmorphic responsive styling & animations
│   └── js/
│       └── app.js             # Client application logic & reactive UI
└── templates/
    └── index.html             # Master web dashboard template

🚀 Quickstart Guide

1. Installation

Ensure Python 3.10+ is installed:

git clone https://github.com/dilliram-code/car-damage-detector.git
cd car-damage-detector

pip install -r requirements.txt

2. Model Training (Optional - Checkpoint Provided)

To train or fine-tune CarDamageNet on the dataset:

python3 train.py

The script automatically partitions the dataset into stratified 80% train / 20% validation splits, trains using AdamW with cosine annealing, and saves the best model to models/car_damage_model.pth.

3. Launch the Web Application

python3 app.py

Open your browser at http://localhost:5001.


📡 REST API Reference

Method Endpoint Description
GET / Serves the interactive web dashboard
GET /api/health Health status, model readiness, device info
POST /api/predict Runs damage detection on an uploaded image (multipart/form-data or JSON base64)
POST /api/predict-multi Runs 360° multi-angle vehicle inspection across multiple image files
GET /api/samples Lists curated sample images for each class
GET /api/sample-image/<class>/<file> Serves a sample image file
GET /api/metrics Returns model validation accuracy, F1-scores, and confusion matrix
POST /api/estimate Recalculates cost with custom labor rate & deductible
POST /api/generate-report Generates official JSON claim inspection document

🧪 Running Automated Tests

Run the complete automated test suite verifying model shapes, Grad-CAM, bounding boxes, and all REST endpoints:

python3 -m unittest test_pipeline.py

📜 License

MIT License. Designed and developed for next-generation automated vehicle inspection and collision appraisal.

About

CNN-based car damage detection system for automated vehicle inspection.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages