MelaNet
Two-stage skin lesion analysis. A U-Net segments the lesion, an EfficientNet-B0 classifies it, and Grad-CAM shows which region drove the prediction.
- Dice, U-Net on ISIC 2018
- 0.85
- ROC-AUC, EfficientNet-B0 on ISIC 2020
- 0.879
- recall, full-image classifier
- 0.80
- Python
- PyTorch
- torchvision
- OpenCV
- Albumentations
- Streamlit

The problem
Skin lesion classifiers are usually reported as one accuracy number. For a screening tool that hides the two things that matter most: whether the model is looking at the lesion at all, and how it behaves when about 98% of the examples are benign.
Pipeline
- Dermoscopic image
- U-Net segmentation
- Lesion crop
- EfficientNet-B0
- Prediction
- Grad-CAM heatmap
How it works
The pipeline runs in two stages. A U-Net trained on the ISIC 2018 segmentation masks finds the lesion. An EfficientNet-B0 trained on ISIC 2020 then classifies either the cropped lesion region or the full image.
Every prediction comes with a Grad-CAM heatmap, so the person reading the result can see which region drove the call.
Training used mixed precision (AMP, fp16) and Albumentations augmentation on a single RTX 3050. The Streamlit app offers region, full-image and side-by-side modes, and a command-line script covers batch inference.


The decision
- I chose
- Keep two classifiers, one on the segmented region and one on the full image, and report both.
- Instead of
- Shipping only the model with the higher score.
- Because
- The full-image model wins on ROC-AUC by a hair (0.8793 against 0.8746), but the region model's Grad-CAM stays concentrated inside the lesion. For a tool someone is meant to trust, where the model looks matters as much as the score.
Results
| Model | Dice | ROC-AUC | Accuracy | Recall |
|---|---|---|---|---|
| U-Net segmentation | 0.85 | – | – | – |
| Region classifier | – | 0.8746 | 0.8212 | 0.7521 |
| Full-image classifier | – | 0.8793 | 0.8015 | 0.8034 |
What broke, and the fix
Precision is low on both classifiers, around 0.07.
That is what a 98 to 2 class split does at a fixed 0.5 threshold. I report it instead of hiding it, and lead with ROC-AUC because it does not depend on the threshold.
What I would do next
- Calibrate the decision threshold to a target sensitivity instead of using 0.5.
- Replace the single train and test split with k-fold cross-validation.
- Validate on an external dataset. This is an educational project, not a diagnostic tool, and it should not be read as one.