🚀 DenseNet121-Res224-RSNA
DenseNet121-Res224-RSNA是一种用于X光图像分类的卷积神经网络模型。DenseNet通过密集块(Dense Blocks)在各层之间建立密集连接,将所有特征图尺寸匹配的层直接相连。为保持前馈特性,每一层会接收前面所有层的输出作为额外输入,并将自己的特征图传递给后续所有层。
🚀 快速开始
模型使用说明
每个预训练模型有18个输出。all
模型的所有输出都经过训练,但对于其他权重,部分目标未经过训练,会因训练数据集中不存在这些目标而随机预测。唯一有效的输出列在对应权重数据集的{dataset}.pathologies
字段中。
模型的基准测试信息请参考:BENCHMARKS.md
代码示例
以下是使用该模型对X光图像进行分类的示例代码:
import urllib.request
import skimage
import torch
import torch.nn.functional as F
import torchvision
import torchvision.transforms
import torchxrayvision as xrv
model_name = "densenet121-res224-rsna"
img_url = "https://huggingface.co/spaces/torchxrayvision/torchxrayvision-classifier/resolve/main/16747_3_1.jpg"
img_path = "xray.jpg"
urllib.request.urlretrieve(img_url, img_path)
model = xrv.models.get_model(model_name, from_hf_hub=True)
img = skimage.io.imread(img_path)
img = xrv.datasets.normalize(img, 255)
if len(img.shape) > 2:
img = img[:, :, 0]
if len(img.shape) < 2:
print("error, dimension lower than 2 for image")
img = img[None, :, :]
transform = torchvision.transforms.Compose([xrv.datasets.XRayCenterCrop()])
img = transform(img)
with torch.no_grad():
img = torch.from_numpy(img).unsqueeze(0)
preds = model(img).cpu()
output = {
k: float(v)
for k, v in zip(xrv.datasets.default_pathologies, preds[0].detach().numpy())
}
print(output)
更多代码示例请参考:example scripts
📄 许可证
本项目采用Apache-2.0许可证。
📚 引用信息
主要的TorchXRayVision论文
Joseph Paul Cohen, Joseph D. Viviano, Paul Bertin, Paul Morrison, Parsa Torabian, Matteo Guarrera, Matthew P Lungren, Akshay Chaudhari, Rupert Brooks, Mohammad Hashir, Hadrien Bertrand
TorchXRayVision: A library of chest X-ray datasets and models.
https://github.com/mlmed/torchxrayvision, 2020
@article{Cohen2020xrv,
author = {Cohen, Joseph Paul and Viviano, Joseph D. and Bertin, Paul and Morrison, Paul and Torabian, Parsa and Guarrera, Matteo and Lungren, Matthew P and Chaudhari, Akshay and Brooks, Rupert and Hashir, Mohammad and Bertrand, Hadrien},
journal = {https://github.com/mlmed/torchxrayvision},
title = {{TorchXRayVision: A library of chest X-ray datasets and models}},
url = {https://github.com/mlmed/torchxrayvision},
year = {2020}
arxivId = {2111.00595},
}
发起该库开发的论文
Joseph Paul Cohen and Mohammad Hashir and Rupert Brooks and Hadrien Bertrand
On the limits of cross-domain generalization in automated X-ray prediction.
Medical Imaging with Deep Learning 2020 (Online: https://arxiv.org/abs/2002.02497)
@inproceedings{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},
booktitle={Medical Imaging with Deep Learning},
year={2020},
url={https://arxiv.org/abs/2002.02497}
}
📦 模型信息
属性 |
详情 |
模型类型 |
用于X光图像分类的DenseNet模型 |
训练数据 |
nih-pc-chex-mimic_ch-google-openi-rsna |