Update model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- computer-vision
|
| 5 |
+
- image-classification
|
| 6 |
+
- pytorch
|
| 7 |
+
- insurance
|
| 8 |
+
- claims-triage
|
| 9 |
+
- grad-cam
|
| 10 |
+
pipeline_tag: image-classification
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# ClaimSight β Vehicle Damage Triage Classifier (resnet50)
|
| 14 |
+
|
| 15 |
+
Binary image classifier that flags whether a submitted vehicle photo
|
| 16 |
+
shows visible damage (`00-damage`) or an intact vehicle (`01-whole`),
|
| 17 |
+
built as a **claims-triage decision-support tool** β not an autonomous
|
| 18 |
+
adjuster. Every flagged prediction is intended to route to a human
|
| 19 |
+
reviewer.
|
| 20 |
+
|
| 21 |
+
Full project, training code, and API: https://github.com/<your-username>/claimsight
|
| 22 |
+
|
| 23 |
+
## Intended use
|
| 24 |
+
|
| 25 |
+
- First-pass triage of policyholder-submitted claim photos, to route
|
| 26 |
+
obviously-intact vehicles away from a manual review queue.
|
| 27 |
+
- **Not** a final claims-adjudication system. **Not** a repair-cost
|
| 28 |
+
estimator. Every prediction should be reviewed by a human before any
|
| 29 |
+
claim decision is made.
|
| 30 |
+
|
| 31 |
+
## How to use
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
import torch
|
| 35 |
+
from huggingface_hub import hf_hub_download
|
| 36 |
+
|
| 37 |
+
# clone github.com/<your-username>/claimsight for src/model.py, src/preprocessing.py
|
| 38 |
+
from src.model import build_model
|
| 39 |
+
from src.preprocessing import preprocess
|
| 40 |
+
from src.dataset import eval_transform
|
| 41 |
+
|
| 42 |
+
checkpoint_path = hf_hub_download(
|
| 43 |
+
repo_id="<your-username>/claimsight-damage-detection",
|
| 44 |
+
filename="best_resnet50.pt",
|
| 45 |
+
)
|
| 46 |
+
model = build_model("resnet50", pretrained=False)
|
| 47 |
+
model.load_state_dict(torch.load(checkpoint_path, map_location="cpu"))
|
| 48 |
+
model.eval()
|
| 49 |
+
|
| 50 |
+
import cv2
|
| 51 |
+
image_bgr = cv2.imread("claim_photo.jpg")
|
| 52 |
+
image_rgb = preprocess(image_bgr) # same function used in training
|
| 53 |
+
tensor = eval_transform(image=image_rgb)["image"].unsqueeze(0)
|
| 54 |
+
probs = torch.softmax(model(tensor), dim=1).squeeze()
|
| 55 |
+
print({"00-damage": probs[1].item(), "01-whole": probs[0].item()})
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
## Training data
|
| 59 |
+
|
| 60 |
+
Car Damage Detection (Kaggle, `anujms/car-damage-detection`) β 2,300
|
| 61 |
+
images, binary folder labels only (no masks/bounding boxes), split
|
| 62 |
+
1,840 train / 460 validation, balanced within each split.
|
| 63 |
+
|
| 64 |
+
## Architecture & training
|
| 65 |
+
|
| 66 |
+
Transfer learning (resnet50, ImageNet-pretrained) in two phases: frozen
|
| 67 |
+
backbone with a fresh head first, then fine-tuning of the last block at
|
| 68 |
+
a reduced learning rate. `ReduceLROnPlateau` + early stopping on
|
| 69 |
+
validation loss. Full details, augmentation policy and reproducibility
|
| 70 |
+
notes: see the project README.
|
| 71 |
+
|
| 72 |
+
## Evaluation (real, on the held-out validation split)
|
| 73 |
+
|
| 74 |
+
| Metric | Value |
|
| 75 |
+
|---|---|
|
| 76 |
+
| Validation accuracy | 0.9435 |
|
| 77 |
+
| ROC-AUC (damage class) | 0.9858 |
|
| 78 |
+
| Recall β damage class (@ threshold 0.5) | 0.9565 |
|
| 79 |
+
| Precision β damage class (@ threshold 0.5) | 0.9322 |
|
| 80 |
+
| Confusion matrix (TN/FP/FN/TP) | 214/16/10/220 |
|
| 81 |
+
|
| 82 |
+
Recall on the `damage` class is the priority metric: a false negative
|
| 83 |
+
(damaged vehicle classified as intact) can wrongly close a legitimate
|
| 84 |
+
claim, while a false positive only costs one extra human review. A
|
| 85 |
+
recall-priority operating point was chosen by sweeping the decision
|
| 86 |
+
threshold: at threshold **0.25**, damage recall is
|
| 87 |
+
**0.9870** at precision **0.9080**
|
| 88 |
+
(vs. 0.9565 recall / 0.9322 precision at the default 0.5).
|
| 89 |
+
|
| 90 |
+
| Architecture | Val. accuracy | ROC-AUC |
|
| 91 |
+
|---|---|---|
|
| 92 |
+
| **resnet50** (this checkpoint) | 0.9435 | 0.9858 |
|
| 93 |
+
| efficientnet_b0 | 0.8870 | 0.9620 |
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
## Explainability
|
| 97 |
+
|
| 98 |
+
Grad-CAM (`pytorch-grad-cam`) on the last convolutional layer is used
|
| 99 |
+
as a **weak-localization** signal β a coarse heatmap of the region that
|
| 100 |
+
most influenced the decision. It is **not** pixel-level segmentation:
|
| 101 |
+
there is no mask ground truth in this dataset, so there is no IoU/Dice.
|
| 102 |
+
See the project repo's `outputs/gradcam/` for overlays on both correct
|
| 103 |
+
and incorrect predictions, including a documented shortcut-learning
|
| 104 |
+
check.
|
| 105 |
+
|
| 106 |
+
## Limitations
|
| 107 |
+
|
| 108 |
+
- Binary output only β no severity or damaged-part classification.
|
| 109 |
+
- Grad-CAM is weak localization, not segmentation.
|
| 110 |
+
- Modest dataset size (2,300 images, one source) β real domain-shift
|
| 111 |
+
risk against a real insurer's photo distribution (different brands,
|
| 112 |
+
angles, lighting, phone cameras).
|
| 113 |
+
- Not validated as a repair-cost estimator β triage signal only.
|
| 114 |
+
- Requires human review in every deployment path.
|
| 115 |
+
|
| 116 |
+
## Reproducibility
|
| 117 |
+
|
| 118 |
+
Fixed seed (`torch.manual_seed(42)`), deterministic cuDNN settings,
|
| 119 |
+
pinned `requirements.txt`. Metadata for this exact run:
|
| 120 |
+
|
| 121 |
+
```json
|
| 122 |
+
{
|
| 123 |
+
"arch": "resnet50",
|
| 124 |
+
"seed": 42,
|
| 125 |
+
"device": "cuda",
|
| 126 |
+
"phase1_epochs_ran": 8,
|
| 127 |
+
"phase2_epochs_ran": 15,
|
| 128 |
+
"best_val_loss": 0.14994667431582576,
|
| 129 |
+
"checkpoint": "models\\best_resnet50.pt",
|
| 130 |
+
"torch_version": "2.6.0+cu124",
|
| 131 |
+
"trained_at_utc": "2026-08-01T22:51:16Z"
|
| 132 |
+
}
|
| 133 |
+
```
|