ResNet-18 for oral epithelial dysplasia grading (OralEpitheliumDB)

ImageNet-pretrained ResNet-18 fine-tuned to grade oral epithelial dysplasia in H&E histology into four classes. It is the uncompressed baseline of a study comparing Tucker-2 and Tensor-Train decomposition for CNN compression (Best Research Award, WTDCC 2026, UFU).

Files

File Content
model.safetensors Fold-1 checkpoint (CosineAnnealingLR, seed 123). Starting point of the compressed models.
ensemble/fold1..5.safetensors The five cross-validation checkpoints of the same run; average their softmax outputs for the ensemble.
oed_models.py Model definition, loading and preprocessing (no other code needed).

Data

OralEpitheliumDB: 456 H&E-stained regions of interest from mouse tongue tissue, graded into four classes of oral epithelial dysplasia (OED): healthy, mild, moderate, severe (114 images each).

  • Hold-out test set: 20% stratified split (train_test_split(..., test_size=0.2, stratify=labels, random_state=123)), 92 images, 23 per class.
  • The remaining 80% were used for 5-fold cross-validation (training and model selection).
  • The images are not redistributed here; get the dataset from its original source.

Training

  • Architecture: torchvision ResNet-18, ImageNet weights (ResNet18_Weights.DEFAULT), new 4-class head.
  • AdamW (lr 1e-3, weight decay 1e-5), batch 32, 50 epochs, CosineAnnealingLR, seed 123.
  • Augmentation: Resize(256) → RandomCrop(224) → horizontal/vertical flips → RandomRotation(40) → ColorJitter(0.1).
  • Checkpoint selection on the validation fold by a clinical composite score S = QWK − danger rate − underestimation rate (danger = error of ≥ 2 grades; underestimation = predicted grade below the true one).
  • Hardware: NVIDIA RTX 3050 Laptop GPU (6 GB).

Results (hold-out test set, n = 92)

Model AUC (macro, OvR) F1 (macro) QWK Accuracy Danger rate
Fold 1 (model.safetensors) 0.9586 0.7956 0.8591 0.7935 0.043
Ensemble of 5 folds 0.9789 0.8771 0.9153 0.8804 0.033

Ensemble confusion matrix (rows = true, columns = predicted; healthy, mild, moderate, severe): [[23, 0, 0, 0], [1, 16, 4, 2], [0, 2, 20, 1], [0, 1, 0, 22]].

Metrics re-computed on CPU from the published files; they match the original training log. Parameters: 11.18 M. Cost: 3.63 GFLOPs per 224×224 image.

Usage

# pip install torch torchvision safetensors huggingface_hub
from huggingface_hub import hf_hub_download
import importlib.util, sys
from PIL import Image

path = hf_hub_download("LuisPaim/oed-resnet18", "oed_models.py")
spec = importlib.util.spec_from_file_location("oed_models", path)
oed = importlib.util.module_from_spec(spec); sys.modules["oed_models"] = oed; spec.loader.exec_module(oed)

model = oed.from_pretrained("LuisPaim/oed-resnet18")
print(oed.predict(model, Image.open("roi.tif")))   # {'healthy': ..., 'mild': ..., 'moderate': ..., 'severe': ...}

The compressed architecture is rebuilt from the tensor shapes stored in the file, so neither the original decomposition code nor tensorly is needed.

Ensemble:

models = [oed.from_pretrained("LuisPaim/oed-resnet18", f"ensemble/fold{k}.safetensors") for k in range(1, 6)]
print(oed.predict(models, Image.open("roi.tif")))

Intended use and limitations

  • Research and education only. Not a medical device and not validated for diagnosis. The models were trained on mouse tissue and have not been tested on human biopsies, other staining protocols or other scanners.
  • Small test set (92 images): confidence intervals are wide, and differences of a few hundredths of AUC are within noise.
  • Single starting point (one seed, fold 1): the compression results describe one checkpoint, not an average over seeds.

Citation

If you use these models, please cite the dataset (OralEpitheliumDB, Journal of Imaging Informatics in Medicine, 2024, doi:10.1007/s10278-024-01041-w) and this repository.

Author: Luis Felipe Garcia de Souza Paim — Faculdade de Computação, Universidade Federal de Uberlândia (UFU). Supervision: Prof. Marcelo Zanchetta do Nascimento.

Related

Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
11.2M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for LuisPaim/oed-resnet18

Finetunes
2 models