Views
No views yet
⚠️ For early awareness only — not a medical diagnosis. This is a research prototype and cannot replace examination by a qualified clinician.
| Proposal section | Implementation |
|---|---|
| 6.1 Dataset | ImageFolder layout under sample_data/ for SCIN / Fitzpatrick17k / custom images |
| 6.2 Preprocessing | Resize, normalise, augmentation (rotation, flip, scale, jitter) — train.py |
| 6.3 Model development | MobileNetV2 / ResNet18 transfer learning + Softmax head — model.py, train.py |
| 6.4 Explainability | Grad-CAM from scratch (forward/backward hooks) — model.py |
| 6.5 System implementation | Web app: upload → predict → confidence + Grad-CAM — app.py, frontend/ |
| 4.2 Deliverables | Trained model, web app, confidence scores, evaluation report (evaluate.py) |
Smartphone photo
│
▼
[ Frontend (frontend/index.html) ] drag-drop upload, results UI
│ POST /api/predict (multipart)
▼
[ Backend (FastAPI, backend/app.py) ]
│
├─ Preprocess (resize 224², normalise) inference.py
├─ CNN forward pass → Softmax confidences model.py (MobileNetV2)
└─ Grad-CAM backward pass → heatmap overlay model.py (GradCAM)
│
▼
JSON: prediction, per-class confidence, Grad-CAM imageBackend note: the proposal lists Spring Boot. Because the model runs in Python (PyTorch), the API is hosted in the same Python process with FastAPI to avoid a second runtime and an extra network hop. A Spring Boot layer can be added later simply by proxying to these endpoints.
case_id, so no image leakage).| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| insect_bite | 0.165 | 0.360 | 0.226 | 100 |
| rash | 0.910 | 0.793 | 0.847 | 1468 |
| normal_skin | 0.062 | 0.120 | 0.081 | 75 |
| Accuracy | 0.736 | 1643 | ||
| Macro avg | 0.379 | 0.424 | 0.385 | 1643 |
| Weighted avg | 0.826 | 0.736 | 0.775 | 1643 |

rash, so accuracy rewards a rash-leaning model. The fair metric
for this imbalanced problem is macro-F1 = 0.385.rash is detected well (F1 0.85) — it has thousands of training images.insect_bite (F1 0.23) and normal_skin (F1 0.08) underperform because
SCIN provides only a few hundred labelled images for each, and they overlap
visually with the highly heterogeneous rash class.insect_bite / normal_skin images, which are
scarce in public datasets.skin-condition-detector/
├── README.md
├── requirements.txt
├── backend/
│ ├── config.py # classes, paths, image settings (edit classes here)
│ ├── model.py # transfer-learning CNN + Grad-CAM
│ ├── inference.py # preprocess → predict → Grad-CAM overlay
│ ├── train.py # train/fine-tune on your dataset
│ ├── evaluate.py # accuracy, confusion matrix, per-class metrics
│ ├── demo.py # CLI smoke test (no server needed)
│ └── app.py # FastAPI server + API
├── frontend/
│ └── index.html # single-page web UI
├── models/ # trained weights + evaluation report land here
└── sample_data/ # your train/ and val/ image folders1cd skin-condition-detector
2python -m venv venv && source venv/bin/activate # optional
3pip install -r requirements.txt1cd backend
2uvicorn app:app --reload --port 8000sample_data/train/ and sample_data/val/ (see
sample_data/README.md), then:1cd backend
2python train.py --data ../sample_data --epochs 15
3# faster option when you have limited data:
4python train.py --data ../sample_data --epochs 10 --freeze-backbonemodels/skin_model.pt. Restart the server and it
automatically serves the trained model.1cd backend
2python evaluate.py --data ../sample_data --split val
3# writes models/evaluation_report.txt (accuracy, confusion matrix, P/R/F1)1cd backend
2python demo.py path/to/photo.jpg # or no argument for a synthetic test imagebackend/config.py:CLASS_NAMES — the conditions to classify (must match your data folders).BACKBONE — "mobilenet_v2" (light) or "resnet18" (heavier).IMAGE_SIZE, normalisation, low-confidence threshold.