Monk Skin Tone estimation for dermatological photographs (Swin-T)
Predicts a Monk Skin Tone Scale value from 1 (lightest) to 10 (darkest) for a dermatological photograph, together with a probability that the skin tone can be read from the image at all.
The model exists to make skin-tone-stratified evaluation of dermatology models possible without sending images to an external API.
| Backbone | Swin-T, ImageNet-1k pretrained (torchvision) |
| Parameters | 27.5M |
| Input | RGB, shorter side resized to 256, centre-cropped to 224×224 |
| Outputs | Monk tone in [1, 10] (continuous), and P(tone is readable) |
| Training | 34,015 LLM-labelled images, then 260 images (240 dermatologist-verified plus 20 unreadable) |
| Test MAE | 0.583 (95% CI 0.475–0.700) on 120 dermatologist-verified images |
| Within one tone | 0.917 |
Related work
This model is a by-product of a dermatology image-captioning project. The
captioning model it supports is
haic-hmgu/dermatology-captioning-12b,
a Gemma 3 12B model fine-tuned to produce structured dermatological captions.
The skin-tone labels this model learns from are the ones that project used to
stratify its own evaluation by tone, and the 360 dermatologist-verified images
here are the same images that project's clinical collaborator annotated.
Intended use
- Stratifying a dermatology dataset or evaluation set by skin tone, so that model performance can be reported per tone.
- Auditing an existing dataset for skin-tone imbalance.
- Flagging photographs whose skin tone cannot be judged, so they can be excluded from such an analysis.
Unintended use
- Any clinical use. This is not a medical device. It does not provide a diagnosis.
- Inferring race, ethnicity or ancestry. The Monk scale describes how skin appears in a photograph under its lighting. It is not a proxy for identity, and using it as one is both wrong and harmful.
- Non-dermatological photographs. Training images are clinical dermatology atlas photographs. General portraits are out of domain, and the readability output will usually reject them (see External spot check below).
Usage
from transformers import AutoModel
model = AutoModel.from_pretrained("haic-hmgu/monk-skin-tone-prediction-swin-t", trust_remote_code=True)
print(model.predict_image("photo.jpg"))
# {'file_name': 'photo.jpg', 'monk_tone': 6, 'monk_tone_continuous': 5.87,
# 'readable_probability': 0.9731, 'tone_readable': True}
# Labelling a dataset, which is what this model is for. Batched.
rows = model.predict_images(sorted(Path("photos").glob("*.jpg")))
Nothing has to be downloaded by hand: trust_remote_code=True lets
transformers fetch the modelling code alongside the weights. The
dependencies are torch, torchvision, transformers and pillow.
Always read tone_readable. A tone is returned for every image, including
images with no skin in them. The flag is the model saying whether to believe it.
Training data
42,903 images assembled for the captioning project:
| source | n |
|---|---|
| DermNet (Kaggle release) | 19,124 |
| Fitzpatrick17k | 17,051 |
| DermNet (scraped) | 5,728 |
| Unsplash photographs (not dermatological) | 1,000 |
Every dermatological image carries a Monk tone assigned by GPT-4.1, prompted with the ten reference colours of the scale as HSL values, plus a flag for whether the tone was judged readable. The Unsplash images carry no tone and serve as out-of-domain negatives for the readability output.
Splits are stratified by tone and domain. The corpus contains 1,241 groups of byte-identical images, and each group is assigned to a single split so no image appears on both sides of a boundary. The 360 images with expert verification are removed from the LLM-labelled pool entirely.
The pretraining targets are model-generated. What makes the released model usable is the second stage: it is fine-tuned on 240 images whose tone a dermatologist confirmed, and evaluated on 120 more.
The tone distribution is heavily skewed towards light skin, which the source atlases inherit:
tone 1 2 3 4 5 6 7 8 9 10
n 10251 14571 2665 3500 4339 2556 2212 968 177 17
Evaluation
The test set is 120 images whose assigned tone a dermatologist confirmed, balanced at 15 per tone over tones 1–8, never trained on at either stage.
| metric | value |
|---|---|
| MAE | 0.583 (95% CI 0.475–0.700) |
| exact accuracy | 0.500 |
| within one tone | 0.917 |
| quadratic weighted kappa | 0.928 |
| Spearman correlation | 0.929 |
| mean of (prediction − reference) | +0.017 |
On a held-out split of 4,258 LLM-labelled images: MAE 0.592, accuracy 0.517, kappa 0.893.
For reference, a no-learning baseline that takes the median lightness of the skin-like pixels and maps it to the nearest Monk reference colour reaches MAE 2.050, accuracy 0.208 and kappa 0.371 on the same 120 images.
Per tone
| tone | n | accuracy | MAE | mean prediction |
|---|---|---|---|---|
| 1 | 15 | 0.667 | 0.47 | 1.47 |
| 2 | 15 | 0.533 | 0.53 | 2.27 |
| 3 | 15 | 0.200 | 0.80 | 3.13 |
| 4 | 15 | 0.533 | 0.60 | 3.93 |
| 5 | 15 | 0.467 | 0.67 | 4.47 |
| 6 | 15 | 0.400 | 0.73 | 6.07 |
| 7 | 15 | 0.600 | 0.40 | 6.87 |
| 8 | 15 | 0.600 | 0.47 | 7.93 |
The mean of (prediction − reference) is +0.017 over the whole set.
Accuracy is worst at tone 3, where adjacent reference colours are closest together. Tones 9 and 10 are not evaluated at all: the expert set covers 1–8 only, and the whole corpus holds 177 and 17 readable images at those tones.
Readability output
Measured on 4,258 held-out images:
| group | n | flagged unreadable | AUROC |
|---|---|---|---|
| Not dermatological (Unsplash) | 100 | 0.990 | 0.997 |
| Dermatology, labelled unreadable | 64 | 0.672 | 0.946 |
| Dermatology, readable | 4,094 | 0.042 (false alarms) | — |
Every expert-verified image is readable, because the dermatologist selected them by confirming their tone. Fine-tuning on that set alone spends its epochs teaching the readability head that images are always readable, and detection of poorly-lit photographs collapses to 0.359. 20 unreadable images are therefore mixed back into the fine-tuning set from the pretraining pool, in the same in-domain and out-of-domain proportion that pool has.
External spot check
148 openly licensed images from Wikimedia Commons, from none of the training sources, were run through the model as a qualitative check. Sorted by predicted tone, the ordering is sound: palms and light forearms at 1.0–1.8, lighter faces around 3.3, mid-tone hands and torsos at 4.5–5.7, darker faces through 6.6, 7.8 and 9.2.
The readability output rejected 73% of them, which is largely correct behaviour: Wikimedia portraits include many monochrome photographs, paintings and anatomical plates, and 28 of the 31 near-greyscale images were rejected. But it also rejected ordinary colour photographs of people, because they are not clinical dermatology images. In practice this output behaves as an in-domain detector rather than a "can I see skin" detector. Two non-skin controls were wrongly accepted, a 1916 photograph of a car and a circuit board.
Training configuration
Swin-T with ImageNet-1k weights:
Stage 1, on 34,015 LLM-labelled images. AdamW, learning rate 3e-4 for the head and 3e-5 for the backbone, weight decay 0.05, cosine schedule with half an epoch of warmup, gradient clipping at 1.0, batch size 128, bfloat16 autocast, 12 epochs. Huber loss on the tone, binary cross-entropy on readability, summed with equal weight. Tone imbalance handled by a weighted sampler at temperature 0.5. The checkpoint is chosen by MAE on a held-out validation split of 4,250 images, and the seed is chosen the same way, out of five.
Stage 2, on 260 images: the 240 dermatologist-verified ones plus 20 unreadable images drawn from the pretraining pool, for the reason given under Readability output. Learning rate 3e-5, 30 epochs, otherwise identical. This stage has no held-out selection split of its own, so its epoch is chosen on its own training images.
Colour augmentation is deliberately off: jittering hue, saturation, brightness or contrast perturbs exactly the quantity being predicted. Only horizontal flips, random resized crops (scale 0.6–1.0) and ±15° rotations are used.
The five fine-tuned seeds score 0.567, 0.633, 0.533, 0.583 and 0.592 on the test set, mean 0.582 ± 0.037. The released model is the one whose stage-1 parent had the best validation MAE, which is seed 3 at 0.583.
Trained on one NVIDIA A100 on the JUWELS Booster system at Jülich Supercomputing Centre.
Why Swin-T
12 backbones × 4 output formulations × 5 seeds, 240 training runs, all on the same 120 test images. Mean MAE ± sd over 5 seeds:
| backbone | params | regression | CORN | classification | CORAL |
|---|---|---|---|---|---|
| EfficientNet-B0 | 4.0M | 0.840±0.019 | 0.808±0.019 | 0.917±0.078 | 1.040±0.052 |
| MobileNetV3-L | 4.2M | 0.795±0.039 | 0.798±0.040 | 0.917±0.016 | 0.912±0.047 |
| DenseNet-121 | 7.0M | 0.800±0.048 | 0.862±0.054 | 0.912±0.027 | 0.935±0.022 |
| EfficientNet-B3 | 10.7M | 0.800±0.013 | 0.800±0.028 | 0.915±0.040 | 0.887±0.040 |
| EfficientNetV2-S | 20.2M | 0.668±0.012 | 0.683±0.052 | 0.692±0.036 | 0.830±0.034 |
| ResNet-50 | 23.5M | 0.830±0.072 | 0.760±0.025 | 0.878±0.036 | 0.992±0.013 |
| Swin-T | 27.5M | 0.557±0.032 | 0.613±0.036 | 0.675±0.033 | 0.702±0.012 |
| ConvNeXt-T | 27.8M | 0.607±0.029 | 0.653±0.036 | 0.768±0.048 | 0.722±0.016 |
| RegNetY-8GF | 37.4M | 0.777±0.025 | 0.680±0.057 | 0.845±0.040 | 0.803±0.076 |
| ResNet-101 | 42.5M | 0.793±0.060 | 0.717±0.063 | 0.842±0.041 | 0.872±0.049 |
| ConvNeXt-S | 49.5M | 0.608±0.020 | 0.638±0.013 | 0.700±0.024 | 0.750±0.033 |
| ConvNeXt-B | 87.6M | 0.607±0.034 | 0.673±0.025 | 0.690±0.040 | 0.720±0.037 |
| pooled | 0.723±0.107 | 0.724±0.085 | 0.812±0.104 | 0.847±0.114 |
Three results informed the choice:
Swin-T wins every output formulation, and it is the seventh-smallest of the twelve. It was included specifically to match ConvNeXt-Tiny in size, so the comparison between them holds capacity fixed and isolates the architecture.
Capacity saturates immediately. ConvNeXt goes 0.607 to 0.608 to 0.607 from 28M to 88M parameters. Nothing above about 25M increased performance, so the larger models were not worth considering.
Ordinal regression does not help in this setting. Four output formulations were compared:
- regression — one scalar in [1, 10] plus an independent readability logit.
- CORAL (arXiv:1901.07884) — 9 cumulative logits sharing one projection, guaranteeing that P(tone > k) never rises with k.
- CORN (arXiv:2111.08851) — the same guarantee from conditional probabilities chained by the product rule, with an unconstrained output layer.
- classification — an 11-way softmax over the ten tones plus an unreadable class, discarding the ordering entirely.
CORAL scored last. Its shared projection reduces the head to a single scalar, and CORN, which promises the identical rank-consistency guarantee without that constraint, beat it on 60 of 60 paired runs by 0.123 MAE. CORN and regression then tie (paired difference +0.000, t = 0.04). Regression was released because it is simpler and marginally ahead on this backbone.
Licence
The author's contribution — the trained weights, the modelling code and this card — is released under CC BY 4.0. Use it freely, including commercially, with attribution.
Two upstream components are not the author's to license, and anyone redistributing or building on this model should confirm them for their own use case:
- ImageNet-1k initialisation. The Swin-T starting weights come from torchvision, whose documentation states that its pretrained models "may have their own licenses or terms and conditions derived from the dataset used for training" and that it is the user's responsibility to determine whether they have permission. torchvision names no licence for its ImageNet-1k weights. ImageNet's own terms are restricted to non-commercial research.
- Training images and labels. Images come from Fitzpatrick17k, DermNet and Unsplash under their respective terms; no image is redistributed with this model. Labels were generated with OpenAI GPT-4.1 under OpenAI's terms of use at the time of generation.
Contact
Karol Szustakowski Helmholtz AI Consultants for Health, Helmholtz Munich