Bhargav Adepu

NO. 02MACHINE LEARNING · SHIPPEDDECEMBER 2025 – FEBRUARY 2026

SkinGuard AI

A three-backbone ensemble for dermoscopic lesion classification

Melanoma is the case where a false negative is measured in years of life. That asymmetry shapes every decision here — the loss function, the augmentation, the ensemble, and the insistence that the model show you where it looked.

Dataset25,331ISIC 2019 dermoscopic images
Classes83 malignant, 1 pre-malignant
Ensemble589Mparams across 3 backbones
Training budget7 hrsingle NVIDIA H100

Python · PyTorch · EVA-02 · ConvNeXt-V2 · Swin-V2 · Grad-CAM · ONNX · Hugging Face

SkinGuard AI classifies dermoscopic images into the eight ISIC 2019 lesion categories: melanoma, basal cell carcinoma and squamous cell carcinoma (malignant), actinic keratosis (pre-malignant), and melanocytic nevus, benign keratosis, dermatofibroma and vascular lesion (benign).

Why three models

The ensemble pairs EVA-02-Large, ConvNeXt-V2-Large and Swin-V2-Base — a pure transformer, a modernised convolutional network, and a shifted-window hybrid. They are not chosen for size but for architectural disagreement: an ensemble only earns its cost when its members make different mistakes, and three families with different inductive biases are more likely to fail independently than three checkpoints of the same design.


EVA-02-Large · transformer304.00
ConvNeXt-V2-Large · modern convnet198.00
Swin-V2-Base · shifted-window attention87.00
0320M

FIG. 1Three backbones chosen for disagreement rather than size: a transformer, a modernised convnet, and a windowed-attention hybrid. Ensembles work when members fail differently.

Fighting the class imbalance

ISIC 2019 is severely imbalanced — melanocytic nevi outnumber melanoma by roughly fifteen to one. Left alone, a model maximises accuracy by learning to say “benign”, which is precisely the failure mode that matters. Training therefore uses focal loss plus inverse-frequency class weighting, with MixUp and CutMix for batch-level regularisation, label smoothing at 0.1 for calibration, a five-epoch cosine warmup, gradient clipping at norm 1.0, and early stopping on validation AUROC rather than on accuracy.

Fitting it into seven hours

The whole pipeline — download, training, evaluation, test-time augmentation, Grad-CAM and ONNX export — is budgeted for a single seven-hour H100 session. Getting there needed BF16 autocast, torch.compile in reduce-overhead mode, TF32 matmuls, an effective batch of 256 via 128 × 2 accumulation, and a dataloader tuned with sixteen workers, pinned memory and prefetching. Test-time augmentation adds a further one to two points at inference cost only.

Every prediction ships with a Grad-CAM overlay, and the trained ensemble exports to ONNX for deployment. The repository reports above 95% accuracy on the held-out split; I would want an independent evaluation set before repeating that anywhere it mattered.