torchxrayvision
TorchXRayVision: A library of chest X-ray datasets and models
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has low install friction, carries permissive licensing, and directly solves a real problem in medical imaging research—standardizing access to multiple chest X-ray datasets and providing production-ready pre-trained models. It is well-suited for researchers and practitioners working with chest radiographs who want to avoid redundant model training and dataset engineering.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction install via wheel distribution.
- Active maintenance with recent release (47 days ago) and steady repository activity.
- Depends on torch, torchvision, and standard scientific Python stack (numpy, pandas, scikit-image, pillow, imageio), all widely available.
License · maintenance · safety
permissive license (permissive) — Permissive Apache license allows commercial and private use without restriction, making it suitable for both research and production medical imaging applications.
last release 2026-06-28 (47 days) · last repo commit 2026-08-01 · 1,183 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 78,708 downloads/mo, #14,417 on PyPI
Alternatives
Verify before relying
pip install torchxrayvision
import torchxrayvision as xrv
import torch, torchvision, skimage.io
img = skimage.io.imread("xray.jpg")
img = xrv.datasets.normalize(img, 255)
img = img.mean(2)[None, ...]
transform = torchvision.transforms.Compose([xrv.datasets.XRayCenterCrop(), xrv.datasets.XRayResizer(224)])
img = transform(img)
img = torch.from_numpy(img)
model = xrv.models.DenseNet(weights="densenet121-res224-all")
outputs = model(img[None,...])- Whether pre-trained model weights are automatically downloaded on first use or require manual setup
- Memory and compute requirements for inference on typical hardware
- Performance benchmarks against other medical imaging frameworks
What it is and what it does
TorchXRayVision is a PyTorch-based library for working with chest X-ray datasets and pre-trained deep learning models. It addresses two core problems in medical imaging research: avoiding redundant model training by providing models trained on large clinical cohorts, and standardizing dataset access so researchers can swap between multiple public chest X-ray datasets with a single line of code. The library includes DenseNet and ResNet models trained on datasets like NIH ChestX-ray8, CheXpert, MIMIC-CXR, and others, capable of detecting pathologies such as pneumonia, atelectasis, consolidation, and fractures.
The package wraps torch, torchvision, scikit-image, and image I/O libraries to provide dataset loaders, image preprocessing (normalization, cropping, resizing), and model inference. It also includes autoencoders for representation learning and segmentation models for anatomical landmark detection. Researchers can use pre-trained weights as baselines for rapid analysis or as feature extractors for few-shot learning tasks.
Use it for
- Rapidly screen large cohorts of chest X-rays for pathology detection using pre-trained models without training from scratch
- Extract learned features from X-ray images for downstream machine learning tasks or few-shot learning scenarios
- Evaluate and compare new algorithms across multiple public chest X-ray datasets in a standardized way
- Build anatomical segmentation pipelines to identify specific chest structures for clinical analysis
- Prototype medical imaging research without managing dataset preprocessing and model weight distribution
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has low install friction, carries permissive licensing, and directly solves a real problem in medical imaging research—standardizing access to multiple chest X-ray datasets and providing production-ready pre-trained models. It is well-suited for researchers and practitioners working with chest radiographs who want to avoid redundant model training and dataset engineering.
Install
torchxrayvision on PyPI
Before you install
Low friction install via wheel distribution. Active maintenance with recent release (47 days ago) and steady repository activity. Depends on torch, torchvision, and standard scientific Python stack (numpy, pandas, scikit-image, pillow, imageio), all widely available.
License in practice
Permissive Apache license allows commercial and private use without restriction, making it suitable for both research and production medical imaging applications.
Quickstart
pip install torchxrayvision
import torchxrayvision as xrv
import torch, torchvision, skimage.io
img = skimage.io.imread("xray.jpg")
img = xrv.datasets.normalize(img, 255)
img = img.mean(2)[None, ...]
transform = torchvision.transforms.Compose([xrv.datasets.XRayCenterCrop(), xrv.datasets.XRayResizer(224)])
img = transform(img)
img = torch.from_numpy(img)
model = xrv.models.DenseNet(weights="densenet121-res224-all")
outputs = model(img[None,...])
Verify before relying
- Whether pre-trained model weights are automatically downloaded on first use or require manual setup
- Memory and compute requirements for inference on typical hardware
- Performance benchmarks against other medical imaging frameworks
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 9 packagestorchtorchvisionscikit-imagetqdmnumpypandasrequestspillowimageio |
| Maintenance | Actively maintained 47 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 78,708 / month, #14,417 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: Medical Science Apps. |
Evidence: torchxrayvision-1.5.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “chest x-ray deep learning”
- torchxrayvisionTorchXRayVision provides pre-trained deep learning models and unified…
- xraydbXrayDB provides a Python interface to a SQLite database of X-ray…
- opentelemetry-propagator-aws-xrayInjects and extracts AWS X-Ray tracing context into OpenTelemetry…
Give your agent the search over MCP, or paste the wish link into any chat.
More Medical Science Apps. packages
Client library for the Firecrawl API that scrapes, crawls, and searches the web, returning clean Markdown or structured data; also indexes research papers from PubMed, bioRxiv, medRxiv, and arXiv.
Pydicom reads, modifies, and writes DICOM medical imaging files in pure Python, with optional NumPy support for pixel data as arrays.
Install it if you work with medical imaging data, DICOM files, or healthcare IT systems.
PubChemPy is a Python wrapper around the PubChem REST API that lets you search for chemical compounds by name, substructure, or similarity, retrieve their properties, and convert between chemical file formats.
Install it if you need programmatic access to PubChem data.
VTK is a 3D graphics, image processing, and visualization toolkit that provides algorithms for surface reconstruction, volume rendering, and advanced rendering techniques.
PyHMMER provides Python bindings to HMMER3, a biological sequence analysis tool that uses profile hidden Markov models to search for sequence homologs in protein or DNA databases.
A Python SDK for web scraping, crawling, searching, and extracting structured data from websites and research papers via the Firecrawl API, returning results as clean Markdown, HTML, or typed objects.
See also torchgeo · torchvision · efficientnet-pytorch · timm · pytorchcv · segmentation-models-pytorch · TotalSegmentator · monai · torchtext · hl7