File size: 1,389 Bytes
8becd34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
license: mit
tags:
- image-classification
- computer-vision
- defect-detection
- automotive
- pytorch
- timm
- efficientnet
language:
- ru
pipeline_tag: image-classification
---

# Paint Defect Detector

A binary image classifier that detects **paint defects** on car body panels using transfer learning with EfficientNetV2-S backbone (via 	imm).

## Model Architecture

- **Backbone**: EfficientNetV2-S (pretrained, from 	imm)
- **Head**: Dropout → Linear(feat_dim, 256) → GELU → Dropout → Linear(256, 2)
- **Task**: Binary classification — clean vs defect

## Training

- **Optimizer**: AdamW with cosine annealing LR scheduler
- **Loss**: CrossEntropyLoss with label smoothing
- **Augmentations**: Albumentations pipeline
- **Metrics**: AUC-ROC, F1, Accuracy

## Inference

The project includes a FastAPI REST API (src/api.py) for serving predictions, and a Grad-CAM visualisation layer for model explainability.

## Project Structure

`
src/
  config.py        # Hyperparameters and paths
  dataset.py       # Dataset and data loaders
  model.py         # DefectClassifier model
  train.py         # Training loop
  infer.py         # Inference utilities
  api.py           # FastAPI inference server
  prepare_data.py  # Data preparation script
requirements.txt
`

## Requirements

See 
equirements.txt. Key dependencies: 	orch, 	imm, lbumentations, astapi, grad-cam.