NIH ChestX-ray14 multi-label classifiers
Multi-label classifiers for the 14 ChestX-ray14 pathologies, trained on the official patient-wise split (75,312 train_val / 25,596 test) so results are comparable with the published benchmark table.
Models
| file | architecture | resolution | val AUROC |
|---|---|---|---|
densenet121_wbce_asl_medical_320.pt |
densenet121 | 320px | 0.8414 |
swin_t_wbce_asl_medical_320.pt |
swin_t | 320px | 0.8395 |
Test results (official split, patient-level bootstrap)
| model | mean AUROC | 95% CI | mean AUPRC |
|---|---|---|---|
| densenet121_wbce_asl_medical_320 | 0.8106 | 0.8036-0.8167 | 0.2855 |
| swin_t_wbce_asl_medical_320 | 0.8184 | 0.8127-0.8236 | 0.2818 |
Training setup
- Loss: weighted BCE combined with Asymmetric Loss (gamma_neg=4, gamma_pos=0, clip=0.05); the label matrix is ~94.8% negative.
- Augmentation: rotation +/-12 deg, translation +/-8%, scale 0.92-1.08, shear +/-5 deg, brightness/contrast +/-12%. Horizontal flip is deliberately excluded: mirroring a chest radiograph produces anatomically invalid images (dextrocardia) and measurably degraded laterality-dependent findings.
- Optimiser: AdamW, cosine schedule with warmup, discriminative LR (head at 10x backbone).
- Selection: early stopping on validation macro AUROC.
Labels
[
"Atelectasis",
"Cardiomegaly",
"Consolidation",
"Edema",
"Effusion",
"Emphysema",
"Fibrosis",
"Hernia",
"Infiltration",
"Mass",
"Nodule",
"Pleural_Thickening",
"Pneumonia",
"Pneumothorax"
]
Usage
import torch, torchvision.models as tvm, torch.nn as nn
from huggingface_hub import hf_hub_download
p = hf_hub_download("Yzaza/nih-cxr-models", "swin_t_320.pt")
ck = torch.load(p, map_location="cpu", weights_only=False)
m = tvm.swin_t(weights=None)
m.head = nn.Linear(m.head.in_features, 14)
m.load_state_dict(ck["model"]); m.eval()
# preprocess: grayscale -> 3ch, resize to ck["crop"], ImageNet normalisation
Intended use
Research demonstration only. Trained on NLP-mined labels with a documented error rate; not a medical device and not validated for clinical use.
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support