ResNet-50 for SD-OCT Retinal Disease Classification

Model description

This model is the ResNet-50 configuration evaluated in the research study “Benchmarking ResNet, DenseNet, MobileNet and Inception Backbones for SD-OCT Retinal Disease Classification” by Shkëlqim Sherifi (2026).

It is an ImageNet-pretrained ResNet-50 convolutional backbone adapted through transfer learning to classify grayscale spectral-domain optical coherence tomography (SD-OCT) B-scans into four dataset categories:

  • CNV - choroidal neovascularization
  • DME - diabetic macular edema
  • Drusen
  • Normal

ResNet-50 achieved the highest aggregate test accuracy among the six backbones benchmarked in the study: 96.22% on the supplied OCT2018 test partition. This is a research benchmark result, not evidence of clinical readiness or universal superiority. DenseNet-121 achieved a very similar accuracy (96.09%) with substantially fewer backbone parameters and the highest reported Drusen F1 score; model selection should therefore consider the intended trade-off, not accuracy alone.

Intended use

This checkpoint is intended for research and educational experimentation involving four-class SD-OCT image classification on data similar to the OCT2018 LOCT/Kermany distribution.

Potential research uses include:

  • Reproducing or extending the paper's transfer-learning benchmark.
  • Comparing CNN backbones under a matched OCT image-classification protocol.
  • Studying class-wise performance and error patterns for CNV, DME, Drusen, and Normal labels.

Out-of-scope use and safety

  • Not for clinical diagnosis, screening, triage, treatment selection, or autonomous medical decision-making.
  • Do not use the output as a substitute for assessment by a qualified ophthalmologist.
  • The model has not been externally validated on independent clinical cohorts or other OCT datasets in the reported study.
  • The model is a four-class classifier. It is not designed to detect diseases outside the four labels, identify image quality, segment retinal anatomy, or localize lesions.
  • Do not assume that softmax scores are calibrated probabilities of disease or that a high score establishes a diagnosis.

Clinical use would require, at minimum, independent external validation, careful assessment of dataset leakage and patient-level separation, uncertainty analysis, prospective evaluation, and applicable regulatory review.

Model architecture

  • Backbone: ResNet-50, ImageNet-pretrained, TensorFlow/Keras implementation, original 1,000-class ImageNet classification layer removed.
  • Backbone parameters: approximately 23.59 million.
  • Full model parameters: approximately 24.77 million, including the task-specific classification head.
  • Feature aggregation: GlobalAveragePooling2D.
  • Classification head: Dense(512, ReLU) → Batch Normalization → Dropout(0.5) → Dense(256, ReLU) → Batch Normalization → Dropout(0.3) → Dense(4, Softmax, float32).
  • Output: four softmax scores, one for each target class.

Input and preprocessing

The expected input is a single grayscale SD-OCT B-scan. The training pipeline used:

  1. Resize the image to 224 × 224 pixels.
  2. Replicate the single grayscale channel across three channels.
  3. Apply the ResNet ImageNet preprocessing used by the TensorFlow/Keras implementation (BGR channel ordering and ImageNet mean subtraction).

Do not apply an additional [0, 1] normalization before the ResNet preprocessing step unless the released model's inference pipeline explicitly requires it. The preprocessing used at inference must match the preprocessing used during training.

Training-time augmentation

Augmentation was applied during training only:

  • Random horizontal flip.
  • Random rotation up to ±5°.
  • Random translation up to ±5%.
  • Random zoom up to ±5% in height and width.
  • Random contrast with factor 0.15.

Vertical flipping was excluded. Augmentation was disabled for validation, testing, and inference.

Training procedure

The model was trained under the study's common two-stage transfer-learning protocol:

Stage 1 - frozen backbone

  • Initialize the ResNet-50 backbone with ImageNet weights and freeze it.
  • Train the task-specific classification head for up to 15 epochs.
  • Use AdamW and class-weighted categorical cross-entropy with label smoothing (0.1).

Stage 2 - partial fine-tuning

  • Restore the best Stage-1 checkpoint.
  • Unfreeze the final 50% of backbone layers while keeping the first 50% frozen.
  • Fine-tune for up to 30 epochs using AdamW and the same class-weighted loss with label smoothing (0.1).

Additional reported settings:

  • Batch size: 16.
  • Random seed: 42.
  • Mixed precision: float16 computation with float32 output.
  • Early stopping and learning-rate reduction were monitored using validation loss.
  • Approximate class weights: CNV 0.73, DME 2.36, Drusen 3.08, Normal 0.53.
  • Training framework: TensorFlow 2.20.0 with the Keras API.
  • Training hardware: NVIDIA Tesla T4 GPU with 16 GB VRAM (reported Google Colab environment).

The study reports one training run per backbone. The values above describe the reported experiment; they should not be interpreted as estimates of run-to-run variability.

Training data

The experiments used the publicly distributed OCT2018 distribution of the LOCT/Kermany SD-OCT dataset, containing 109,309 grayscale OCT B-scans across four classes.

Class Training Validation Test
CNV 26,218 7,491 3,746
DME 8,118 2,319 1,161
Drusen 6,206 1,773 887
Normal 35,973 10,278 5,139
Total 76,515 21,861 10,933

Dataset source cited by the study: Labeled Optical Coherence Tomography (OCT) - Kaggle.

The supplied training, validation, and test partitions were retained for the experiments. The paper explicitly states that the exact local image files were not independently audited for cross-partition exact or near-duplicate images, and patient-level independence could not be established. A previously published audit reported duplication in an OCT2018 distribution with the same nominal partition sizes, but those audit figures were not independently reproduced for the local files used in this study. Consequently, the test results below must be read as performance on the supplied test partition, not as confirmed leakage-free generalization to unseen patients or OCT images.

Evaluation results

The following results are reported for ResNet-50 on the supplied OCT2018 test partition.

Metric Result
Test accuracy 96.22%
Balanced accuracy 93.97%
Macro F1 0.9348
Weighted F1 0.9625
Matthews correlation coefficient (MCC) 0.9416
Cohen's kappa 0.9415

Drusen-specific performance

The paper's focused Drusen analysis reports:

Metric Result
Precision 0.8245
Recall 0.8579
F1 0.8409

Drusen was the lowest-F1 class across all six evaluated backbones. For ResNet-50, the test confusion matrix shows recurrent errors involving Drusen, including 99 Normal scans predicted as Drusen and 87 Drusen scans predicted as CNV. These errors are important when interpreting the aggregate accuracy.

Benchmark context

ResNet-50 had the highest test accuracy in the six-model comparison, but DenseNet-121 reached 96.09% accuracy with approximately 7.04M backbone parameters compared with approximately 23.59M for ResNet-50. DenseNet-121 also achieved the best reported Drusen F1 (0.8433). The paper therefore identifies a meaningful accuracy/parameter/class-specific trade-off rather than a universal best architecture.

Runtime information

The paper measured CPU inference using batch size 1, 50 warm-up runs, and 200 timed runs on an Intel Core i7-6700HQ CPU at 2.60 GHz, using float32 inference.

Measurement Result
Mean latency per image 331.94 ms
Median latency per image 331.53 ms
Derived single-image throughput 3.013 images/second

These measurements are specific to the hardware, software, and implementation used in the study. They are not universal latency estimates and should not be used to predict performance on other devices.

Limitations

  1. Dataset integrity and split independence: the local files used in the experiment were not independently checked for cross-partition duplicates. Patient-level independence is also unverified.
  2. No external validation: the study did not evaluate cross-dataset transfer to other OCT datasets, devices, institutions, or patient populations.
  3. Single run: each backbone was trained once with seed 42. Run-to-run variance was not estimated.
  4. No formal uncertainty estimates: the reported metrics are point estimates; the study did not report confidence intervals or formal paired statistical tests for model comparisons.
  5. Class-specific errors: Drusen remained the most difficult class, with false-positive and false-negative confusion involving CNV and Normal scans.
  6. Interpretability limits: Grad-CAM maps were used as qualitative visualizations. They do not establish clinically correct lesion localization or explain model decisions causally.
  7. Hardware-specific timing: CPU latency was measured on one software/hardware configuration only.

Usage

The paper describes a TensorFlow/Keras model, but this card is based on the research paper and does not itself include or verify a released checkpoint file. The following is an illustrative local-inference template. It assumes that the repository contains the complete trained model saved as resnet50_sd_oct.keras; update the path and class-index mapping to match the actual uploaded artifact.

import tensorflow as tf
from tensorflow.keras.applications.resnet50 import preprocess_input

MODEL_PATH = "resnet50_sd_oct.keras"
# Confirm this order against the class_indices used when the checkpoint was trained.
CLASS_NAMES = ["CNV", "DME", "Drusen", "Normal"]

model = tf.keras.models.load_model(MODEL_PATH, compile=False)

def preprocess_oct_image(image_path: str) -> tf.Tensor:
    image_bytes = tf.io.read_file(image_path)
    image = tf.io.decode_image(
        image_bytes,
        channels=1,
        expand_animations=False,
    )
    image.set_shape([None, None, 1])
    image = tf.image.resize(image, [224, 224])
    image = tf.cast(image, tf.float32)  # retain the 0–255 image scale
    image = tf.repeat(image, repeats=3, axis=-1)
    image = preprocess_input(image)  # ResNet BGR conversion and mean subtraction
    return image[tf.newaxis, ...]

def predict_oct_image(image_path: str):
    inputs = preprocess_oct_image(image_path)
    probabilities = model(inputs, training=False).numpy()[0]
    ranked = sorted(
        zip(CLASS_NAMES, probabilities.tolist()),
        key=lambda item: item[1],
        reverse=True,
    )
    return ranked

# Example:
# print(predict_oct_image("example_oct_scan.jpeg"))

The example is not a substitute for the original training/inference code. Confirm the exported model format, TensorFlow/Keras compatibility, image intensity conventions, and class-index mapping before publishing a working inference endpoint.

Ethical considerations

The source dataset is described in the paper as a publicly available, de-identified, pre-existing OCT dataset. The model may still reproduce biases or acquisition-specific patterns present in that dataset. Performance may differ across devices, clinical sites, patient populations, and disease prevalence. The model should not be used to make or communicate a diagnosis to patients.

License

The research paper identifies its own publication license as CC BY 4.0. The paper does not establish the license for the trained model weights or grant a separate license for the source dataset. The model repository owner should add a Hugging Face license field only after confirming the applicable rights for the checkpoint, code, and training data.

Citation

If you use this model or reproduce the reported experiment, cite:

Sherifi, Shkëlqim. “Benchmarking ResNet, DenseNet, MobileNet and Inception Backbones for SD-OCT Retinal Disease Classification.” 2026. Research manuscript.

Dataset reference:

Kermany, D. S., et al. “Identifying Medical Diagnoses and Treatable Diseases by Image-Based Deep Learning.” Cell, 172(5), 1122–1131.e9, 2018. https://doi.org/10.1016/j.cell.2018.02.010

Research code and supplementary materials identified by the paper: GitHub repository.


Release checklist: before publishing, upload the actual trained ResNet-50 checkpoint, confirm the checkpoint format and inference code, verify the output class-index mapping, document the checkpoint's license, and ensure the uploaded weights correspond to the ResNet-50 results reported in the paper.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support