| Field | Value |
|---|---|
| Status | Research prototype |
| Maturity | Low |
| Field-ready | No — not clinical, not field-certified |
| Last reviewed | 2026-08-07 |
Archived NIH ChestX-ray14 training notebook. Research only — not for clinical use.
Archived — superseded by later work. Preserved for reference.
Research-grade implementation of multi-label chest X-ray pathology detection using EfficientNet-B4 on the full NIH ChestX-ray14 dataset (112,120 images) with official patient-level splits.
Version: 3.2
Developed by: FratresMedAI
Status: Critical fixes implemented, conservative performance expectations documented
Compatible with: RunPod PyTorch 2.8.0 (CUDA 12.8.1)
# Recommended template
runpod/pytorch:1.0.2-cu1281-torch280-ubuntu2404
# GPU requirements
- H200 (141GB VRAM) - recommended for batch_size=48
- H100 (80GB VRAM) - use batch_size=32
# Storage requirements
- Container disk: 200GB minimum (for full dataset)Upload ChestXRay_PD_GPU_v3.2_FIXED.ipynb to RunPod Jupyter environment.
Run cells sequentially:
| Cell | Description | Expected Time | Notes |
|---|---|---|---|
| 0 | Bootstrap | 3-5 minutes | Installs dependencies, no torch reinstall |
| 1 | Environment + Config | <1 minute | Initialize wandb here |
| 2 | Dataset Download | 60-90 minutes | All 12 zips with retry logic |
| 3 | Data Exploration | 2-3 minutes | Official splits verification |
| 4 | Dataset + Dataloaders | 1-2 minutes | CutMix before transforms |
| 5 | Model + Loss | 1-2 minutes | EfficientNet-B4 or timm backbones |
| 6 | Training Loop | 180-240 minutes | 50 epochs, early stopping |
| 7 | Temperature Scaling | 5-10 minutes | Calibration on validation set |
| 8 | Test Evaluation | 15-20 minutes | 5-fold TTA + bootstrapped CIs |
| 9 | Visualization | 2-3 minutes | 6-panel metrics plot |
| 10 | Final Summary | <1 minute | Artifact checklist |
Total runtime: 4-5 hours end-to-end
| Configuration | Expected Mean AUC | Notes | Reference |
|---|---|---|---|
| EfficientNet-B4 (default) | 0.805-0.820 | Baseline, well-executed | [1,2] |
| EfficientNet-B4 + Asymmetric Loss | 0.810-0.825 | Better for rare classes | [1,3] |
| ConvNeXt-Base + Asymmetric Loss | 0.830-0.845 | Publication-competitive | [4,5] |
| EfficientNetV2-M + Asymmetric Loss | 0.825-0.840 | Faster training | [2,6] |
- 0.805-0.820: Expected for EfficientNet-B4 (matches literature [1,2])
- 0.820-0.830: Strong result, above typical EfficientNet-B4
- 0.830-0.840: Very strong, competitive with best single models [4,5]
- 0.840+: Publication-worthy (requires ConvNeXt/CoAtNet or novel methods)
[1] Rajpurkar et al. (2017) "CheXNet: Radiologist-Level Pneumonia Detection on Chest X-Rays with Deep Learning" - Established baseline DenseNet-121 achieving 0.8094 mean AUC on ChestX-ray14
[2] Ucan (2025) "Comparison of EfficientNet CNN models for multi-label chest X-ray disease diagnosis" PeerJ Comput Sci - Mean AUC ~0.807-0.8265 for EfficientNet variants
[3] Ridnik et al. (2021) "Asymmetric Loss For Multi-Label Classification" (ICCV) - Demonstrates 2-3% AUC improvement on medical imaging tasks with extreme imbalance
[4] Liu et al. (2022) "A ConvNet for the 2020s" (CVPR) - ConvNeXt architecture achieving state-of-art on multiple vision benchmarks
[5] Xiong et al. (2025) "Multi-Label Disease Detection in Chest X-Ray Imaging Using a Fine-Tuned ConvNeXtV2" MDPI Informatics - Mean AUC 0.8523 on ChestXray14
[6] Tan & Le (2021) "EfficientNetV2: Smaller Models and Faster Training" (ICML) - 20-30% faster training than EfficientNet-B4 with comparable accuracy
Note: Results may vary ±0.005 AUC due to GPU non-determinism even with fixed seeds. For exact reproduction, document GPU model, driver version, and CUDA version.
In CELL 1, modify:
# For publication-competitive results
BACKBONE = 'convnext_base' # Instead of 'efficientnet_b4'
USE_TIMM = True # Enable timm library
LOSS_TYPE = 'hybrid_bce_asymmetric' # Better for extreme imbalance
BATCH_SIZE = 24 # ConvNeXt needs more VRAM, reduce if OOMExpected performance with ConvNeXt:
- Mean AUC: 0.830-0.845
- Hernia AUC: 0.75-0.84
- Training time: 240-300 minutes (larger model)
BACKBONE = 'efficientnetv2_m'
USE_TIMM = True
LOSS_TYPE = 'hybrid_bce_asymmetric'
BATCH_SIZE = 32Expected performance:
- Mean AUC: 0.825-0.840
- Training time: 150-200 minutes (faster than B4)
In CELL 1:
USE_AMP = True # Default: enabled for ~20-30% speedupAMP is already integrated in training loop (CELL 6) via torch.cuda.amp.autocast().
# H200 (141GB)
BATCH_SIZE = 48 # Safe for 336x336
GRAD_ACCUM_STEPS = 4 # Effective batch 192
# H100 (80GB)
BATCH_SIZE = 32 # Conservative for 336x336
GRAD_ACCUM_STEPS = 6 # Effective batch 192
# A100 (40GB) or OOM issues
BATCH_SIZE = 16
GRAD_ACCUM_STEPS = 12 # Effective batch 192- Get API key: https://wandb.ai/authorize
- In CELL 1, wandb.init() will prompt for key on first run
- Project name:
chestxray-efficientnet-v3.2
After training completes:
# Get wandb run URL
print(wandb.run.get_url())Share this URL for:
- Live training metrics
- Hyperparameter configuration
- Artifact downloads (models, predictions, plots)
# In CELL 1, comment out:
# wandb.init(...)If NIH Box.com throttles (common after 2-3 files):
# In CELL 2, before download section
!pip install kaggle
!mkdir -p ~/.kaggle
# Upload kaggle.json to ~/.kaggle/
!kaggle datasets download -d nih-chest-xrays/data
!unzip data.zip -d /workspace/data/images- Download from: https://nihcc.app.box.com/v/ChestXray-NIHCC
- Upload all 12 zips to
/workspace/data/ - Run extraction section of CELL 2
After CELL 5 (model creation), check VRAM usage:
# Quick VRAM test
import torch
dummy_batch = torch.randn(BATCH_SIZE, 3, INPUT_SIZE, INPUT_SIZE).to(DEVICE)
with torch.no_grad():
_ = model(dummy_batch)
peak_vram = torch.cuda.max_memory_allocated() / 1e9
print(f"Peak VRAM: {peak_vram:.1f} GB")
# Expected ranges:
# - Batch 32, 336x336: 30-35 GB (safe for H100)
# - Batch 48, 336x336: 40-45 GB (needs H200)
# - If >60 GB: reduce batch size1. Fixed Random Seed
# Already set in CELL 1
SEED = 42
torch.manual_seed(SEED)
torch.cuda.manual_seed_all(SEED)
np.random.seed(SEED)
random.seed(SEED)2. Deterministic Mode
# Already enabled in CELL 1
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = True
torch.use_deterministic_algorithms(True) # May reduce performance slightly3. Document Exact Environment
- GPU: H200 SXM (141GB) or H100 (80GB)
- CUDA: 12.8.1
- PyTorch: 2.8.0
- Driver: Document with
nvidia-smi - Container:
runpod/pytorch:1.0.2-cu1281-torch280-ubuntu2404
4. Expected Variability
- Results may vary ±0.005 AUC across runs due to:
- GPU non-determinism in some CUDA operations
- Floating-point precision differences
- CuDNN algorithm selection
5. Bit-Exact Reproduction For bit-exact reproduction (not recommended due to speed):
# Disable cudnn benchmark
torch.backends.cudnn.benchmark = False
# Use CPU (very slow)
DEVICE = torch.device('cpu')6. Save Run Metadata After training, document:
- Exact GPU model and driver version
- Final mean AUC and per-class AUCs
- Training time and number of epochs
- Wandb run URL for full hyperparameters
Configuration: EfficientNet-B4, Batch 32, Official Splits, Full Dataset
| Metric | Value | 95% CI Lower | 95% CI Upper | Notes |
|---|---|---|---|---|
| Mean AUC | TBD | TBD | TBD | Target: 0.805-0.820 |
| Atelectasis AUC | TBD | TBD | TBD | |
| Cardiomegaly AUC | TBD | TBD | TBD | |
| Effusion AUC | TBD | TBD | TBD | |
| Infiltration AUC | TBD | TBD | TBD | |
| Mass AUC | TBD | TBD | TBD | |
| Nodule AUC | TBD | TBD | TBD | |
| Pneumonia AUC | TBD | TBD | TBD | |
| Pneumothorax AUC | TBD | TBD | TBD | |
| Consolidation AUC | TBD | TBD | TBD | |
| Edema AUC | TBD | TBD | TBD | |
| Emphysema AUC | TBD | TBD | TBD | |
| Fibrosis AUC | TBD | TBD | TBD | |
| Pleural_Thickening AUC | TBD | TBD | TBD | |
| Hernia AUC | TBD | TBD | TBD | Target: 0.72-0.81 |
| Mean F1 | TBD | TBD | TBD | |
| Mean ECE | TBD | - | - | Target: <0.05 |
| Training Time | TBD | - | - | Expected: 180-240 min |
| Final Epoch | TBD | - | - | Max: 50 |
Environment:
- GPU: [Document after run]
- CUDA: [Document after run]
- Driver: [Document after run]
- Date: [Document after run]
- Wandb Run: [Insert URL after run]
Instructions: After completing your first training run, fill this table with actual results from test_metrics_v3.2.csv and update README for future reference.
All artifacts saved to /workspace/results/:
test_metrics_v3.2.csv- Per-class AUC, F1, precision, recall with 95% CIsoptimal_thresholds_v3.2.csv- Youden's J optimal thresholds per classtest_predictions_tta_v3.2.csv- TTA-averaged predictions + uncertaintiescomprehensive_metrics_v3.2.png- 6-panel visualization- Model checkpoint:
/workspace/models/best_model_v3.2.pth
# In CELL 1, reduce batch size
BATCH_SIZE = 16 # or 24
GRAD_ACCUM_STEPS = 12 # Keep effective batch ~192Use Kaggle CLI fallback (see Dataset Download Fallback section above).
# Manual login
import wandb
wandb.login(key='YOUR_API_KEY')# Enable cudnn benchmark (already in CELL 1)
torch.backends.cudnn.benchmark = True
# Or switch to EfficientNetV2 (faster)
BACKBONE = 'efficientnetv2_m'
USE_TIMM = TrueTHIS IS A RESEARCH TOOL, NOT A DIAGNOSTIC DEVICE.
- NOT FOR CLINICAL USE
- NOT FDA-APPROVED
- FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY
- NOT INTENDED FOR MEDICAL DIAGNOSIS OR TREATMENT DECISIONS
This implementation is provided for academic research and portfolio demonstration. Any clinical application requires extensive validation, regulatory approval, and clinical trials.
If using this notebook for research:
@misc{chestxray_v32_2026,
title={Multi-Label Chest X-Ray Pathology Detection with EfficientNet-B4},
author={FratresMedAI},
year={2026},
note={Implementation based on NIH ChestX-ray14 dataset with official patient-level splits}
}Dataset citation:
@article{wang2017chestxray,
title={ChestX-ray8: Hospital-scale chest x-ray database and benchmarks on weakly-supervised classification and localization of common thorax diseases},
author={Wang, Xiaosong and Peng, Yifan and Lu, Le and Lu, Zhiyong and Bagheri, Mohammadhadi and Summers, Ronald M},
journal={CVPR},
year={2017}
}- NIH ChestX-ray14: https://nihcc.app.box.com/v/ChestXray-NIHCC
- Official splits: https://github.com/zoogzog/chexnet
- EfficientNet-B4/B5 on ChestX-ray14: 0.805-0.818 mean AUC
- ConvNeXtV2 for medical imaging: 0.840-0.852 mean AUC
- Asymmetric Loss for extreme imbalance: CVPR 2025
runpod/pytorch:1.0.2-cu1281-torch280-ubuntu2404- PyTorch 2.8.0 + CUDA 12.8.1 + Ubuntu 24.04
Last Updated: March 16, 2026
Version: 3.2
Developed by: FratresMedAI
Maintainer: FratresMedAI