Mughees Ul Haq

Work 14 / 18

Scoring a car’s condition from photos

You photograph a car from up to four angles. Two segmentation models find the damage and the parts, each damage is assigned to the part it covers most, and the result is a health score from 0 to 10.

For
Final-year project at ITU Lahore, rebuilt in 2026
When
2024 to 2025, rebuilt June to July 2026
My part
Sole developer of the 2026 rebuild
Status
Vision module runs locally. Engine-health module planned.
Public photos of cars with damage and car parts outlined by two segmentation models.
Public photos of cars with damage and car parts outlined by two segmentation models.
Public photos of cars with damage and car parts outlined by two segmentation models.
Public photos of cars with damage and car parts outlined by two segmentation models.
Public photos of cars with damage and car parts outlined by two segmentation models.
Public photos of cars with damage and car parts outlined by two segmentation models.
Public photos of cars with damage and car parts outlined by two segmentation models.
Both models on public photos of cars. Switch between the damage layer and the parts layer, and move the slider to change the confidence cut-off. On the fourth photo the damage model finds nothing.

Photos: Oh deer! by Nyttend, Public domain; 1977-79 Toyota Corolla in an appaling "roadw… by Charlie from United Kingdom, CC BY 2.0; And it goes on! (26140601466) by Riley from Christchurch, New Zealand, CC BY 2.0; Ygdnt 1b (22849149019) by Greg Goebel from Loveland CO, USA, CC BY-SA 2.0; Peugeot 404 Limousine by Rolf Kranz, CC BY-SA 4.0; 1969 AMC Rebel SST 4-door sedan in green at… by CZmarlin (Christopher Ziemnowicz), CC BY-SA 4.0; Dülmen, Merfeld, Volvo PV 544 B18 -- 2021 --… by Dietmar Rabich, CC BY-SA 4.0. What I changed.

Damage, test mask mAP50
0.792
CarDD, 6 classes, YOLO11l-seg at 1024
Parts, test mask mAP50
0.754
carparts-seg, 23 classes
Weakest class
crack 0.60
Best: glass shatter 0.98
Scope
vision only
Engine module is planned

How it works

The damage model knows six damage types and the parts model knows 23 parts. For every damage polygon I compute its overlap with every part polygon and assign it to the part it covers most. The score weights each damage by severity, by how critical the part is, by the area it covers and by the model’s confidence:

penalty = Σ severity × criticality × area fraction × confidence
health = 10 · exp(−penalty / 60)

Results

On the CarDD test split the damage model reaches mask mAP50 0.792 (YOLO11l-seg at 1024 pixels). The first version, YOLOv8m-seg at 640, reached 0.751. The parts model reaches 0.754 on carparts-seg. The damage model is uneven by class: 0.98 for shattered glass, 0.60 for cracks.

Damage model: mask mAP50 by class, CarDD test split
Glass shatter0.98
Lamp broken0.91
Tire flat0.90
Dent0.68
Scratch0.68
Crack0.60

Crack, the bar in colour, is the weakest class.

What failed

A run focused on the crack class was stopped after two epochs and is not usable. Cracks are still the weakest class.

The 2025 thesis

This started as my final-year project at ITU. That version also had hardware: an ESP32 running FreeRTOS read engine data over OBD-II, and six engine features fed a gradient-boosting classifier. The thesis reports mAP@50 of 84.3% for damage and 87.6% for parts. Those come from the thesis’s own training runs and evaluation, which I have not re-run, so I don’t compare them with the rebuild’s test numbers.

Limits

Only the vision module exists in the rebuild. The engine-health module and adapting it to car models sold in Pakistan are the next phases.

From the run log

ch.05Rebuild: damage model v2Test mask mAP50 0.792Shipped

Setup: YOLO11l-seg at 1024 px on CarDD, about 4,000 images, 6 classes

Against v1, dent went from 0.60 to 0.68, scratch from 0.61 to 0.68 and crack from 0.55 to 0.60. Glass shatter is at 0.98, lamp broken 0.91, tire flat 0.90. This is the model the app runs.

ch.06Rebuild: parts modelTest mask mAP50 0.754Shipped

Setup: YOLOv8m-seg at 640 px on carparts-seg, about 3,800 images, 23 classes

23 part classes, aware of viewpoint and of left and right. This is the parts model the app runs.

ch.07A run focused on cracksStopped after 2 epochsKilled

Setup: Crack-focused training run

I stopped it after two epochs and it is not usable. Crack is still the weakest class at 0.60.

All 7 runs for this project

Tools

YOLO11l-seg, YOLOv8m-seg, Ultralytics.

CarDD (Wang et al., IEEE T-ITS 2023): non-commercial research use, credit required.

carparts-seg (Ultralytics): AGPL-3.0.

The full write-up

There is a longer write-up of this project. Email me if you’d like a copy.