Vehicle Damage Classification Using Computer Vision
This project is developed as part of the MIS453 Midterm Project.
The goal is to build an end-to-end machine learning application that classifies vehicle damage images into predefined categories and serves predictions via a backend API.
📌 Problem Definition
Given a single RGB image of a vehicle, the system predicts one damage class among the following:
- F_Normal
- F_Breakage
- F_Crushed
- R_Normal
- R_Breakage
- R_Crushed
The task is strictly multi-class image classification.
📊 Dataset
- Source: DrBimmer / Comprehensive Car Damage (Hugging Face)
- Total samples: 2300 images
- Split: Stratified Train / Validation (80% / 20%)
- Classes: 6 (verified programmatically)
The dataset was visually inspected and class distributions were analyzed before model training.
🧠 Model & Training
- Architecture: ResNet18
- Training mode: Offline (no pretrained weight download)
- Loss: CrossEntropyLoss with class weighting
- Input size: 224 × 224
- Device: CPU
- Output: Trained model artifact saved to disk
Artifacts generated after training:
artifacts/model.ptartifacts/label_names.jsonartifacts/confusion_matrix.pt
📈 Evaluation
- Validation Accuracy: ~0.57
- Metrics: Confusion matrix + class-wise Precision / Recall / F1
- Strong performance on Front classes, lower recall on Rear damage types (expected due to visual similarity and class imbalance).
The goal of this project is not accuracy maximization, but demonstrating a correct and reproducible ML pipeline.
🚀 Backend API (FastAPI)
A FastAPI backend is implemented to serve predictions using the trained model artifact.
Available Endpoints
GET /health
Returns API status and class information.POST /predict
Accepts an image file and returns:- predicted class
- confidence score
- top-3 predictions
▶️ Local Setup & Run
1. Install dependencies
pip install -r requirements.txt