File size: 3,284 Bytes
33f6750
 
 
 
 
 
6aae550
33f6750
 
6aae550
33f6750
313d8dd
705e08c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dcd06e9
705e08c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313d8dd
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
title: DeepDerma
emoji: 🧴
colorFrom: blue
colorTo: pink
sdk: gradio
sdk_version: 5.38.0
app_file: app.py
pinned: true
short_description: Detect skin cancer early with powerful AI
---

# 🩺 DeepDerma: Skin Lesion Classification App

Welcome to **DeepDerma**, a simple yet powerful AI tool that helps identify **7 common skin lesions (abnormal injury or disease)** from clinical dermatoscopic images. Upload a skin image, and DeepDerma will predict the most likely diagnosis β€” assisting in early detection and educational awareness.



---

## πŸ” How It Works

Just upload a skin lesion image, and our AI model will:
- Preprocess the image
- Classify it into one of 7 dermatological categories
- Return the top predicted class with confidence scores

The model is built using **EfficientNet-B2** and trained on the **DermMNIST** dataset from MedMNIST.

---

## πŸ§ͺ Performance Summary

| Metric       | Value     |
|--------------|-----------|
| Test Accuracy | 73.3%     |
| AUC Score     | 0.91   |
| Top Class F1  | 0.86 (Nevus - NV) |
| Minority Class F1 | 0.53 |

## Competitiveness

> our results outperforms benchmarks such as ResNet-18, ResNet-50 in terms of accuracy and is competitive in AUC scores

Despite class imbalance, the model performs well on high-priority categories like melanoma (MEL) and nevi (NV) thanks to AUC-based training.

---

## 🧠 Model Details

- **Architecture**: [EfficientNet-B2](https://arxiv.org/abs/1905.11946)
- **Fine-tuned** on: DermMNIST (medmnist v2)
- **Input size**: 224 Γ— 224
- **Optimizer**: Adam, LR = 1e-4
- **Scheduler**: ReduceLROnPlateau
- **Augmentations**: Random flip, rotation, color jitter
- **Class balancing**: Weighted loss + WeightedRandomSampler
- **Metric used**: AUC (Area Under ROC Curve) for better performance on imbalanced classes

---

## πŸ“Š Dataset: DermMNIST

- **Source**: [MedMNIST v2](https://medmnist.com/)
- **Images**: 10,015 dermatoscopic RGB images (28Γ—28, resized to 224Γ—224)
- **Classes**: 7 types of skin lesions
- **Split**:
  - Train: 7,007 images
  - Val: 1,003 images
  - Test: 2,005 images

---

## 🧬 Target Classes (With Description)

| Label | Name (Short) | Description |
|-------|--------------|-------------|
| 0 | **AKIEC** | Actinic keratoses / Intraepithelial carcinoma – pre-cancerous skin lesions |
| 1 | **BCC** | Basal Cell Carcinoma – common and locally invasive skin cancer |
| 2 | **BKL** | Benign Keratosis-like lesions – non-cancerous growths (seborrheic, solar, etc.) |
| 3 | **DF** | Dermatofibroma – benign skin nodules caused by overgrowth of fibrous tissue |
| 4 | **MEL** | Melanoma – the most dangerous type of skin cancer; early detection critical |
| 5 | **NV** | Melanocytic Nevi – common moles, typically benign |
| 6 | **VASC** | Vascular Lesions – angiomas, hemorrhages, and similar blood vessel-related growths |

---

## πŸš€ How to Run

This Space runs using **Gradio**. No setup needed β€” just:

1. Click the upload button
2. Select or drag an image
3. View the predicted class and probabilities

---

## 🧾 Files Included

- `app.py` β€” Gradio interface
- `model.py` β€” Model architecture and prediction pipeline
- `requirements.txt` β€” Dependencies
- `fine_tuned_effnetb2_dermamnist.pth` β€” Trained model weights

---