/ Модель

Характеристики

Лицензия
CC BY 4.0
Архитектура
skintone · dense
Библиотека
pytorch
Опубликована
30 окт 2026

monk-skin-tone-prediction-swin-t

Классификация изображенийИзображение → label3 профессии
44скачиваний за 30 дней1лайквеса обновлены30 окт 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Классификатор Swin-T оценивает оттенок кожи по шкале Monk на дерматологических фотографиях и помогает проверять баланс наборов данных.

Модель haic-hmgu/monk-skin-tone-prediction-swin-t оценивает оттенок кожи на дерматологических фотографиях по шкале Monk от 1 до 10 и выдаёт оценку читаемости изображения для такой оценки. Она разработана в рамках проекта по созданию подписей к дерматологическим изображениям и предназначена для анализа наборов данных, проверки их баланса по оттенкам кожи и стратификации результатов дерматологических моделей. Это классификатор изображений на базе Swin-T, предварительно обученной на ImageNet-1k; модель содержит 27,5 млн параметров и принимает RGB-изображение после масштабирования и центрального кадрирования до 224×224 пикселей.

Обучение включает 42 903 изображения с автоматически назначенными метками и дополнительную настройку на 240 фотографиях с подтверждёнными дерматологом оттенками; ещё 120 подтверждённых изображений использованы для оценки. На этом тестовом наборе MAE составила 0,583, а точность попадания в пределах одного тона — 0,917. Разработчики предупреждают, что модель не предназначена для клинического применения, определения расы, этнической принадлежности или анализа обычных портретов. Тоны 9 и 10 не оценивались на экспертном тестовом наборе, а оценка читаемости в значительной мере работает как детектор принадлежности к домену дерматологических изображений. Лицензия — CC BY 4.0.

Сценарии применения

  • стратификация дерматологических изображений по оттенку кожи
  • аудит набора данных на дисбаланс оттенков кожи
  • оценка оттенка кожи для анализа качества дерматологических моделей
  • отбор дерматологических фотографий, пригодных для оценки оттенка кожи

Ограничения

Модель не предназначена для клинических решений, определения расы или применения к обычным портретам; оценка читаемости фактически служит детектором домена дерматологических изображений. Тоны 9 и 10 не проверялись на экспертном тестовом наборе.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

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.

BackboneSwin-T, ImageNet-1k pretrained (torchvision)
Parameters27.5M
InputRGB, shorter side resized to 256, centre-cropped to 224×224
OutputsMonk tone in [1, 10] (continuous), and P(tone is readable)
Training34,015 LLM-labelled images, then 260 images (240 dermatologist-verified plus 20 unreadable)
Test MAE0.583 (95% CI 0.475–0.700) on 120 dermatologist-verified images
Within one tone0.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:

sourcen
DermNet (Kaggle release)19,124
Fitzpatrick17k17,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.

metricvalue
MAE0.583 (95% CI 0.475–0.700)
exact accuracy0.500
within one tone0.917
quadratic weighted kappa0.928
Spearman correlation0.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

tonenaccuracyMAEmean prediction
1150.6670.471.47
2150.5330.532.27
3150.2000.803.13
4150.5330.603.93
5150.4670.674.47
6150.4000.736.07
7150.6000.406.87
8150.6000.477.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:

groupnflagged unreadableAUROC
Not dermatological (Unsplash)1000.9900.997
Dermatology, labelled unreadable640.6720.946
Dermatology, readable4,0940.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:

backboneparamsregressionCORNclassificationCORAL
EfficientNet-B04.0M0.840±0.0190.808±0.0190.917±0.0781.040±0.052
MobileNetV3-L4.2M0.795±0.0390.798±0.0400.917±0.0160.912±0.047
DenseNet-1217.0M0.800±0.0480.862±0.0540.912±0.0270.935±0.022
EfficientNet-B310.7M0.800±0.0130.800±0.0280.915±0.0400.887±0.040
EfficientNetV2-S20.2M0.668±0.0120.683±0.0520.692±0.0360.830±0.034
ResNet-5023.5M0.830±0.0720.760±0.0250.878±0.0360.992±0.013
Swin-T27.5M0.557±0.0320.613±0.0360.675±0.0330.702±0.012
ConvNeXt-T27.8M0.607±0.0290.653±0.0360.768±0.0480.722±0.016
RegNetY-8GF37.4M0.777±0.0250.680±0.0570.845±0.0400.803±0.076
ResNet-10142.5M0.793±0.0600.717±0.0630.842±0.0410.872±0.049
ConvNeXt-S49.5M0.608±0.0200.638±0.0130.700±0.0240.750±0.033
ConvNeXt-B87.6M0.607±0.0340.673±0.0250.690±0.0400.720±0.037
pooled0.723±0.1070.724±0.0850.812±0.1040.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

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · pytorch · image-classification

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
SkinToneModel
Ревизия весов
9ad82a7

0 моделей