m42-health/CXformer-base

Model

2

stars

15

commits

2

repos using this model

1

linked in READMEs

May 11, 2025

updated

dinov2_with_registers
endpoints_compatible
image-feature-extraction
safetensors
transformers

README

Model Card for CXformer

CXformer is a vision transformer tailored for chest X-ray analysis, adapted from DINOv2 with clinically motivated training modifications. This repository provides code for pretraining CXformer using our optimized pipeline, as well as scripts for finetuning on downstream tasks like classification, segmentation, and report generation. For more details on pre-training, please checkout our paper accepted at MIDL 2025.

Key highlights:

CXformer Architecture

Pretrain Dataset

CXformer was pretrained on publicly available datasets, focusing on frontal views of chest X-rays (PA/AP):

  • CheXpert
  • MIMIC-CXR
  • PadChest
  • NIH-CXR8
  • BRAX

The official training splits were used for CheXpert, MIMIC and NIH, and all available samples in BRAX and PadChest were used in pretraining.

Downstream Tasks

TaskDataset(s)
Image ClassificationCheXpert, NIH-CXR8, RSNA, VinDr
SegmentationCheXmask
Report GenerationMIMIC-CXR, IU-Xray

Usage

from transformers import AutoModel, AutoImageProcessor
from PIL import Image

model_name = "m42-health/CXformer-base"

image_processor = AutoImageProcessor.from_pretrained(model_name,trust_remote_code=True)
model = AutoModel.from_pretrained(model_name)

model.eval()

image = Image.open('sample_cxr.png')

image = image_processor(image, return_tensors='pt')
print(image['pixel_values'].shape) # [1,3,518,518]

print("Doing forwardpass...")
output = model(**image).last_hidden_state  # [1, 1374, 768]

Results Summary

Classification (AUROC)

ModelCheXpertRSNANIH-CXR8Avg.
CXformer(S)83.3491.1383.6886.05
CXformer(B)86.8091.7185.2887.93

Segmentation (Dice Score)

ModelLungsHeartAvg.
CXformer(S)91.6989.3590.52
CXformer(B)91.9489.9490.94

Report Generation (MIMIC-CXR)

ModelROUGE-LBLEU-4RGERF1-14Avg.
CXformer(S)25.259.1123.0633.8527.51
CXformer(B)24.939.0322.9433.4527.16

Disclaimer

CXformer is intended exclusively for research purposes. It is not validated for clinical decision-making, nor is it approved for use in healthcare environments. The model should not be used for any diagnostic or therapeutic applications in a clinical setting.

License

This project is licensed under CC BY-NC-4.0

Citation

@inproceedings{al2025empirical,
  title={Empirical Analysis of Scaling Vision Foundation Models for Chest X-rays},
  author={Al Mahrooqi, Ahmed and Munjal, Prateek and Rajan, Ronnie and Pimentel, Marco AF and Kanithi, Praveenkumar},
  booktitle={Medical Imaging with Deep Learning},
  year={2025}
}

Contributors

ahmed1996said

9 commits

pkanithi

3 commits

PrateekMunjal

3 commits

m42-health/CXformer-base

Model

2

stars

15

commits

2

repos using this model

1

linked in READMEs

May 11, 2025

updated

dinov2_with_registers
endpoints_compatible
image-feature-extraction
safetensors
transformers

README

Model Card for CXformer

CXformer is a vision transformer tailored for chest X-ray analysis, adapted from DINOv2 with clinically motivated training modifications. This repository provides code for pretraining CXformer using our optimized pipeline, as well as scripts for finetuning on downstream tasks like classification, segmentation, and report generation. For more details on pre-training, please checkout our paper accepted at MIDL 2025.

Key highlights:

CXformer Architecture

Pretrain Dataset

CXformer was pretrained on publicly available datasets, focusing on frontal views of chest X-rays (PA/AP):

  • CheXpert
  • MIMIC-CXR
  • PadChest
  • NIH-CXR8
  • BRAX

The official training splits were used for CheXpert, MIMIC and NIH, and all available samples in BRAX and PadChest were used in pretraining.

Downstream Tasks

TaskDataset(s)
Image ClassificationCheXpert, NIH-CXR8, RSNA, VinDr
SegmentationCheXmask
Report GenerationMIMIC-CXR, IU-Xray

Usage

from transformers import AutoModel, AutoImageProcessor
from PIL import Image

model_name = "m42-health/CXformer-base"

image_processor = AutoImageProcessor.from_pretrained(model_name,trust_remote_code=True)
model = AutoModel.from_pretrained(model_name)

model.eval()

image = Image.open('sample_cxr.png')

image = image_processor(image, return_tensors='pt')
print(image['pixel_values'].shape) # [1,3,518,518]

print("Doing forwardpass...")
output = model(**image).last_hidden_state  # [1, 1374, 768]

Results Summary

Classification (AUROC)

ModelCheXpertRSNANIH-CXR8Avg.
CXformer(S)83.3491.1383.6886.05
CXformer(B)86.8091.7185.2887.93

Segmentation (Dice Score)

ModelLungsHeartAvg.
CXformer(S)91.6989.3590.52
CXformer(B)91.9489.9490.94

Report Generation (MIMIC-CXR)

ModelROUGE-LBLEU-4RGERF1-14Avg.
CXformer(S)25.259.1123.0633.8527.51
CXformer(B)24.939.0322.9433.4527.16

Disclaimer

CXformer is intended exclusively for research purposes. It is not validated for clinical decision-making, nor is it approved for use in healthcare environments. The model should not be used for any diagnostic or therapeutic applications in a clinical setting.

License

This project is licensed under CC BY-NC-4.0

Citation

@inproceedings{al2025empirical,
  title={Empirical Analysis of Scaling Vision Foundation Models for Chest X-rays},
  author={Al Mahrooqi, Ahmed and Munjal, Prateek and Rajan, Ronnie and Pimentel, Marco AF and Kanithi, Praveenkumar},
  booktitle={Medical Imaging with Deep Learning},
  year={2025}
}

Contributors

ahmed1996said

9 commits

pkanithi

3 commits

PrateekMunjal

3 commits