Contrastive Learning of Medical Visual Representations from Paired Images and Text

Yuhao Zhang, Hang Jiang, Yasuhide Miura, Christopher D Manning, Curtis LanglotzOpenReview 2020

Abstract

Learning visual representations of medical images is core to medical image understanding, but progress has been hindered by the scarcity of human annotations. Existing methods often rely on ImageNet pretraining, which is suboptimal for medical data, or rule-based label extraction from reports, which lacks accuracy and generalizability. We propose ConVIRT, an unsupervised strategy that learns medical visual representations by exploiting naturally occurring paired descriptive text. By pretraining image encoders with paired text data via a bidirectional contrastive objective, ConVIRT achieves domain-agnostic representations without additional expert input. Our method significantly outperforms strong baselines in classification and zero-shot retrieval tasks. Notably, ConVIRT requires only 10% of labeled training data to match or exceed the performance of ImageNet-initialized models, demonstrating exceptional data efficiency.

The Annotation Bottleneck in Medical Imaging

Medical image understanding is a high-stakes field where accurate diagnosis is critical. However, developing robust deep learning models is difficult due to the "annotation bottleneck." Expert radiologists are expensive and their time is limited, making the creation of large-scale labeled datasets—comparable to ImageNet for natural images—prohibitively difficult.

Historically, researchers have relied on three main strategies, each with significant drawbacks:

  1. ImageNet Transfer Learning: Models pretrained on natural images (e.g., cats, dogs) are fine-tuned on medical data. However, the visual characteristics of medical images are fundamentally different, requiring much finer-grained features than those learned from general-purpose datasets.
  2. Rule-based Labeling: Automated scripts extract labels from textual radiology reports. These rules are often brittle, fail to capture nuances, and do not generalize well across different clinical settings.
  3. Image-only Contrastive Learning: Methods like SimCLR or MoCo learn by comparing different views of the same image. In the medical domain, high inter-class similarity (where different pathologies look very similar) often causes these models to ignore subtle diagnostic features.

ConVIRT: Aligning Images with Semantic Reports

The proposed ConVIRT (Contrastive VIsual Representation Learning from Text) framework treats radiology reports not as a source of noisy labels, but as a semantic partner to the image. Instead of discarding the rich descriptive text, ConVIRT uses it to guide the image encoder toward clinically relevant features.

Examples of medical images paired with descriptive text used for contrastive pretraining.

The Architecture and Objective

ConVIRT utilizes a dual-encoder architecture: a ResNet50 for images and a ClinicalBERT for text. Both encoders project their outputs into a shared $d$-dimensional latent space through non-linear projection heads.

The core of the method is a bidirectional contrastive loss (InfoNCE). For any given batch of image-text pairs, the model is trained to maximize the cosine similarity between an image and its corresponding report while minimizing similarity with all other reports in the batch. This process is mirrored for the text-to-image direction. By aligning these modalities, the image encoder learns to capture visual features that radiologists deem important enough to document.

To ensure robustness, the authors employ stochastic data augmentations, including cropping, flipping, and affine transforms for images, and random sentence sampling for the textual reports.

Experimental Setup and Datasets

ConVIRT was pretrained on two large-scale datasets:

  • MIMIC-CXR: Approximately 217,000 chest radiograph image-text pairs.
  • Rhode Island Hospital Bone Dataset: Approximately 48,000 musculoskeletal image-text pairs.

The model's performance was evaluated across four major benchmarks: RSNA Pneumonia Detection, CheXpert, COVIDx, and MURA (bony abnormality detection). Additionally, a new zero-shot retrieval benchmark (CheXpert 8×200) was introduced to assess how well the model aligns text and images without task-specific fine-tuning.

Results: Superior Performance and Data Efficiency

ConVIRT demonstrated significant improvements over standard pretraining techniques across all evaluated tasks.

Classification Performance

On the RSNA pneumonia task using linear classification with only 1% of the training data, ConVIRT achieved an AUC of 90.7. This significantly outperformed ImageNet initialization (82.8) and image-only contrastive methods like MoCo v2 (86.6).

Extreme Data Efficiency

One of the most impactful findings is ConVIRT's data efficiency. In all four classification tasks, a ConVIRT-pretrained model using only 10% of the labeled training data achieved performance comparable to or better than a standard ImageNet-initialized model using 100% of the data. This suggests that ConVIRT can drastically reduce the need for expensive expert annotations.

Zero-Shot Retrieval

ConVIRT showed a massive lead in text-to-image retrieval. On the CheXpert retrieval task (Prec@5), ConVIRT scored 60.0, while the strongest baseline (Contrastive-Binary-Loss) achieved only 15.5. Saliency map analysis further confirmed that ConVIRT focuses on correct anatomical regions, such as lung bases for atelectasis, whereas ImageNet-based models often focus on irrelevant edges or artifacts.

Discussion and Future Directions

ConVIRT serves as a foundation for modern vision-language models in medicine, proving that the image-text contrastive recipe is highly effective even in specialized domains with high inter-class similarity. By using text as a semantic anchor, the model learns which subtle pixel variations are diagnostically significant.

While highly effective, the method relies on the availability of paired reports, which may not exist for all imaging modalities. Future work could explore scaling this approach to millions of pairs or comparing it against more recent localized contrastive methods that align specific image patches with individual words in a report.

Summary updated

BibTeX
@misc{zhang2020contrastive,
  author = {Yuhao Zhang and Hang Jiang and Yasuhide Miura and Christopher D Manning and Curtis Langlotz},
  title = {{Contrastive Learning of Medical Visual Representations from Paired Images and Text}},
  year = {2020},
  eprint = {2010.00747},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2010.00747},
  howpublished = {OpenReview},
}
Figure