⚠️ RESEARCH USE ONLY — NOT FOR CLINICAL USE. This model is a research
artifact trained on a single retrospective dataset and is validated only one external dataset. It
must not be used for diagnosis, screening, or any
clinical decision-making. Multiple external, prospective validation is required before
any clinical consideration.
A ResNet-18 binary classifier that predicts the probability that a cropped
thyroid ultrasound nodule image is malignant (positive class) vs benign.
Built for a reproducible, publication-oriented experiment with proper
calibration and a sensitivity-prioritized, validation-locked decision threshold.
Backbone:timm ResNet-18, A1 ImageNet-1k recipe (resnet18.a1_in1k), full fine-tune
Selected by: validation AUROC (14-trial sweep; winner val AUROC 0.9756)
Calibration: temperature scaling (T = 0.5646), fit on validation
Locked threshold:0.7113 (highest-specificity threshold with validation sensitivity ≥ 0.95)
Cite this model
Thomas J. agentic_thyroid_model [software]. Revision e4f94ea. Hugging Face; 2026. doi:10.57967/hf/9282
Intended use
Intended: methodological research, benchmarking, and as a baseline for
thyroid ultrasound malignancy classification studies.
Out of scope: any clinical, diagnostic, triage, or screening use; use on
images acquired/preprocessed differently from the training data without
re-validation; use on non-thyroid or non-ultrasound images.
Labels:0 = Benign, 1 = Malignant (positive class = Malignant).
Class balance: ~70–75% malignant in every split (mild imbalance). See
data_exploration_report.md: 0 corrupt images,
0 cross-split pixel duplicates, 0 filename-ID overlaps → no detectable leakage.
Label definitions
Label
Class
Meaning
0
Benign
Non-malignant thyroid nodule
1
Malignant
Malignant thyroid nodule (positive class)
Preprocessing (locked — configs/preprocess.json)
Deterministic eval/inference path (no augmentation):
Resize to 224×224 (bicubic; the timm A1 data config).
ToTensor().
Normalize with ImageNet mean [0.485, 0.456, 0.406], std [0.229, 0.224, 0.225].
Grayscale ultrasound images are loaded as 3-channel RGB.
Model architecture
ResNet-18 with a single-logit binary head (num_classes=1); sigmoid → probability
of malignancy. ~11.2M parameters. Trained from ImageNet-1k weights (full fine-tune).
Augmentations were chosen to be medically plausible for B-mode ultrasound
(no vertical flip, no large rotation/shear, no aggressive crop, no color/HSV
jitter), informed by MediAug (arXiv:2504.18983) and thyroid-US best practice.
The augmentation ablation confirmed medical_default (0.9712–0.9756 val AUROC)
outperforms both flip_only (0.9637) and medical_strong (0.9609).
After selecting the model by validation AUROC and calibrating on validation, the
decision threshold was chosen on the validation set as the highest-specificity
threshold achieving sensitivity ≥ 0.95 (clinically sensitivity-prioritized).
Youden's J is reported as a secondary reference. The threshold (0.7113) was
locked before the test set was touched.
Temperature scaling (T=0.5646) on validation reduced validation ECE from 0.0833
→ 0.0308 and Brier from 0.0592 → 0.0525 with AUROC unchanged (monotonic). On
the test set, calibrated ECE is 0.0314 (well calibrated). Reliability diagrams:
results/figures/valid_calibration.png, results/figures/test_calibration.png.
Single-source dataset Performance on data from
other scanners, institutions, or populations is unknown and likely lower.
Cropped-ROI inputs. The model expects nodule-cropped images like TN5000;
whole-frame ultrasound will be out of distribution. The model input is a region of interest
centered on the nodule that includes the nodule together with a margin of adjacent tissue.
It is not a tight crop that excludes all surrounding parenchyma. At deployment,
an operator selects the region of interest, so region selection is a human in the loop step,
and inter operator variability in region selection may affect model output.
Sensitivity gap at deployment threshold. The threshold targets ≥0.95
sensitivity on validation; on the test set sensitivity was 0.904 — i.e. the
operating point does not perfectly transfer, and ~10% of malignant nodules
were missed at this threshold. Threshold re-calibration on local data is
advisable before any use.
Label/selection bias. Labels and cohort composition reflect the source
dataset's referral and pathology-confirmation process.
Leakage checks were exhaustive within the available signal (exact pixel
hashing + filename-ID overlap, all zero) but cannot rule out near-duplicate or
same-patient-different-image leakage if such structure exists in the source.
But the original article describing the dataset states that "Only one representative image among the images of the same perspective of the patient is reserved, to prevent the risk of data leakage and ensure the dataset can be partitioned at the patient level;"
⚠️ External validation required before clinical use
At present this model has only one external validation.
This model requires independent, ideally prospective, multi-site external
validation before any clinical consideration. It is released for research
reproducibility only.
If you use this model or the accompanying findings in your research, please cite our preprint:
bibtex
1@article{thomas2026agentic,
2 author = {Thomas, Johnson and others},
3 title = {Agentic Thyroid Model Paper Title},
4 journal = {medRxiv},
5 year = {2026},
6 doi = {10.64898/2026.06.23.26356395v1},
7 url = {https://www.medrxiv.org/content/10.64898/2026.06.23.26356395v1}
8}