Car Damage Detection
Instance segmentation of 7 types of physical damage on cars, for insurance, rental and resale inspection workflows. Given a photo, the model outputs a pixel mask, a bounding box, a damage class and a confidence score for every damaged region it finds.
More information: https://github.com/Naiscorp-Robotics/Car-Physical-Damage-AI
Examples
Five damaged regions across three classes

Tear and paint scratches

Side panel

Single crease, high confidence

A failure case — read this one. The dent on this hood is obvious to a human, but at the default threshold of 0.7 the model returns nothing. It only appears at 0.5, scoring 0.57:

The demo images do not cover all 7 classes — the only available example of Vỡ kính / Broken glass had a readable licence plate and a phone number burned into the frame, so it was excluded rather than published.
Installation
pip install cardamage
Quick start
import torch
from PIL import Image
from cardamage import AutoModel
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = AutoModel.from_pretrained("Naiscorp/car-damage-detection").to(device).eval()
overlay = model.inference(Image.open("car.jpg")) # PIL.Image with masks drawn
overlay.save("damage.png")
Structured output instead of a picture:
r = model.predict(Image.open("car.jpg"))
r["boxes"] # (N, 4) float32, xyxy in ORIGINAL image coordinates
r["scores"] # (N,) float32
r["classes"] # (N,) int64, 0..6
r["labels"] # list[str], Vietnamese
r["labels_en"] # list[str], English
r["masks"] # (N, H, W) bool, pasted back to the original resolution
Labels
| id | Tiếng Việt | English |
|---|---|---|
| 0 | Móp lõm | Dent |
| 1 | Trầy sơn | Paint scratch |
| 2 | Rách | Tear |
| 3 | Mất bộ phận | Missing part |
| 4 | Thủng | Puncture |
| 5 | Bể đèn | Broken lamp |
| 6 | Vỡ kính | Broken glass |
Training data
Using car-damage-dataset to train this model
License and attribution
model.py re-implements the inference algorithms of
Detectron2 (Copyright 2019-present,
Facebook, Inc. — licensed under the Apache License, Version 2.0), keeping the original module
and parameter names so that checkpoints trained with Detectron2 load without any key
remapping.