A deep learning project for detecting and classifying car damage using computer vision. The project covers multiple tasks — starting from classification, moving to object detection, with more to come.
Given an image of a damaged car, the models can:
- Classify what types of damage are present (multi-label classification)
- Locate exactly where the damage is (object detection with bounding boxes)
car-damage/
├── classification/
│ └── car_damage_classification.ipynb # Multi-label classification pipeline
├── object_detection/
│ └── car_damage_detection.ipynb # YOLOv8 object detection pipeline
├── .gitignore
├── LICENSE
└── README.md
- Source: CarDD — Car Damage Detection Dataset on Kaggle
- Size: ~4,000 high-resolution images, 9,000+ damage instances
- Format: COCO JSON annotations (bounding boxes + segmentation masks)
- Split: Train (2,816) / Val (810) / Test (374)
| Class | # Images |
|---|---|
| Scratch | 2,121 |
| Dent | 1,751 |
| Lamp Broken | 693 |
| Glass Shatter | 674 |
| Crack | 604 |
| Tire Flat | 309 |
- Backbone: EfficientNet-B3 pretrained on ImageNet
- Strategy: Transfer learning — frozen early layers, fine-tuned last 3 blocks
- Head: Custom classifier (Linear → ReLU → Dropout → Linear)
- Output: 6 independent probabilities (one per damage class)
| Parameter | Value |
|---|---|
| Epochs | 60 |
| Batch size | 32 |
| Optimizer | AdamW |
| Loss | BCEWithLogitsLoss (weighted) |
| Scheduler | CosineAnnealingLR |
| Image size | 224 × 224 |
| Device | GPU (CUDA) |
| Class | ROC-AUC | F1 @ 0.5 | F1 @ Best Threshold |
|---|---|---|---|
| Glass Shatter | 0.9899 | 0.8535 | 0.8986 |
| Tire Flat | 0.9880 | 0.6988 | 0.8519 |
| Lamp Broken | 0.8994 | 0.5846 | 0.6567 |
| Dent | 0.8502 | 0.7411 | 0.7514 |
| Scratch | 0.8428 | 0.7838 | 0.7911 |
| Crack | 0.8074 | 0.4062 | 0.4912 |
| Overall | 0.8963 | 0.6789 | 0.7568 |
📝 Per-class thresholds were tuned using Precision-Recall curves on the test set.
- Architecture: YOLOv8m (medium) pretrained on COCO
- Strategy: Fine-tuned on CarDD dataset
- Input: COCO annotations converted to YOLO format
- Output: Bounding boxes + class labels + confidence scores
| Parameter | Value |
|---|---|
| Epochs | 100 |
| Batch size | 16 |
| Optimizer | AdamW (auto) |
| Image size | 640 × 640 |
| Device | GPU (CUDA) |
| Early stopping | patience = 15 |
| Class | mAP50 | mAP50-95 |
|---|---|---|
| Glass Shatter | 0.986 | 0.937 |
| Tire Flat | 0.936 | 0.902 |
| Lamp Broken | 0.889 | 0.781 |
| Dent | 0.618 | 0.373 |
| Scratch | 0.585 | 0.336 |
| Crack | 0.499 | 0.262 |
| Overall | 0.752 | 0.599 |
| Class | Classification F1 | Detection mAP50 |
|---|---|---|
| Glass Shatter | 0.90 | 0.986 |
| Tire Flat | 0.85 | 0.936 |
| Lamp Broken | 0.66 | 0.889 |
| Dent | 0.75 | 0.618 |
| Scratch | 0.79 | 0.585 |
| Crack | 0.49 | 0.499 |
- Clone the repo:
git clone https://github.com/Elsaraf1/car-damage.git
cd car-damage-
Download the dataset from Kaggle and place it in the root folder.
-
Open the notebook for the task you want:
classification/car_damage_classification.ipynbobject_detection/car_damage_detection.ipynb
-
For best results run on Kaggle with GPU:
- Enable GPU: Settings → Accelerator → GPU T4 x2
- Add the dataset directly from Kaggle
- Multi-label classification (EfficientNet-B3)
- Object detection (YOLOv8m)
- Instance segmentation
- Salient object detection
This project is licensed under the MIT License — see the LICENSE file for details.