Access to the oral lesion classification weights

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

These weights are released for non-commercial research under CC BY-NC 4.0. They are not a medical device and must not be used to diagnose patients or to make treatment decisions.

Log in or Sign Up to review the conditions and access this model content.

Multi-dataset oral lesion classification models

Image classifiers for intraoral photographs that output four classes: healthy mucosa, benign lesion, oral potentially malignant disorder (OPMD) and cancer. They accompany the manuscript Multi-dataset Deep Learning for Multiclass Classification of Oral Lesions (under review). Training and evaluation code is at https://github.com/FerSaiyan/oral-lesion-multisource-classification.

What is released

There are four architectures (EfficientNet-B3, EfficientNet-B7, ViT-Base and ViT-Large) and four training conditions:

Condition Training and validation sources Evaluated on
pooled Internal, Zenodo, Kaggle (normal folder), Mendeley Pooled test set (1,209 images)
no_kaggle All sources except Kaggle Kaggle holdout (1,235 images) and a remaining-source test set
no_zenodo All sources except Zenodo Zenodo holdout (3,000 images) and a remaining-source test set
no_mendeley All sources except Mendeley Mendeley holdout (323 images) and a remaining-source test set

The study trained five seeds (42 to 46) for every architecture and condition, each with its own 50-trial Optuna search and a 50-epoch retrain. This repository holds one checkpoint per architecture and condition: the seed whose retrain reached the highest validation macro-F1. The choice uses validation data only. seed_selection.csv lists all 80 runs with their validation macro-F1 and marks the released ones. The paper reports means and standard deviations across all five seeds, so a single released checkpoint will not reproduce those means exactly.

Each folder <architecture>/<condition>/ contains:

  • model.safetensors: the weights (a PyTorch state_dict).
  • config.json: architecture, input size, preprocessing, class order, seed, selected epoch, Optuna hyperparameters, the metrics of this checkpoint, and SHA-256 hashes of the original checkpoint and the safetensors file.

Classes and labels

Output order is ["benign_lesion", "cancer", "healthy", "opmd"].

The four public and internal sources were mapped to these classes. Internal labels come from dentist-written diagnoses. The internal cancer class includes biopsy-confirmed cases, recorded carcinoma diagnoses without a documented biopsy result, and recorded suspicions of carcinoma. Public labels are taken from each dataset release. The Kaggle normal folder was mapped to healthy without independent clinical review; Kaggle cancer images were used only as a holdout. The manuscript's Supplementary Information describes the mapping in full.

Usage

The weights load into the model classes in the GitHub repository (src/models.py).

import json
import torch
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
from src.models import enetv2, ViTFineTuner  # from the GitHub repository

repo = "Fertroll10/oral-lesions-multisource-classification"
folder = "ViT-Large/pooled"
config = json.load(open(hf_hub_download(repo, f"{folder}/config.json")))
weights = load_file(hf_hub_download(repo, f"{folder}/model.safetensors"))

if config["model_type"] == "effnet":
    model = enetv2(config["enet_backbone"], out_dim=4)
else:
    model = ViTFineTuner(config["vit_model_name"], out_dim=4, timm_imagenet_pretrained=False)
model.load_state_dict(weights, strict=True)
model.eval()

Preprocessing must match training: convert to RGB, resize the longest side to img_size keeping the aspect ratio, zero-pad to a square of img_size, scale pixels to [0, 1] and normalise with the ImageNet mean and standard deviation. config.json records these settings. The screening score used in the paper is p(opmd) + p(cancer) after softmax, with 0.5 as the threshold for suspicious.

Results of the released checkpoints

Values are for the released seed only. Holdout rows come from models that never saw the named source during training or model selection. Macro-F1 averages the classes present in each evaluation set; the Kaggle and Mendeley holdouts contain two classes each.

Folder Seed Val. macro-F1 Evaluated on n Weighted F1 Macro F1 Screening F1 Screening AUC
EfficientNet-B3/pooled 43 0.639 Pooled test 1209 0.596 0.576 0.714 0.754
EfficientNet-B7/pooled 46 0.629 Pooled test 1209 0.608 0.585 0.735 0.778
ViT-Base/pooled 42 0.645 Pooled test 1209 0.583 0.545 0.714 0.737
ViT-Large/pooled 45 0.651 Pooled test 1209 0.624 0.609 0.729 0.761
EfficientNet-B3/no_kaggle 46 0.603 Kaggle holdout 1235 0.504 0.475 0.736 0.763
EfficientNet-B7/no_kaggle 42 0.597 Kaggle holdout 1235 0.582 0.573 0.721 0.754
ViT-Base/no_kaggle 46 0.580 Kaggle holdout 1235 0.463 0.444 0.655 0.703
ViT-Large/no_kaggle 43 0.612 Kaggle holdout 1235 0.633 0.615 0.782 0.832
EfficientNet-B3/no_zenodo 43 0.635 Zenodo holdout 3000 0.246 0.246 0.417 0.585
EfficientNet-B7/no_zenodo 46 0.625 Zenodo holdout 3000 0.268 0.258 0.381 0.564
ViT-Base/no_zenodo 42 0.612 Zenodo holdout 3000 0.304 0.253 0.514 0.524
ViT-Large/no_zenodo 42 0.620 Zenodo holdout 3000 0.235 0.246 0.353 0.564
EfficientNet-B3/no_mendeley 42 0.627 Mendeley holdout 323 0.207 0.208 0.426 0.717
EfficientNet-B7/no_mendeley 44 0.615 Mendeley holdout 323 0.247 0.247 0.551 0.714
ViT-Base/no_mendeley 43 0.593 Mendeley holdout 323 0.175 0.174 0.496 0.673
ViT-Large/no_mendeley 44 0.650 Mendeley holdout 323 0.235 0.235 0.632 0.739

Remaining-source test results for the source-exclusion models are in each config.json.

Limitations

Performance drops sharply on sources excluded from training, most of all on Zenodo and Mendeley. Photographs from new clinics, devices or lighting conditions should be expected to behave like these holdouts rather than like the pooled test set. Benign-lesion and cancer recall are low even on the pooled test. The internal data were collected retrospectively without a common acquisition protocol, and part of the cancer class rests on recorded diagnoses or suspicions rather than biopsy results.

These models are research tools for studying clinician-assisted triage. They do not replace clinical examination, patient history or histopathology.

Earlier checkpoints

legacy/ holds the checkpoints published in March 2026. They were trained on the original splits, in which a Zenodo identifier-parsing error placed photographs of the same patients in both training and test partitions. Use the checkpoints above instead; legacy/README.md has details.

Citation

The manuscript is under review. A citation will be added here once it is published.

License

Weights are released under CC BY-NC 4.0. The terms of the original public datasets also apply. The code in the GitHub repository is licensed separately under Apache 2.0.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support