Counterfactual contrastive learning: robust representations via causal image synthesis

Melanie Roschewitz, Fabio De Sousa Ribeiro, Tian Xia, Galvin Khara, Ben Glocker
3/14/2024
cs.CVcs.AI

No official code found. Best implementation: biomedia-mira/counterfactual-contrastive (24 stars, MIT, last commit 2025-06-16).

Abstract

Contrastive pretraining is well-known to improve downstream task performance and model generalisation, especially in limited label settings. However, it is sensitive to the choice of augmentation pipeline. Positive pairs should preserve semantic information while destroying domain-specific information. Standard augmentation pipelines emulate domain-specific changes with pre-defined photometric transformations, but what if we could simulate realistic domain changes instead? In this work, we show how to utilise recent progress in counterfactual image generation to this effect. We propose CF-SimCLR, a counterfactual contrastive learning approach which leverages approximate counterfactual inference for positive pair creation. Comprehensive evaluation across five datasets, on chest radiography and mammography, demonstrates that CF-SimCLR substantially improves robustness to acquisition shift with higher downstream performance on both in- and out-of-distribution data, particularly for domains which are under-represented during training.

View on arXivView PDF

Code Implementations(1)

MIT

Code for the paper "Robust representations for image classification via counterfactual contrastive learning" (Medical Image Analysis) and "Counterfactual contrastive learning: robust representations via causal image synthesis" (MICCAI Data Engineering Workshop)

243Python, Jupyter NotebookFeb 16, 20241 years agoMIT
classificationcontrastive-learningcounterfactualcounterfactual-contrastive-learningdinov2+3 more

Similar Papers

Cite this paper

@article{roschewitz2024counterfactual,
  title  = {Counterfactual contrastive learning: robust representations via causal image synthesis},
  author = {Melanie Roschewitz and Fabio De Sousa Ribeiro and Tian Xia and Galvin Khara and Ben Glocker},
  year   = {2024},
  eprint = {2403.09605},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.09605v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2403.09605.svg)](https://codeofpaper.com/paper/2403.09605)

Discussion