--- id: torchxrayvision version: "1.5.2" license: unclear license_treatment: permissive maintenance: active --- # torchxrayvision — TorchXRayVision: A library of chest X-ray datasets and models License: permissive · Maintenance: active · Downloads: 78.7K/mo ## 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 above — verify before relying. TorchXRayVision provides pre-trained deep learning models and unified dataset interfaces for chest X-ray analysis, enabling rapid classification and feature extraction on medical imaging data. 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 pip install torchxrayvision uv add torchxrayvision poetry add torchxrayvision ## Installing torchxrayvision 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: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 78.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags chest x-ray deep learning, medical image classification pytorch, pretrained radiology models, x-ray dataset loader, chest pathology detection, medical imaging feature extraction, radiograph analysis models, medical-imaging, deep-learning, radiology [View on SkillFed](https://skillfed.io/packages/torchxrayvision) · [View on PyPI](https://pypi.org/project/torchxrayvision/)