Views
No views yet
| Metric | Value |
|---|---|
| Test macro AUROC | 0.9385 |
| Test accuracy | 0.7063 |
| Class | AUROC |
|---|---|
| Melanoma | 0.8829 |
| Actinic keratosis | 0.9744 |
| Benign keratosis | 0.8944 |
| Basal cell carcinoma | 0.9689 |
| Dermatofibroma | 0.9327 |
| Nevi | 0.9391 |
| Vascular | 0.9771 |
1import torch
2from PIL import Image
3from torchvision import transforms
4
5# Load checkpoint
6state = torch.load("best.pt", map_location="cpu", weights_only=False)
7
8# Initialise model (architecture definition required — see GitHub repo)
9model = CrossAttentionFusionModel(meta_dim=35)
10model.load_state_dict(state["model"])
11model.eval()
12
13# Image preprocessing
14transform = transforms.Compose([
15 transforms.Resize((224, 224)),
16 transforms.ToTensor(),
17 transforms.Normalize(mean=[0.485, 0.456, 0.406],
18 std=[0.229, 0.224, 0.225]),
19])
20
21# Metadata: [age_normalised, sex_onehot(3), localization_onehot(31)]
22# See GitHub repo for full encode_metadata() functionTschandl P., Rosendahl C. & Kittler H. The HAM10000 dataset, a large
collection of multi-source dermatoscopic images of common pigmented
skin lesions. Sci. Data 5, 180161 (2018).