← all repositories
mlmed/torchxrayvision

A standard library for chest X-rays that actually standardizes things

Medical imaging datasets are a metadata Tower of Babel; this library translates them into one API with pre-trained models attached.

1.2k stars Jupyter Notebook Domain AppsComputer VisionML Frameworks
torchxrayvision
Not currently ranked — collecting fresh signals.
star history

What it does

TorchXRayVision wraps a half-dozen public chest X-ray datasets (NIH, CheXpert, MIMIC, RSNA, PadChest, and others) behind a single Python interface with unified preprocessing. It ships pre-trained DenseNet and ResNet classifiers for 18 pathologies, plus autoencoders and a PSPNet segmentation model that can label 14 anatomical structures. The goal is to spare researchers from training from scratch on massive cohorts, and to let algorithm developers swap datasets with one line of code to test generalization.

The interesting bit

The library doesn’t just load images—it harmonizes messy metadata. Each dataset exposes .pathologies, .labels, and a .csv DataFrame with aligned fields like patientid, age_years, and sex_male. You can merge datasets, filter by view position, or deduplicate patients without writing custom parsers for each hospital’s CSV dialect. The README is admirably blunt that some model outputs are nonsense: models trained on specific datasets will “predict randomly” for pathologies they never saw.

Key highlights

  • Pre-trained weights available for multiple training sources (all, nih, chex, mimic, rsna, etc.) plus third-party baselines including Stanford’s official CheXpert model and a race-prediction model from Emory HITI lab
  • Autoencoder (ResNetAE) trained across PadChest, NIH, CheXpert, and MIMIC for representation learning
  • Anatomical segmentation with 14 classes including clavicles, lungs, heart, aorta, and spine
  • Dataset utilities: view filtering, per-patient deduplication, label realignment, and distributional shift construction via merge/subset operations
  • Benchmarks and performance numbers published in linked papers rather than invented in the README

Caveats

  • All current pre-trained classifiers use DenseNet121 at 224×224 or ResNet50 at 512×512; if you were hoping for newer architectures, keep waiting
  • The README truncates mid-sentence in the pathology masks section, suggesting documentation may be incomplete or lagging
  • Some models carry ethically fraught use cases (race prediction) that are included as baselines without discussion of appropriate use

Verdict

Worth a look if you’re doing medical imaging research and tired of reimplementing NIH’s CSV parser for the nth time. Skip it if you need real-time clinical deployment tools—this is a research convenience layer, not a regulated diagnostic system.

Frequently asked

What is mlmed/torchxrayvision?
Medical imaging datasets are a metadata Tower of Babel; this library translates them into one API with pre-trained models attached.
Is torchxrayvision open source?
Yes — mlmed/torchxrayvision is open source, released under the Apache-2.0 license.
What language is torchxrayvision written in?
mlmed/torchxrayvision is primarily written in Jupyter Notebook.
How popular is torchxrayvision?
mlmed/torchxrayvision has 1.2k stars on GitHub.
Where can I find torchxrayvision?
mlmed/torchxrayvision is on GitHub at https://github.com/mlmed/torchxrayvision.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.