Vehicle Health Anomaly Detector
A convolutional autoencoder trained exclusively on healthy vehicle reference images
(front, rear, side, and engine bay views) to detect potential vehicle damage through
reconstruction-based anomaly detection.
How it works
The model learns to reconstruct healthy vehicle images accurately. When given an image
with structural damage (dents, cracks, corrosion, etc.), the reconstruction quality drops,
producing a higher structural dissimilarity (SSIM) score. Images scoring above a calibrated
threshold are flagged as potential anomalies.
Intended use
Reference/negative-sample anomaly detection for vehicle health inspection pipelines, as
part of the Mechaline AI Internship's multi-domain vehicle health detection project. Not
intended for standalone deployment without further validation on larger datasets.
Training data
118 healthy vehicle images (front/rear/side/engine bay views), 640x640 preprocessed,
resized to 224x224 for training. Train/val/test split: 70/20/10.
Evaluation results
Tested on 24 held-out healthy images and 21 externally sourced damaged vehicle images
(used for evaluation only, not training):
| Metric | Value |
|---|
| Precision | 0.56 |
| Recall | 0.67 |
| F1-score | 0.61 |
| Threshold (1-SSIM) | 0.42 |
Limitations
- Small training set (118 images) limits generalization.
- No damaged images existed in the assigned domain dataset; evaluation used an external
sample, which may not match the training data's distribution (lighting, angle, background).
- Precision/recall reflect a genuine trade-off, not a fixed threshold — raising the
threshold reduces false positives but increases missed damage, and vice versa.
Usage
1import torch
2from model import ConvAutoencoder # architecture defined in training notebook
3
4model = ConvAutoencoder()
5model.load_state_dict(torch.load("autoencoder_weights.pth"))
6model.eval()