The project integrates a ResNet50 Convolutional Neural Network for multi-label damage detection with an XGBoost regression model for used-car price prediction, producing a final damage-adjusted vehicle valuation.
This project was developed as part of a university Artificial Intelligence project and demonstrates the integration of Deep Learning and Machine Learning into a complete prediction pipeline.
Rather than solving damage classification or vehicle valuation independently, the system combines both tasks to estimate the market value of damaged vehicles using a single image together with vehicle specifications.
Clone the repository:
git clone https://github.com/AliwiWalid/Car-Damage-Detection-Price-Estimation.git
cd Car-Damage-Detection-Price-EstimationInstall the required dependencies:
pip install -r requirements.txtRun the complete prediction pipeline:
python predict_car_final.py- Multi-label vehicle damage detection
- Detection of multiple damage types simultaneously
- Clean used-car price prediction
- Final damaged-car price estimation
- Transfer Learning using ResNet50
- XGBoost regression for vehicle valuation
- Command-line interface
- Automatic model evaluation
- Performance visualization
- Portable project using relative file paths
Vehicle Image
│
▼
ResNet50 Damage Detection
│
▼
Damage Probabilities (6 Classes)
│
▼
Damage Reduction Calculation
│
│
Vehicle Specifications ─────────────► XGBoost Price Prediction
│
▼
Estimated Clean Vehicle Price
│
▼
Final Damaged Vehicle Price
The damage detection model performs multi-label image classification, meaning that a single image may contain several damage types simultaneously.
The six supported damage categories are:
- Dent
- Scratch
- Crack
- Glass Shatter
- Broken Lamp
- Flat Tire
The damage detection model was trained using the CarDD (Car Damage Detection) dataset, containing annotated vehicle images with multiple damage labels.
Dataset split:
- Training
- Validation
- Test
Each image may contain multiple damage classes.
Dataset: CarDD Dataset
The price prediction model was trained using a merged dataset containing approximately 99,000 used vehicles from multiple manufacturers.
- Audi
- BMW
- Ford
- Hyundai
- Mercedes
- Skoda
- Toyota
- Vauxhall
- Volkswagen
- Brand
- Model
- Transmission
- Fuel Type
- Year
- Mileage
- Tax
- MPG
- Engine Size
Target variable:
- Vehicle Price (£)
Dataset: Used Car Dataset (Kaggle)
Note: The original datasets are not included in this repository due to their size and licensing restrictions. Download them separately before training the models.
- ResNet50 (Transfer Learning)
- TensorFlow
- Keras
- Binary Crossentropy Loss
- Adam Optimizer
- Sigmoid Output Layer
- Input Image Size: 224 × 224
Six independent probabilities corresponding to the six damage classes.
- XGBoost Regressor
- XGBoost
- Scikit-Learn
- Mean Absolute Error (MAE)
- Root Mean Squared Error (RMSE)
- R² Score
The final damaged vehicle price is obtained by combining the clean vehicle price predicted by the XGBoost model with the damage probabilities predicted by the ResNet50 model.
The final price is computed as
Final Price = Clean Price × (1 − Damage Reduction)
where
Damage Reduction = Σ (Damage Probability × Damage Weight)
Each detected damage contributes according to a predefined weight. To prevent unrealistic estimates, the total damage reduction is capped at 60% of the predicted clean vehicle price.
87.3%
| Damage | F1 Score |
|---|---|
| Dent | 0.78 |
| Scratch | 0.79 |
| Crack | 0.40 |
| Glass Shatter | 0.92 |
| Lamp Broken | 0.71 |
| Flat Tire | 0.84 |
| Metric | Value |
|---|---|
| MAE | £1,319 |
| RMSE | £1,990 |
| R² Score | 0.955 |
The XGBoost regression model explains approximately 95.5% of the variance in used vehicle prices.
Brand: BMW
Model: 330i
Year: 2023
Transmission: Automatic
Fuel: Petrol
Mileage: 20,000
Scratch
£27,911.83
11.74%
£24,636.04
Car-Damage-Detection-Price-Estimation/
│
├── train_cardd_resnet50.py
├── train_car_price_xgboost.py
├── predict_car_final.py
│
├── results_resnet50/
│ ├── best_cardd_resnet50.keras
│ ├── accuracy_curve.png
│ ├── loss_curve.png
│ ├── classification_report.csv
│ ├── confusion_matrix_multilabel_6x6.png
│ └── ...
│
├── results_xgboost_price/
│ ├── car_price_xgboost_model.pkl
│ ├── feature_importance_top20.png
│ ├── residual_plot.png
│ ├── actual_vs_predicted_price.png
│ └── ...
│
├── requirements.txt
├── LICENSE
└── README.md
Note: Trained model files and evaluation results are generated automatically after running the training scripts.
python train_cardd_resnet50.pypython train_car_price_xgboost.pypython predict_car_final.pyThe application requests:
- Vehicle image
- Brand
- Model
- Year
- Mileage
- Transmission
- Fuel Type
- Engine Size
- MPG
- Tax
The application outputs:
- Damage probabilities
- Detected damage classes
- Estimated clean vehicle price
- Damage reduction percentage
- Final estimated damaged vehicle price
The models were developed and tested using:
- Python 3.11
- TensorFlow / Keras
- XGBoost
- Scikit-Learn
- NumPy
- Pandas
- Matplotlib
Training was performed on an NVIDIA GPU using CUDA acceleration.
- Python
- TensorFlow
- Keras
- XGBoost
- Scikit-Learn
- NumPy
- Pandas
- Matplotlib
- Vehicle make and model recognition directly from images
- Automatic damage localization using object detection
- Damage severity estimation
- Explainable AI using Grad-CAM
- Web application using Flask or FastAPI
- Mobile application integration
- Real-time inference
- Cloud deployment
This project is licensed under the MIT License. See the LICENSE file for more information.
Walid
Faculty of Engineering in Foreign Languages (FILS)
National University of Science and Technology POLITEHNICA Bucharest
- Artificial Intelligence
- Computer Vision
- Deep Learning
- Machine Learning