🚀 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 |