# Deep Learning-based Patient Re-identification Is able to Exploit the Biometric Nature of Medical Chest X-ray Data

Deep learning can re-identify patients from chest X-ray images

Kai Packhäuser, Sebastian Gündel, Nicolas Münster, Christopher Syben, Vincent Christlein, Andreas Maier · arXiv · 2021-3-15

- **Problem** Public chest X-ray datasets remove names and patient numbers, but the images can still link a scan to a person. Earlier work had not shown that a deep learning model could do this from the image content alone.
- **Method** The authors train siamese networks that take two chest X-rays and decide whether they show the same patient. Each branch is a ResNet-50 pretrained on ImageNet, and the branches are merged by absolute difference of their outputs.
- **Results** The best verification model reached an AUC of 0.9940 on ChestX-ray14 test pairs. Accuracy was 0.9555.

## Why removing identifiers may not be enough

Public chest X-ray releases usually strip names and patient numbers, but the metadata that comes with them can still hold sensitive details. Such details include diagnosis, treatment history and the clinical institution. Pseudonymization replaces a true identifier with a code that is unique to the patient but unrelated to the person. A code can still be matched through other public datasets, so pseudonymization is a rather weak technique.

k-anonymity limits identity disclosure to at most 1/k, yet it becomes susceptible to many attacks once background knowledge is available. The authors ask whether a deep learning model can recover the patient from the image content after the identifiers are gone.

The attack starts from one radiograph of known identity, which the attacker must already hold. A verification model compares that radiograph with each dataset image and decides whether both come from the same patient. A re-identification model instead ranks the dataset images by similarity, so the closest matches come first. Figure 1 illustrates both cases, with images of the same patient highlighted in one colour.

![Figure 1: General problem scenario: Comparing a given chest radiograph to publicly available dataset images by means of DL techniques would either result in di…](https://refivu.com/papers/e060b53c-8614-4bbb-8efd-bdb0cebc8fd4/figures/figure-2d938d602e37578267ab2695656e3046.png?thumb=512)

**Figure 1** . General problem scenario: Comparing a given chest radiograph to publicly available dataset images by means of DL techniques would either result in discrete labels indicating whether or not the dataset images belong to the same patient as the given radiograph (veriﬁcation scenario) or yield a ranked list of the most similar radiographs related to the given scan (retrieval scenario). Images belonging to the same patient are highlighted with the same color. The given radiograph is marked with an asterisk. The shown cases would enable a potential attacker to link sensitive patient-related information contained in the dataset to the image of interest.

[Original paper](https://arxiv.org/abs/2103.08562v4) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

The risk is concrete: in 2017 Google and the NIH planned to publish a dataset of 100,000 chest radiographs. The authors claim that a well-trained deep learning system can recover the patient identity from chest X-ray data, which they say is a first. They demonstrate this on the ChestX-ray14 dataset, which contains 112,120 frontal-view images from 30,805 unique patients.

## A siamese network for same-patient verification

The verification network passes two chest radiographs through two identical branches of one siamese neural network (SNN). Both branches share the same parameters, so the two images are embedded in the same feature space before any comparison happens. Each branch is a ResNet-50 pre-trained on ImageNet, and its classification layer is replaced by a layer with 128 output neurons.

The inputs have a size of 3×256×256, whereas the re-identification model later uses a larger input of 3×1024×1024. The metadata of ChestX-ray14 gives the disease patterns, follow-up counts, age, gender and projection view used in these experiments.

The two 128-dimensional feature vectors are merged by computing the absolute difference of their sigmoid activations. A fully-connected layer reduces this merged vector to one neuron, and a sigmoid function σ turns it into the output score ŷ in \[0,1\]. Because the merge uses an absolute difference, swapping the two input images leaves the score unchanged.

The head therefore decides the same-patient question, while the branches only produce comparable features.

The verification model is trained with binary cross-entropy loss on the output score. Mini-batch stochastic gradient descent is combined with the adaptive moment estimation (Adam) method to update the parameters. The batch size Nb is set to 32 in all experiments, and different learning rates are tested to see their effect. Early stopping with a patience p = 5 halts training once the network doesn't improve for 5 epochs.

Pairs for verification are built offline, once before the experiments start. Every same-patient combination of images becomes a positive pair, which yields around 400,000 positive pairs for the training set. Negative pairs are generated randomly for each subset and concatenated with the positive pairs afterwards. The data follows the official ChestX-ray14 split of 70 % training, 10 % validation and 20 % testing, and the patient-wise splitting keeps each patient in one set only.

Labels are binary, with 0 for negative pairs and 1 for positive pairs.

## Training set size and negative pair sampling

Training set size matters most in the fixed-training-set experiments, where verification AUC climbs as the pair count grows. A training set of 100,000 image pairs gave an AUC of 0.8610, whereas 800,000 image pairs gave 0.9896. The 800,000 pairs were 400,000 positive and 400,000 negative pairs, so the positives were mined once from patients with follow-up images.

Training with 200,000 pairs at a learning rate of 10−3 reached 0.9448, and 400,000 pairs at 10−4 reached 0.9587.

The authors also redrew the negative pairs at each epoch, so a run sees far more negatives than a fixed set holds. Because the sample count stays fixed at 800,000, the gain comes from how the negatives are drawn rather than from more data. Randomizing the negatives raised the AUC from 0.9896 with fixed training sets to 0.9940. Most other metrics also rose, except recall, which fell below the fixed-set run.

Table 1 lists each setting with its AUC, accuracy, specificity, recall, precision and F1-score. The learning rate was varied too, but the table keeps only the best run per training set size. The other learning rates sit in a separate table in the appendix, as Supplementary Table 1.

![Table 1: Overview of the obtained veriﬁcation results for our experiments using varying training set sizes Ns at different learning rates η. Moreover, differen…](https://refivu.com/papers/e060b53c-8614-4bbb-8efd-bdb0cebc8fd4/figures/figure-1a60f3c19db659a343f54351578ebd22.png?thumb=512)

**Table 1** . Overview of the obtained veriﬁcation results for our experiments using varying training set sizes Ns at different learning rates η. Moreover, different data handling techniques were used (FTS: Fixed training set; RNP: Randomized negative pairs). For each experiment, the training sets were balanced with respect to the amount of positive and negative image pairs. In this table, we present the area under the curve (AUC) (together with the lower and upper bounds of the 95 % conﬁdence intervals from 10,000 bootstrap runs), the accuracy, the speciﬁcity, the recall, the precision, and the F1-score. Bold text emphasizes the overall highest AUC value.

[Original paper](https://arxiv.org/abs/2103.08562v4) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Kai Packhäuser, Sebastian Gündel, Nicolas Münster, Christopher Syben, Vincent Christlein, Andreas Maier · Deep Learning-based Patient Re-identification Is able to Exploit the Biometric Nature of Medical Chest X-ray Data · Original paper figure · Extracted the figure area from page 3 of the original PDF.

The best run, randomized negative pairs with 800,000 samples at a learning rate of 10−4, gave an accuracy of 0.9555 on the test pairs. Its recall of 0.9287 is the one metric that fell below the fixed-set run. Validation used 50,000 pairs and testing used 100,000 pairs, with no patient overlap between splits.

## Scan intervals, new findings and projection changes

The authors binned same-patient pairs of the best-recall model, the fourth row of Table 1, by age gap, abnormality change and view change. Each analysis reports the true positive rate (TPR) for every bin, with the absolute true positive and overall positive counts printed beside it. The age analysis in Figure 4a covers follow-up intervals of up to 12 years, because larger gaps had too few pairs to report.

Pairs less than one year apart reached a TPR of 0.97. Even at a twelve-year age difference, the model verifies the same patient in 86 % of the pairs, so it stays competitive.

For new abnormality patterns in follow-up scans, the TPR barely declines in Figure 4b, whatever the abnormality. The disease labels were extracted with natural language processing, which can add label noise and may have affected this result. Changes in the projection view, such as anterior-posterior against posterior-anterior, hardly lead to any deterioration in Figure 4c.

Taken together, the verification model tolerates the usual changes between a patient's scans in these three bins. The bins only show what the model did on ChestX-ray14 same-patient pairs, not on other datasets.

## External datasets and foreign material

Without fine-tuning, the verification network was tested on 16,486 CheXpert image pairs and 1,548 COVID-19 Image Data Collection pairs. On these external sets, the network reached an AUC of 0.9870 on CheXpert and 0.9763 on COVID-19. On the in-domain ChestX-ray14 task, the same verification approach reached an AUC of 0.9940. The authors attribute the lower external values to a possible domain shift or to the severity of diseases.

Foreign material is visible in some ChestX-ray14 images, so the authors tested whether it affects verification. They built two manually created subsets of around 200 images each, one with foreign material and one without. The authors kept no more than 5 images per patient, and they picked patients at random before the visual assessment. The network reached an AUC of 0.9970 on images with foreign material and 0.9972 on images without it.

Because these two values are almost identical, the authors saw no visible loss caused by foreign material. They even observed a slight improvement on the subset without foreign material.

![Table 2: Comparison of the veriﬁcation performance on two different subsets of the ChestX-ray14 dataset that either contain foreign material or not (ﬁrst two r…](https://refivu.com/papers/e060b53c-8614-4bbb-8efd-bdb0cebc8fd4/figures/figure-2186087ea3e2b1d930549b7bf4caa917.png?thumb=512)

**Table 2** . Comparison of the veriﬁcation performance on two different subsets of the ChestX-ray14 dataset that either contain foreign material or not (ﬁrst two rows). Furthermore, we show the veriﬁcation results for the CheXpert dataset and the COVID-19 Image Data Collection (last two rows). We present the AUC (together with the lower and upper bounds of the 95 % conﬁdence intervals from 10,000 bootstrap runs), the accuracy, the speciﬁcity, the recall, the precision, and the F1-score.

[Original paper](https://arxiv.org/abs/2103.08562v4) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

To see what drives the decisions, the authors applied a siamese attention mechanism together with Grad-CAM. The attention maps focus on the shape of the lungs and ribs, which the authors call the driving factor for the network decisions. The maps of the first convolutional layer of the ResNet-50 also highlight the collarbones and the contour of the diaphragm.

## Re-identification embeddings and training

The re-identification network drops the merging head and keeps only the feature branch, so each radiograph becomes an embedding. The network doesn't decide directly whether two inputs share a patient; it learns feature representations instead. Retrieval then ranks the database images by Euclidean distance between the query embedding and each other image.

Verification works differently, because its branches end in 128 neurons that feed a merged sigmoid output. That verification model merges the branches by the absolute difference of the sigmoid activations and trains with binary cross-entropy.

An adaptive average pooling layer replaces the original average pooling and produces 5×5 feature maps. An adaptive max-pooling layer runs alongside it and also yields 5×5 maps. The two pooled outputs are concatenated, and a 1×1 convolutional layer reduces 2048 feature maps to 100. Flattening and two fully connected layers then give a 128-dimensional representation for each branch.

The contrastive loss maps similar inputs to nearby points and dissimilar inputs to distant points. Negative pairs contribute to the loss only when their distance is smaller than the margin, which is set to m = 1. Online mining forms pairs inside each batch, so the embeddings of all batch images feed every possible combination into the loss.

Patients with only one available image are dropped from the training set.

With a batch size of 32, few informative pairs fit into each step, so the authors add cross-batch memory. A memory size of 128 means the last 4 batches supply embeddings for mining, because embeddings drift slowly over time. The authors first train the new head for 30 epochs with the other parameters frozen, then train the full architecture for 50 epochs.

SGD follows a 1cycle schedule with bounds of 0.1584 and 0.0063, and L2 regularization uses a decay factor of 10−5.

## Retrieval results across resolution and datasets

At the original 1024×1024 input size, the re-identification retrieval reaches an mAP@R of 0.9748 and a Precision@1 of 0.9963 on ChestX-ray14. The closest match comes from the same patient in more than 99 % of queries, so the top hit is usually correct. The test set holds 25,596 images, while the training set holds 61,755 and the validation set holds 10,815.

The retrieval ranks database images by Euclidean distance between the query embedding and each other image.

Shrinking the input to 512×512 lowers the mAP@R only to 0.9572, which is still a high value. At 224×224, the mAP@R falls to 0.7730, while the Precision@1 stays at 0.9756. The authors had reduced the image size too aggressively at this point, so the full ranking degrades more than the top hit. The top hit therefore survives heavier downsampling better than the full ranking does.

Without fine-tuning, CheXpert gives an mAP@R of 0.8001 and a Precision@1 of 0.9444 on 6,454 images. The COVID-19 data gives an mAP@R of 0.8569 and a Precision@1 of 0.8821 on 781 images. These external values sit below the ChestX-ray14 results, yet the authors still call the transfer feasible.

On the foreign-material subsets, the mAP@R is 0.9925 with visible foreign material and above 0.9999 without it. The subsets are small, so the authors hypothesize that the outcome is independent of foreign material. They didn't test this hypothesis beyond these two subsets.

![Table 4: Comparison of the re-identiﬁcation performance on two different subsets (ChestX-ray14) that either contain foreign material or not. We report the mAP@…](https://refivu.com/papers/e060b53c-8614-4bbb-8efd-bdb0cebc8fd4/figures/figure-40a387b483d71e7599ec01347348b104.png?thumb=512)

**Table 4** . Comparison of the re-identiﬁcation performance on two different subsets (ChestX-ray14) that either contain foreign material or not. We report the mAP@R, the R-Precision, and the Precision@1.

[Original paper](https://arxiv.org/abs/2103.08562v4) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

## Limits of the evidence

The authors state that their verification results were obtained empirically, so they don't necessarily reflect true measures of certainty. Training used only ChestX-ray14, so the model never saw CheXpert or the COVID-19 Image Data Collection during training. Without fine-tuning, the network reached an AUC of 0.9870 on CheXpert and 0.9763 on COVID-19.

The external evaluation used 16,486 CheXpert image pairs and 1,548 COVID-19 image pairs.

The ChestX-ray14 images show high technical variance, which the authors link to various windowing techniques. Dynamic normalization could reduce variations in contrast and brightness, and alignment could counteract rotation and scaling. Those steps weren't tested, and the authors state that patient matching still works without such pre-processing.

The authors hypothesize that patient-specific noise patterns may unintentionally improve re-identification performance. They suspect the initial anonymization may be biased toward the clinical institution and therefore toward follow-up images. To test this, they intend to examine datasets with little correlation between noise patterns and patient identity.

The COVID-19 Image Data Collection mixes image sizes, gray-scale and color images, and visible markers, arrows or date displays. Markers and dates might ease patient matching, but the authors treat this set as a realistic public-data case. Differential privacy and federated learning are raised as defences, yet the paper doesn't test either one.

Differential privacy degrades model quality, a privacy-utility trade-off that the authors call problematic in medicine. Disease labels were extracted with natural language processing, which may have added label noise to the changing-abnormality analysis.

## Paper info

- **Authors**: Kai Packhäuser, Sebastian Gündel, Nicolas Münster, Christopher Syben, Vincent Christlein, Andreas Maier
- **Venue**: arXiv · Preprint
- **First published**: 2021-3-15
- **Added**: 2026-11-6
- **Updated**: 2022-9-2
- **Version**: v4
- **arXiv**: 2103.08562
- **DOI**: 10.1038/s41598-022-19045-3
- **Category**: cs.CV · cs.AI · cs.LG · eess.IV
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2103.08562v4) · [PDF ↗](https://arxiv.org/pdf/2103.08562v4)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

With the rise and ever-increasing potential of deep learning techniques in recent years, publicly available medical datasets became a key factor to enable reproducible development of diagnostic algorithms in the medical domain. Medical data contains sensitive patient-related information and is therefore usually anonymized by removing patient identifiers, e.g., patient names before publication. To the best of our knowledge, we are the first to show that a well-trained deep learning system is able to recover the patient identity from chest X-ray data. We demonstrate this using the publicly available large-scale ChestX-ray14 dataset, a collection of 112,120 frontal-view chest X-ray images from 30,805 unique patients. Our verification system is able to identify whether two frontal chest X-ray images are from the same person with an AUC of 0.9940 and a classification accuracy of 95.55%. We further highlight that the proposed system is able to reveal the same person even ten and more years after the initial scan. When pursuing a retrieval approach, we observe an mAP@R of 0.9748 and a precision@1 of 0.9963. Furthermore, we achieve an AUC of up to 0.9870 and a precision@1 of up to 0.9444 when evaluating our trained networks on external datasets such as CheXpert and the COVID-19 Image Data Collection. Based on this high identification rate, a potential attacker may leak patient-related information and additionally cross-reference images to obtain more information. Thus, there is a great risk of sensitive content falling into unauthorized hands or being disseminated against the will of the concerned patients. Especially during the COVID-19 pandemic, numerous chest X-ray datasets have been published to advance research. Therefore, such data may be vulnerable to potential attacks by deep learning-based re-identification algorithms.

## Quote from the paper

Kai Packhäuser, Sebastian Gündel, Nicolas Münster, Christopher Syben, Vincent Christlein, Andreas Maier (2021). Deep Learning-based Patient Re-identification Is able to Exploit the Biometric Nature of Medical Chest X-ray Data. arXiv:2103.08562v4. https://doi.org/10.1038/s41598-022-19045-3

**BibTeX**

```
@article{packhuser2021deep,
  title = {{Deep Learning-based Patient Re-identification Is able to Exploit the Biometric Nature of Medical Chest X-ray Data}},
  author = {Kai Packhäuser and Sebastian Gündel and Nicolas Münster and Christopher Syben and Vincent Christlein and Andreas Maier},
  year = {2021},
  eprint = {2103.08562},
  archivePrefix = {arXiv},
  doi = {10.1038/s41598-022-19045-3},
  url = {https://arxiv.org/abs/2103.08562v4}
}
```

## Other paper commentary

- [SiamMask: A Framework for Fast Online Object Tracking and Segmentation](https://refivu.com/en/papers/787996d1-9244-4fb7-8021-225539408b8f-siammask-a-framework-for-fast-online-object-tracking.md)
- [SAM: Self-supervised Learning of Pixel-wise Anatomical Embeddings in Radiological Images](https://refivu.com/en/papers/b686c856-c0a0-462a-9a5f-8b71535eb2f6-sam-self-supervised-learning-of-pixel-wise-anatomical.md)
- [OdorSpaces: Visual-Olfactory Embodied Navigation in 3D Environments](https://refivu.com/en/papers/fa3085f2-9992-4ff9-8c1d-755e77f7b01a-odorspaces-visual-olfactory-embodied-navigation-in-3d.md)
- [Discarded or Unreachable? Diagnosing and Repairing Spatial Relation Failure in Vision--Language Similarity](https://refivu.com/en/papers/0fafe702-8cfc-439c-87e0-4bdffb12b1c8-discarded-or-unreachable-diagnosing-and-repairing-spatial.md)
- [Image-to-Image Translation with Conditional Adversarial Networks](https://refivu.com/en/papers/92d09be2-7a1b-4f53-9d24-569d7cc94149-image-to-image-translation-with-conditional-adversarial.md)
- [Rethinking the Inception Architecture for Computer Vision](https://refivu.com/en/papers/5a8c1d5f-a10c-4a76-a110-b62861a7dc8a-rethinking-the-inception-architecture-for-computer-vision.md)
- [RemixIT: Continual self-training of speech enhancement models via bootstrapped remixing](https://refivu.com/en/papers/ece6cee0-2c9f-4929-a773-721f2744cab0-remixit-continual-self-training-of-speech-enhancement-models.md)
- [Fast-GANFIT: Generative Adversarial Network for High Fidelity 3D Face Reconstruction](https://refivu.com/en/papers/f7e4dd6d-1545-4e0e-bedc-1b05afe076ef-fast-ganfit-generative-adversarial-network-for-high-fidelity.md)
- [Climate-Invariant Machine Learning](https://refivu.com/en/papers/a2357949-b3f4-47c3-9eed-ea3620866405-climate-invariant-machine-learning.md)
- [The Heidelberg spiking datasets for the systematic evaluation of spiking neural networks](https://refivu.com/en/papers/7d72dab0-39a2-41ec-8bd7-e822a01c939b-the-heidelberg-spiking-datasets-for-the-systematic.md)
- [Addition by Subtraction: Toward Mitigating Fragile Safety Alignment in Large Language Models](https://refivu.com/en/papers/44f0690c-e102-492e-a470-457ce91ecf7e-addition-by-subtraction-toward-mitigating-fragile-safety.md)
- [Beyond Terminal Constraints: Reliable Robot Control with Learned Safe Sets](https://refivu.com/en/papers/0a0f5b84-ffd8-4183-98ce-8b6661b987ad-beyond-terminal-constraints-reliable-robot-control-with.md)

## Terms in this paper

- [Contrastive Loss](https://refivu.com/en/terms/53c787c4cf0e-contrastive-loss)
- [Federated learning](https://refivu.com/en/terms/c6fc55e6f812-federated-learning)
- [differential privacy](https://refivu.com/en/terms/7f2cc899605c-differential-privacy)
- [Euclidean distance](https://refivu.com/en/terms/d709f3cd41c0-euclidean-distance)
- [binary cross-entropy](https://refivu.com/en/terms/bbec6d1b6dde-binary-cross-entropy)
- [precision@1](https://refivu.com/en/terms/797c87524ca3-precision-1)
- [CheXpert](https://refivu.com/en/terms/1076ec04444b-chexpert)
- [Grad-CAM](https://refivu.com/en/terms/5779295a49fe-grad-cam)
- [mAP@R](https://refivu.com/en/terms/1dd4831e3491-map-r)
- [R-precision](https://refivu.com/en/terms/a3dfb9ebcf03-r-precision)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/e060b53c-8614-4bbb-8efd-bdb0cebc8fd4-deep-learning-based-patient-re-identification-is-able)
