A small example package
Project description
torchxrayvision
A library for chest X-ray datasets and models. Including pre-trainined models.
This code is still under development
Getting started
pip install torchxrayvision
import torchxrayvision as xrv
These are default pathologies:
xrv.datasets.default_pathologies
['Atelectasis',
'Consolidation',
'Infiltration',
'Pneumothorax',
'Edema',
'Emphysema',
'Fibrosis',
'Effusion',
'Pneumonia',
'Pleural_Thickening',
'Cardiomegaly',
'Nodule',
'Mass',
'Hernia',
'Lung Lesion',
'Fracture',
'Lung Opacity',
'Enlarged Cardiomediastinum']
models
Specify weights for pretrained models (currently all DenseNet121)
model = xrv.models.DenseNet(weights="all")
model = xrv.models.DenseNet(weights="kaggle")
model = xrv.models.DenseNet(weights="nih")
model = xrv.models.DenseNet(weights="chex")
model = xrv.models.DenseNet(weights="minix_nb")
model = xrv.models.DenseNet(weights="minix_ch")
datasets
transform = torchvision.transforms.Compose([xrv.datasets.XRayCenterCrop(),
xrv.datasets.XRayResizer(224)])
d_kaggle = xrv.datasets.Kaggle_Dataset(imgpath="path to stage_2_train_images_jpg",
transform=transform)
d_chex = xrv.datasets.CheX_Dataset(imgpath="path to CheXpert-v1.0-small",
csvpath="path to CheXpert-v1.0-small/train.csv",
transform=transform)
d_nih = xrv.datasets.NIH_Dataset(imgpath="path to NIH images")
d_nih2 = xrv.datasets.NIH_Google_Dataset(imgpath="path to NIH images")
d_pc = xrv.datasets.PC_Dataset(imgpath="path to image folder")
d_covid19 = xrv.datasets.COVID19_Dataset() # specify imgpath and csvpath for the dataset
dataset tools
relabel_dataset will align labels to have the same order as the pathologies argument.
xrv.datasets.relabel_dataset(xrv.datasets.default_pathologies , d_nih) # has side effects
Citation
Joseph Paul Cohen, Joseph Viviano, Mohammad Hashir, and Hadrien Bertrand.
TorchXrayVision: A library of chest X-ray datasets and models.
https://github.com/mlmed/torchxrayvision, 2020
and
Cohen, J. P., Hashir, M., Brooks, R., & Bertrand, H.
On the limits of cross-domain generalization in automated X-ray prediction. 2020
arXiv preprint [https://arxiv.org/abs/2002.02497](https://arxiv.org/abs/2002.02497)
@article{cohen2020limits,
title={On the limits of cross-domain generalization in automated X-ray prediction},
author={Cohen, Joseph Paul and Hashir, Mohammad and Brooks, Rupert and Bertrand, Hadrien},
journal={arXiv preprint arXiv:2002.02497},
year={2020}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torchxrayvision-0.0.4.tar.gz.
File metadata
- Download URL: torchxrayvision-0.0.4.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8593efe8c5d6754852f3f049ebeaac1ed4f98476bdfd3e05d6c9a73774a84410
|
|
| MD5 |
beba641b87bb7cab11f4a1023330b84d
|
|
| BLAKE2b-256 |
2e00d7cf0d878552d23db2cae8ee68420c2c4410ec5b8738ab1d24453d04fad6
|
File details
Details for the file torchxrayvision-0.0.4-py3-none-any.whl.
File metadata
- Download URL: torchxrayvision-0.0.4-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f43151ce6bfb1ed0cd3e0b1a2ebcbe0c15ebe16af1954c5f1100bba8d00cfee9
|
|
| MD5 |
0cbf770d1d30fa0e870ba3cfd2e1db39
|
|
| BLAKE2b-256 |
c2bb28ce89898a126342f3b7570027fa77f2c86fc6118d82623442ef9b87a28a
|