Cura: Chest X-Ray Pathology Detection Ensemble

An ensemble of three fine-tuned CNNs for multi-label classification of 14 chest pathologies from frontal chest X-rays.

Model Description

Cura is an end-to-end medical imaging pipeline that performs automated analysis of chest X-rays. This repository contains the three-model ensemble (DenseNet121 + DenseNet169 + ConvNeXt-Tiny) that achieved mean AUC of 0.8539 on the resized NIH ChestX-ray14 test set images (224x224), surpassing the original CheXNet paper (0.841).

Performance

Ensemble Results (NIH ChestX-ray14 Test Set)

Disease AUC F1 (optimal threshold)
Atelectasis 0.8255 0.4323
Cardiomegaly 0.9067 0.3931
Effusion 0.8906 0.5815
Infiltration 0.7191 0.4156
Mass 0.8659 0.4295
Nodule 0.7784 0.3342
Pneumonia 0.7812 0.1053
Pleural Thickening 0.8256 0.2381
Pneumothorax 0.8687 0.3591
Consolidation 0.8065 0.2417
Edema 0.8870 0.2691
Emphysema 0.9218 0.4953
Fibrosis 0.8201 0.1787
Hernia 0.9127 0.6207
Mean 0.8539 โ€”

Architecture Comparison

Architecture Mean AUC
ConvNeXt-Tiny 0.8449
DenseNet121 0.8435
DenseNet169 0.8414
ResNet50 0.8368
EfficientNet-B0 0.8291
3-model ensemble 0.8539
CheXNet (2017) 0.841

Training Details

  • Dataset: NIH ChestX-ray14 โ€” 83,703 images (224ร—224)
  • Split: Patient-aware (24,644 train / 3,080 val / 3,081 test patients)
  • Loss: AsymmetricLoss (gamma_neg=4, gamma_pos=1, clip=0.05)
  • Optimizer: AdamW (lr=1e-4, weight_decay=1e-4)
  • Scheduler: CosineAnnealingLR (T_max=20, eta_min=1e-6)
  • Batch size: 32 (DenseNet121, ResNet50, EfficientNet-B0)
  • Batch size: 64 (DenseNet169, ConvNeXt-Tiny)
  • Normalization: Dataset-specific (mean=0.4967, std=0.2478)
  • Augmentation: RandomRotation(7ยฐ), RandomAffine(translate=0.08), ColorJitter(brightness=0.1, contrast=0.1)
  • Training platform: Kaggle (single NVIDIA T4 GPU, AMP enabled)

Disease Labels

DISEASES = [
    'Atelectasis', 'Cardiomegaly', 'Effusion', 'Infiltration',
    'Mass', 'Nodule', 'Pneumonia', 'Pleural_Thickening',
    'Pneumothorax', 'Consolidation', 'Edema', 'Emphysema',
    'Fibrosis', 'Hernia'
]

Usage

from safetensors.torch import load_file
from huggingface_hub import hf_hub_download
import torch
import torchvision.models as models

REPO_ID = "mjrq/cura-chest-xray"

def load_model(architecture, device):
    path = hf_hub_download(repo_id=REPO_ID, 
                           filename=f"{architecture}_best.safetensors")
    
    if architecture == 'densenet121':
        model = models.densenet121(weights=None)
        model.classifier = torch.nn.Sequential(
            torch.nn.Dropout(0.2),
            torch.nn.Linear(model.classifier.in_features, 14)
        )
    elif architecture == 'densenet169':
        model = models.densenet169(weights=None)
        model.classifier = torch.nn.Sequential(
            torch.nn.Dropout(0.2),
            torch.nn.Linear(model.classifier.in_features, 14)
        )
    elif architecture == 'convnext_tiny':
        model = models.convnext_tiny(weights=None)
        model.classifier[2] = torch.nn.Sequential(
            torch.nn.Dropout(0.2),
            torch.nn.Linear(model.classifier[2].in_features, 14)
        )
    
    state_dict = load_file(path, device=str(device))
    model.load_state_dict(state_dict)
    model.eval()
    return model.to(device)

Intended Use

This model is intended as a clinical decision support tool. It is meant to be an aid to radiologists, not a replacement. It should not be used as the sole basis for clinical decisions.

Limitations

  • Trained on resized NIH ChestX-ray14. Performance may vary on images from different equipment, populations, or imaging protocols.
  • Label noise in NIH dataset (~10-20% estimated error rate) limits achievable F1 scores.
  • Not validated on non-US patient populations.

Known Limitations by Disease

  • Infiltration (AUC 0.72): Lowest performing disease due to non-specific, diffuse appearance overlapping with many conditions.
  • Pneumonia (F1 0.11): Poor F1 despite reasonable AUC which reflects severe class imbalance and label noise in NIH dataset.

Citation

If you use this model, please cite:

@software{cura2026,
  author = {mjrq},
  title = {Cura: An AI-Powered Application for Chest X-Ray Analysis},
  year = {2026},
  url = {https://github.com/mjrq/Cura}
}

References

  • Rajpurkar et al. (2017). CheXNet. arXiv:1711.05225
  • Wang et al. (2017). ChestX-ray8. CVPR 2017
  • Ridnik et al. (2021). Asymmetric Loss. ICCV 2021
  • Cohen et al. (2022). TorchXRayVision. MIDL 2022
  • Resized Dataset: Kaggle โ€” NIH Chest X-ray 14 (224x224 resized)
Downloads last month
83
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Space using mjrq/cura-chest-xray 1

Paper for mjrq/cura-chest-xray