Deep learning detects residual thyroid tissue on SPECT after thyroidectomy
Summary of a NICS 2022 paper: ResNet50 with transfer learning on 1,777 I-131 SPECT scans detects residual thyroid tissue with AUC 0.93. AI concepts explained simply.
TL;DR: The paper “A deep learning method using SPECT images to diagnose remaining thyroid tissue post-thyroidectomy” (NICS 2022, IEEE, pp. 93–98) proposes a computer-aided diagnosis (CAD) system based on deep learning. It answers one clinical question: after a total thyroidectomy, is any thyroid tissue left in the patient's body? The authors used 1,777 I-131 SPECT scintigraphy images from 108 Military Central Hospital in Hanoi. A ResNet50 model fine-tuned from ImageNet reached 87% accuracy, 84.85% sensitivity, 89.11% specificity and an AUC of 0.93. On hard cases alone, the model still reached an AUC of 0.79 using only the images, with no additional blood tests.
Paper at a glance
| Item | Details |
|---|---|
| Title | A deep learning method using SPECT images to diagnose remaining thyroid tissue post-thyroidectomy |
| Authors | Minh Lai Phu, Thanh Vinh Pham, Duc Thuc Pham, Thanh Trung Nguyen, Minh Duc Chu, Chi Thanh Nguyen, Quoc Long Tran, Thai Ha Nguyen, Duc Thuan Nguyen |
| Affiliations | School of Electrical and Electronic Engineering, Hanoi University of Science and Technology (HUST); Department of Computer Science, VNU University of Engineering and Technology (UET); Departments of Medical Equipment and Nuclear Medicine, 108 Military Central Hospital; Institute of Information Technology, Academy of Military Science and Technology (AMST) |
| Venue | 2022 9th NAFOSTED Conference on Information and Computer Science (NICS), IEEE, pp. 93–98 |
| Funding | Project TXTCN.21.23, Vietnam National University, Hanoi |
| Task | Binary classification: residual vs non-residual thyroid tissue |
| Best model | ResNet50 (transfer learning from ImageNet) |
Key takeaways
- The clinical problem. After a total thyroidectomy, nuclear medicine physicians read SPECT scans by eye to look for leftover thyroid tissue. The result depends on each reader's experience. In hard cases, physicians also need blood tests (TSH and thyroglobulin) to decide.
- Real data at a larger scale than earlier work. The dataset has 1,777 images of thyroid cancer patients scanned with low-dose I-131 (2 or 5 mCi): 864 cases of increased uptake and 913 normal cases in the neck region. Labels came from a consensus of three physicians with more than 10 years of experience. 80.2% of patients were women, and the mean age was 44.5. All images were acquired on a GE INFINIA system.
- Separating easy and hard cases is the main contribution. Guo et al. (2021) reported 96.69% accuracy, but on high-contrast images that are easy to read. This paper splits the data into two subsets for a more honest evaluation:
- ANT-POST: easy and hard cases, using anterior and posterior whole-body views.
- ANT-HN-POST: hard cases only, where physicians needed an extra head-and-neck scan plus lab results.
- Preprocessing. Images are cropped automatically in four steps (grayscale conversion, inversion, thresholding at 128, masking). This keeps the head-and-neck region and removes unrelated organs such as the salivary glands and viscera. Histogram equalization then sharpens the body outline, so the model can locate the shoulders, neck and thyroid bed.
- Models. The authors compared six CNNs pretrained on ImageNet: VGG16, ResNet50, GoogLeNet, DenseNet, Inception-ResNet-V2 and EfficientNet. The first convolution layer was changed to take 2 channels (the ANT and POST images stacked together), and the last layer was replaced with a 2-class classifier. Training used focal loss and the Adam optimizer.
- Results. ResNet50 had the highest AUC on both subsets and was chosen as the proposed model. Heatmaps show that the model focuses on the thyroid bed when it makes a decision.
- Limitations. The model still fails on low-contrast images or when the uptake region is blurred. The hard-case subset is still imbalanced between the two classes.
Results (from Table IV of the paper)
ANT-POST subset (easy and hard cases):
| Model | ACC (%) | SEN (%) | PPV (%) | SPEC (%) | F1 (%) | AUC |
|---|---|---|---|---|---|---|
| VGG16 | 50.50 | 0 | 0 | 100 | 33.55 | 0.50 |
| ResNet50 | 87 | 84.85 | 88.42 | 89.11 | 87 | 0.93 |
| EfficientNet | 80 | 76.77 | 81.72 | 83.17 | 79.97 | 0.90 |
| DenseNet | 87 | 84.85 | 88.42 | 89.11 | 87 | 0.91 |
| Inception-ResNet-V2 | 84 | 70.71 | 95.89 | 97.03 | 83.68 | 0.89 |
| GoogLeNet | 88 | 82.83 | 92.13 | 93.07 | 87.96 | 0.92 |
ANT-HN-POST subset (hard cases only):
| Model | ACC (%) | SEN (%) | PPV (%) | SPEC (%) | F1 (%) | AUC |
|---|---|---|---|---|---|---|
| VGG16 | 50 | 0 | 0 | 100 | 33.33 | 0.50 |
| ResNet50 | 74 | 76 | 73.08 | 72 | 74 | 0.79 |
| EfficientNet | 50 | 0 | 0 | 100 | 33.33 | 0.48 |
| DenseNet | 70 | 62 | 73.81 | 78 | 69.81 | 0.75 |
| Inception-ResNet-V2 | 61 | 26 | 86.67 | 96 | 55.55 | 0.68 |
| GoogLeNet | 59 | 38 | 65.52 | 80 | 57.11 | 0.64 |
How to read the tables: On ANT-POST, GoogLeNet has slightly higher accuracy (88% vs 87%), but the authors selected models by AUC, where ResNet50 leads with 0.93. On the hard-case subset, VGG16 and EfficientNet have 0% sensitivity, which means they predicted a single class for every image (see “model collapse” below).
Training and test data (Table II)
| Subset | Split | Samples | Positive (residual) | Negative |
|---|---|---|---|---|
| ANT-POST | Train | 1,575 | 764 | 811 |
| ANT-POST | Test | 200 | 99 | 101 |
| ANT-HN-POST | Train | 1,028 | 296 | 732 |
| ANT-HN-POST | Test | 100 | 50 | 50 |
25% of the training data was held out for validation. Inputs were resized to 256×256. Hyperparameters: batch size 32, up to 20 epochs, early stopping with patience 10, learning rate 10⁻⁴, focal loss weights α = [2, 3].
AI concepts explained for beginners
AI vs machine learning vs deep learning
- Artificial intelligence (AI): the umbrella term for computer systems that do tasks which normally need human intelligence, such as reading medical images.
- Machine learning: a branch of AI in which the computer learns patterns from existing data instead of following rules written by a programmer.
- Deep learning: a branch of machine learning that uses neural networks with many layers. The strength the paper highlights is that deep learning extracts features automatically: the model works out where to look in an image without a human specifying it.
What is CAD?
CAD (computer-aided diagnosis) is software that gives the physician a second opinion. CAD does not replace the physician. Its goals are to reduce workload, make readings more consistent between physicians and speed up diagnosis. According to the paper, a deep learning CAD system usually has three stages: preprocessing → feature extraction → inference.
Convolutional neural networks (CNNs)
A CNN (convolutional neural network) is a type of neural network built for images. Think of it as a stack of filters. Early layers detect simple details such as edges and bright spots. Later layers combine them into more complex shapes, such as “a bright blob where the thyroid bed is”. All six models in the paper are CNNs.
ResNet50 and residual connections
ResNet50 (He et al., 2016) is a 50-layer CNN. When a network is very deep, the learning signal fades as it passes through the layers, and the network becomes hard to train. ResNet solves this with skip connections: the input of a block is added directly to its output, giving information a “highway” through the layers. This makes ResNet train reliably, and in this paper it gave the best and most consistent results.
The other models: VGG16 is a simple 16-layer network. GoogLeNet/Inception runs filters of several sizes in parallel. DenseNet connects each layer to every layer after it. EfficientNet scales network depth, width and resolution together. Inception-ResNet-V2 combines Inception blocks with skip connections.
ImageNet, pretrained models and transfer learning
- ImageNet: a huge dataset of more than one million everyday photos across 1,000 object categories.
- Pretrained model: a model already trained on ImageNet, so it already knows how to recognize edges, textures and shapes.
- Transfer learning: reusing that knowledge for a new task. It is like an experienced X-ray radiologist learning to read SPECT faster than someone who has never read any scan.
- Fine-tuning: continuing to train the pretrained model on the SPECT data. The paper changes two things: the first layer takes 2 channels (ANT and POST) instead of 3 RGB color channels, and the last layer outputs 2 classes instead of 1,000.
Why do this? About 2,000 images is too few to train a deep network from scratch without overfitting.
Overfitting
Overfitting happens when a model memorizes the training data instead of learning the underlying pattern. It does very well on images it has seen but poorly on new patients. A large model trained on little data is especially prone to it. The paper fights overfitting with transfer learning, data augmentation, a validation set and early stopping.
Data augmentation
Data augmentation creates extra training images by transforming the originals while keeping what matters in them. The paper uses only scaling. Shifting, rotation and flipping were rejected because they produce scans that do not match standard acquisition. This shows that augmentation has to fit the type of medical image.
Histogram equalization
A histogram is a chart of how many pixels have each brightness level. SPECT images are often dark and blurry, so pixels pile up in a few brightness levels. Histogram equalization spreads the brightness levels out to increase contrast. In the paper, this step makes the body outline visible. Without it, the model may look in the wrong place because it cannot find the shoulders and neck.
Class imbalance, hard examples and focal loss
- Class imbalance: one class has far more samples than the other. For example, ANT-HN-POST has 732 negative cases but only 296 positive cases.
- Hard example: an image that even physicians find ambiguous.
- Loss function: a number that measures how wrong the model is. Training tries to make this number smaller.
- Focal loss (Lin et al., 2017) is a variant of cross-entropy. It down-weights easy cases that the model already gets right with confidence, so the model pays more attention to hard cases and the minority class. Focal loss has two parameters: α balances the weight between classes, and γ controls how strongly easy cases are ignored. When γ = 0, focal loss reduces to weighted cross-entropy.
Adam, learning rate, batch, epoch and early stopping
- Optimizer: the algorithm that adjusts the model's weights after each error calculation. Adam (Kingma & Ba, 2015) adapts the step size for each parameter, runs fast and uses little memory.
- Learning rate (10⁻⁴): the size of each adjustment step. Too large and training becomes unstable; too small and training is slow.
- Batch size (32): the number of images the model processes before each weight update.
- Epoch (20): one full pass of the model over the training data.
- Early stopping (patience 10): stops training when the validation result has not improved for 10 epochs in a row, to avoid overfitting.
Train, validation and test sets
- Training set: the data used to teach the model.
- Validation set: data used during training to choose settings and decide when to stop. The paper uses 25% of the training data for this.
- Test set: data the model has never seen, like a final exam. Every number in the results tables above was measured on this set.
Evaluation metrics: how to read them correctly
Every metric below comes from the confusion matrix, which has four cells:
- TP (true positive): tissue remains, and the model says “residual”.
- TN (true negative): no tissue remains, and the model says “non-residual”.
- FP (false positive): no tissue remains, but the model says “residual”.
- FN (false negative): tissue remains, but the model says “non-residual”. This is the most dangerous error clinically, because the disease is missed.
| Metric | Formula | Plain meaning |
|---|---|---|
| Accuracy (ACC) | (TP+TN) / total | Share of all cases predicted correctly |
| Sensitivity (SEN, recall) | TP / (TP+FN) | Of the cases that truly have residual tissue, how many the model catches |
| Specificity (SPEC) | TN / (TN+FP) | Of the cases with no residual tissue, how many the model correctly clears |
| Positive predictive value (PPV, precision) | TP / (TP+FP) | When the model says “residual”, how often it is right |
| F1-score | 2·PPV·SEN / (PPV+SEN) | Harmonic mean of PPV and sensitivity, balancing both error types |
| AUC (area under the ROC curve) | 0.5 → 1.0 | Ability to separate the two groups across all decision thresholds. 0.5 is random guessing, 1.0 is perfect |
Example: ResNet50 has 84.85% sensitivity on ANT-POST. Of the 99 residual cases in the test set, the model detected about 84.
Why select models by AUC? Accuracy depends on one fixed decision threshold and can mislead when classes are imbalanced. AUC measures the model's overall ability to discriminate, so it is more stable.
“Model collapse”: the lesson from VGG16
VGG16 has 0% sensitivity, 100% specificity and an AUC of 0.5. This means the model always predicts “non-residual” for every image. Its accuracy still reaches about 50% only because the two classes in the test set are nearly equal in size. This is why you should never judge medical AI by accuracy alone.
Heatmaps and explainable AI
A heatmap colors the image regions that most influenced the model's decision. In the paper, the heatmaps show ResNet50 focusing on the thyroid bed, the same region a physician examines. This builds trust, because physicians can see that the model looks at the right place rather than at background noise. It is an example of explainable AI (XAI).
Related medical terms
- Total thyroidectomy: surgery that removes the entire thyroid gland, commonly used for differentiated thyroid cancer (more than 97% of thyroid cancer cases).
- Residual thyroid tissue: small amounts of thyroid tissue left after surgery. It must be detected to decide whether further radioactive iodine treatment is needed.
- SPECT (single-photon emission computed tomography): a nuclear medicine imaging technique. The patient receives a radioactive tracer (here I-131), and a gamma camera records where it collects. Thyroid tissue absorbs iodine, so areas with residual tissue light up on the image.
- Scintigraphy: the image produced by the gamma camera.
- ANT / POST / HN: whole-body images taken from the anterior (front) and posterior (back), and a separate head and neck image.
- Thyroid bed: where the thyroid gland sat before it was removed.
- TSH, thyroglobulin (Tg): blood tests used for post-surgery follow-up. Physicians need them for images that are hard to read.
Frequently asked questions (FAQ)
Can AI detect residual thyroid tissue after surgery? Yes. According to the NICS 2022 paper, a ResNet50 model fine-tuned on I-131 SPECT images reached an AUC of 0.93, 84.85% sensitivity and 89.11% specificity in distinguishing residual from non-residual thyroid tissue.
Does this model replace nuclear medicine physicians? No. It is a CAD system that supports physicians. On hard cases, its accuracy drops to 74% (AUC 0.79), so the final decision remains with the physician.
Where did the data come from? 1,777 SPECT images of post-surgery thyroid cancer patients, acquired on a GE INFINIA system. Labels came from a consensus of three nuclear medicine physicians with more than 10 years of experience. The participating institutions were HUST, UET (Vietnam National University, Hanoi) and 108 Military Central Hospital.
Why use transfer learning instead of training from scratch? About 2,000 images is too few to train a deep network from scratch without overfitting. Weights learned on ImageNet provide a good starting point and make training faster.
What is new compared with earlier research? Guo et al. (2021) used only high-contrast images. This paper evaluates easy and hard cases separately, which better reflects real clinical conditions. It also shows that mixing easy and hard cases during training improves performance.
How to cite
IEEE:
M. L. Phu, T. V. Pham, D. T. Pham, T. T. Nguyen, M. D. Chu, C. T. Nguyen, Q. L. Tran, T. H. Nguyen, and D. T. Nguyen, “A deep learning method using SPECT images to diagnose remaining thyroid tissue post-thyroidectomy,” in Proc. 2022 9th NAFOSTED Conference on Information and Computer Science (NICS), IEEE, 2022, pp. 93–98.
BibTeX:
@inproceedings{phu2022spect,
title = {A deep learning method using SPECT images to diagnose remaining thyroid tissue post-thyroidectomy},
author = {Phu, Minh Lai and Pham, Thanh Vinh and Pham, Duc Thuc and Nguyen, Thanh Trung and Chu, Minh Duc and Nguyen, Chi Thanh and Tran, Quoc Long and Nguyen, Thai Ha and Nguyen, Duc Thuan},
booktitle = {2022 9th NAFOSTED Conference on Information and Computer Science (NICS)},
pages = {93--98},
year = {2022},
publisher = {IEEE}
}
Key references used by the paper
- International Atomic Energy Agency, Nuclear Medicine in Thyroid Cancer Management: A Practical Approach, IAEA-TECDOC-1608, Vienna, 2009. iaea.org/publications/7947
- P. Yang et al., “Deep Convolution Neural Network Based Artificial Intelligence Improves Diagnosis of Thyroid Scintigraphy for Thyrotoxicosis: a Dual Center Study,” 2020.
- T. Qiao et al., “Deep learning for intelligent diagnosis in thyroid scintigraphy,” Journal of International Medical Research, vol. 49, no. 1, 2021.
- Y. Guo et al., “Classification and diagnosis of residual thyroid tissue in SPECT images based on fine-tuning deep convolutional neural network,” Frontiers in Oncology, vol. 11, 2021.
- B. R. Haugen et al., “2015 American Thyroid Association management guidelines for adult patients with thyroid nodules and differentiated thyroid cancer,” Thyroid, vol. 26, no. 1, pp. 1–133, 2016.
- S. Patel, R. K. Muthu et al., “Medical image enhancement using histogram processing and feature extraction for cancer classification,” arXiv:2003.06615, 2020.
- K. He, X. Zhang, S. Ren, J. Sun, “Deep residual learning for image recognition,” in Proc. IEEE CVPR, 2016, pp. 770–778.
- K. Simonyan, A. Zisserman, “Very deep convolutional networks for large-scale image recognition,” arXiv:1409.1556, 2014.
- C. Szegedy et al., “Going deeper with convolutions,” in Proc. IEEE CVPR, 2015, pp. 1–9.
- G. Huang et al., “Densely connected convolutional networks,” in Proc. IEEE CVPR, 2017, pp. 4700–4708.
- M. Tan, Q. Le, “EfficientNet: Rethinking model scaling for convolutional neural networks,” in Proc. ICML, PMLR, 2019, pp. 6105–6114.
- C. Szegedy et al., “Inception-v4, Inception-ResNet and the impact of residual connections on learning,” in Proc. AAAI, 2017.
- T.-Y. Lin et al., “Focal loss for dense object detection,” in Proc. IEEE ICCV, 2017, pp. 2980–2988.
- D. R. Sarvamangala, R. V. Kulkarni, “Convolutional neural networks in medical image understanding: a survey,” Evolutionary Intelligence, 2021.
Additional reference (not in the paper's reference list, added to explain Adam): D. P. Kingma, J. Ba, “Adam: A method for stochastic optimization,” in Proc. ICLR, 2015, arXiv:1412.6980.
This article summarizes and explains the original paper for educational purposes. It is not medical advice. All figures are taken from the NICS 2022 paper cited above.
Behind the notebook
Written by thucpham, AI Engineer.