π Car Damage Classifier & Cost Estimator (EfficientNetV2-M)
A production-grade EfficientNetV2-M computer vision model fine-tuned for automated vehicle damage classification and repair cost range estimation for automotive insurance claim pipelines.
Identifies 7 damage severity categories and maps each prediction to estimated repair costs in Polish ZΕoty (PLN).
π― Model Capabilities
- Damage Classification: 7 distinct damage categories including structural, component, and catastrophe damage.
- Cost Estimation: Integrates historical insurer claims cost intervals (PLN) for fast claims pre-assessment.
- Dual Formats:
efficientnet_v2_m_best.pthβ PyTorch weights.efficientnet_v2_m_damage.onnx+.onnx.dataβ High-performance ONNX model for TensorRT / C++ / Edge inference.damage_metadata.jsonβ Class names and corresponding repair cost intervals.
π Damage Classes & Estimated Repair Cost Ranges
| Class | Damage Type | Severity | Estimated Repair Cost (PLN) |
|---|---|---|---|
glass_damage |
Cracked / shattered windshield or side window | Minor | 300 β 3 000 PLN |
tire_damage |
Puncture / flat / sidewall rupture | Minor | 400 β 2 500 PLN |
minor_dent |
Surface dent / minor bumper scratch | Low | 500 β 2 000 PLN |
moderate_damage |
Deformed panels, door dent, bumper crack | Medium | 2 000 β 10 000 PLN |
severe_damage |
Heavy collision, crumpled hood, suspension impact | High | 10 000 β 30 000 PLN |
flood_damage |
Waterline immersion, electronics & interior water ingress | Critical | 15 000 β 50 000 PLN |
total_loss |
Frame / structural destruction, catastrophic accident | Total | > 50 000 PLN |
π Evaluation & Benchmark Metrics
- Overall Test Accuracy: 100% (across 420 balanced evaluation samples).
- Macro F1 Score: 1.000
- Weighted F1 Score: 1.000
- Business Misclassification Cost: 0.00 PLN on test set (zero critical under-estimation of severe/total loss claims).
π Quick Start (Inference)
1. Using ONNX Runtime (No PyTorch needed)
pip install onnxruntime pillow numpy huggingface_hub
import json
import numpy as np
from PIL import Image
import onnxruntime as ort
from huggingface_hub import hf_hub_download
# 1. Download model & metadata
model_path = hf_hub_download(repo_id="BiernyVR/car-damage-classifier", filename="efficientnet_v2_m_damage.onnx")
data_path = hf_hub_download(repo_id="BiernyVR/car-damage-classifier", filename="efficientnet_v2_m_damage.onnx.data")
meta_path = hf_hub_download(repo_id="BiernyVR/car-damage-classifier", filename="damage_metadata.json")
with open(meta_path, "r", encoding="utf-8") as f:
meta = json.load(f)
classes = meta["classes"]
cost_ranges = meta["cost_ranges_pln"]
# 2. Preprocess image
img = Image.open("damaged_car.jpg").convert("RGB").resize((224, 224), Image.Resampling.BILINEAR)
arr = (np.array(img, dtype=np.float32) / 255.0 - [0.485, 0.456, 0.406]) / [0.229, 0.224, 0.225]
tensor = np.expand_dims(np.transpose(arr, (2, 0, 1)), axis=0).astype(np.float32)
# 3. Run Inference
session = ort.InferenceSession(model_path, providers=["CPUExecutionProvider"])
logits = session.run(None, {"input": tensor})[0][0]
probs = np.exp(logits - np.max(logits))
probs /= probs.sum()
pred_idx = np.argmax(probs)
pred_class = classes[pred_idx]
cost = cost_ranges[pred_class]
print(f"Diagnosis: {pred_class} ({probs[pred_idx]*100:.1f}%)")
print(f"Estimated Cost: {cost[0]} - {cost[1]} PLN")
2. Standalone CLI
python infer.py --image sample_dent.jpg --topk 3
π¦ Repository Contents
efficientnet_v2_m_best.pth: PyTorch weights checkpoint.efficientnet_v2_m_damage.onnx+.onnx.data: Exported ONNX model.damage_metadata.json: Classes and PLN cost boundaries.confusion_matrix.png,business_cost_matrix.png,per_class_metrics.png,training_curves.png: Evaluation and training plots.sample_dent.jpg,sample_severe.jpg: Example test images.infer.py: Standalone CLI testing script.
Evaluation results
- Overall Accuracy on Vehicle Damage Benchmarkself-reported1.000
- Macro F1 on Vehicle Damage Benchmarkself-reported1.000