Skip to page content
SAVRN
Search Plan a project

Open-weight model · Image classification

chest-xray-multilabel-classifier

by Samer Ahmed Samer17/chest-xray-multilabel-classifier

chest-xray-multilabel-classifier is an open-weight model for image classification from Samer Ahmed, released under MIT License. Its published files total 98.6 MB.

medical computer vision project using an ImageNet-pretrained ResNet-50 to classify 14 thoracic conditions from chest X-ray images.

Parameters—
Context—
Weights98.6 MB
Licensemit
AccessOpen weights
Monthly Downloads—

Model Card

By Samer Ahmed, published under mit, revision d6666889d1e6.

medical computer vision project using an ImageNet-pretrained ResNet-50 to classify 14 thoracic conditions from chest X-ray images. The model was trained on the NIH ChestX-ray14 dataset with patient-level data splitting, class-weighted binary cross-entropy, and experiment tracking through Weights & Biases. The model generates independent prediction scores for 14 thoracic conditions: Because this is a multi-label classification task, multiple conditions may be associated with the same X-ray. The model produces 14 logits, converted into scores using the sigmoid function. These scores are not clinically calibrated probabilities. The classifier uses an ImageNet-pretrained ResNet-50 backbone with…

Read Samer Ahmed's full model card

Multi-Label Chest X-Ray Classifier

ResNet-50 | PyTorch | NIH ChestX-ray14 | Grad-CAM

An end-to-end medical computer vision project using an ImageNet-pretrained ResNet-50 to classify 14 thoracic conditions from chest X-ray images. The model was trained on the NIH ChestX-ray14 dataset with patient-level data splitting, class-weighted binary cross-entropy, and experiment tracking through Weights & Biases.

Held-Out Test Mean ROC-AUC: 0.823

Live Interactive Demo | GitHub Repository

Model Overview

Property Description
Architecture ResNet-50 with custom classification head
Framework PyTorch
Initialization ImageNet-pretrained weights
Task Multi-label image classification
Dataset NIH ChestX-ray14
Dataset Size 112,120 images from 30,805 patients
Output Classes 14 thoracic conditions
Input Resolution 224 × 224
Loss Function Class-weighted BCEWithLogitsLoss
Optimizer Adam
Training Hardware NVIDIA Tesla T4
Test Mean ROC-AUC 0.823
Model Selection Best validation ROC-AUC, epoch 7

Supported Conditions

The model generates independent prediction scores for 14 thoracic conditions:

  1. Atelectasis
  2. Cardiomegaly
  3. Effusion
  4. Infiltration
  5. Mass
  6. Nodule
  7. Pneumonia
  8. Pneumothorax
  9. Consolidation
  10. Edema
  11. Emphysema
  12. Fibrosis
  13. Pleural Thickening
  14. Hernia

Because this is a multi-label classification task, multiple conditions may be associated with the same X-ray.

The model produces 14 logits, converted into scores using the sigmoid function. These scores are not clinically calibrated probabilities.

Model Architecture

The classifier uses an ImageNet-pretrained ResNet-50 backbone with a custom classification head.

Chest X-Ray (224 × 224 × 3)
             |
     ResNet-50 Backbone
             |
     2048-D Feature Vector
             |
       Linear(2048, 512)
             |
            ReLU
             |
        Dropout(0.3)
             |
        Linear(512, 14)
             |
       14 Output Logits
             |
     Sigmoid (Inference)
             |
     14 Prediction Scores

The model is implemented in PyTorch using the custom ChestXRayNet class.

Dataset and Preprocessing

The model was trained on the NIH ChestX-ray14 dataset, containing 112,120 frontal chest X-ray images from 30,805 patients.

Preprocessing includes:

  • RGB image conversion
  • Resizing to 224 × 224 pixels
  • ImageNet mean and standard deviation normalization
  • Training-time horizontal flipping, brightness/contrast adjustments, and geometric augmentation

Patient-Level Data Splitting

To prevent patient-level data leakage, the dataset was split by patient identifier rather than by individual image.

Split Images Patients
Training 78,566 21,563
Validation 17,063 4,621
Test 16,491 4,621
Total 112,120 30,805

The split uses a 70/15/15 patient-level allocation with random seed 42 and zero patient overlap across partitions.

Images labeled No Finding were retained as negative examples for all 14 conditions.

Training Methodology

Training was performed on Kaggle using an NVIDIA Tesla T4 GPU.

Hyperparameter Value
Epochs 10
Batch Size 32
Learning Rate 0.0001
Optimizer Adam
Loss Weighted BCEWithLogitsLoss
Input Size 224 × 224
Dropout 0.3
Checkpoint Selection Highest validation mean ROC-AUC

Class Imbalance Handling

The NIH ChestX-ray14 dataset contains substantial label imbalance, particularly for rare conditions such as Hernia and Pneumonia.

To address this, positive class weights were calculated from the training set:

positive_weight = negative_samples / positive_samples

These weights were incorporated into BCEWithLogitsLoss to increase the contribution of positive examples from underrepresented classes.

Training and validation metrics were tracked using Weights & Biases.

Evaluation Results

The best checkpoint was selected at epoch 7 using validation mean ROC-AUC.

  • Best Validation Mean ROC-AUC: 0.8315
  • Held-Out Test Mean ROC-AUC: 0.8225
  • Test Images: 16,491
  • Test Patients: 4,621

Per-Class Test ROC-AUC

Condition ROC-AUC
Atelectasis 0.7935
Cardiomegaly 0.8962
Effusion 0.8719
Infiltration 0.6960
Mass 0.8045
Nodule 0.7422
Pneumonia 0.7380
Pneumothorax 0.8775
Consolidation 0.7913
Edema 0.8926
Emphysema 0.9268
Fibrosis 0.7957
Pleural Thickening 0.7947
Hernia 0.8949
Mean 0.8225

ROC-AUC measures the model's ability to distinguish positive and negative examples across classification thresholds. It does not establish clinical diagnostic accuracy, calibration, sensitivity, or specificity at a particular operating threshold.

Model Inference

The trained model checkpoint is available in this repository as best_model.pth.

Inference requires the matching ChestXRayNet architecture and preprocessing pipeline.

For an interactive inference experience, visit the Hugging Face Space.

The deployed application allows users to:

  • Upload a chest X-ray image
  • Generate prediction scores for all 14 conditions
  • View conditions ranked by model score
  • Generate a Grad-CAM heatmap for the highest-scoring condition
  • Visualize the heatmap overlaid on the original image

Model Interpretability

Grad-CAM (Gradient-weighted Class Activation Mapping) is integrated into the model to visualize image regions contributing to a selected class output.

The implementation uses gradients and activations from the final ResNet-50 convolutional block to generate spatial heatmaps.

Grad-CAM visualizations are interpretability aids, not validated medical localization results. Highlighted regions do not necessarily correspond to clinically confirmed pathology.

Intended Use

This model is intended for:

  • Educational and research exploration of medical computer vision
  • Multi-label classification experimentation
  • Transfer learning and class imbalance studies
  • Model interpretability demonstrations
  • Machine learning engineering portfolio evaluation

Limitations and Ethical Considerations

  • The model was evaluated on a held-out partition of NIH ChestX-ray14, not an independent external clinical dataset.
  • NIH ChestX-ray14 labels are derived from radiology reports and may contain annotation noise.
  • Performance may vary across hospitals, imaging equipment, patient populations, and acquisition conditions.
  • Rare conditions have relatively few positive examples, limiting the stability of their performance estimates.
  • Model scores have not been clinically calibrated.
  • No prospective clinical evaluation or regulatory validation has been performed.
  • Grad-CAM heatmaps should not be interpreted as definitive pathology localization.
  • The model should not be used for diagnosis, treatment decisions, or autonomous medical screening.

This model is a research and educational prototype, not a clinically validated medical device.

Project Resources

Author

Samer Ahmed

Developed as a medical computer vision and deep learning engineering project.

Identity and Version

Repository
Samer17/chest-xray-multilabel-classifier
Publisher
Samer Ahmed
Task
Image classification
Modality
Image
Library
Not stated by the source
Parameters
Not stated by the source
Languages
en
Revision
d6666889d1e67aaa1e779107ca934f505b6906c1
First published
2026-10-04
Last updated
2026-10-09

Files and Weights

3 files, 98.6 MB in total. The weights are 1 file totalling 98.6 MB in pth.

Weights1 file · 98.6 MB
Documentation1 file · 7.9 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
best_model.pthWeights98.6 MB e2babff71d88
README.mdDocumentation7.9 KB —
.gitattributesRepository1.5 KB —

License and Download

License
mit
Access
Open weights, no gate
Download size
98.6 MB
Download from Samer Ahmed

Released by Samer Ahmed through its official repository on Hugging Face. Read the license.

Built From

  • Trained on (disclosed) timm/nih-chest-xray-14

Memory Requirements

PrecisionWeights in memory
As published98.6 MB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About chest-xray-multilabel-classifier

Can I use chest-xray-multilabel-classifier commercially?

Yes. chest-xray-multilabel-classifier is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.

Similar Models

Model · Image classification

swinv2-tiny-patch4-window16-256

Microsoft

Swin Transformer v2 model pre-trained on ImageNet-1k at resolution 256x256. It was introduced in the paper Swin Transformer V2: Scaling Up Capacity and Resolution by Liu et al. and first released in this repository. Disclaimer: The team releasing Swin Transformer v2 did not write a model card for this model so this model card has been written by the Hugging Face team. The Swin Transformer is a type of Vision Transformer. It builds hierarchical feature maps by merging image patches (shown in gray) in deeper layers and has linear computation complexity to input image size due to computation of self-attention only within each local window (shown in red). It can thus serve as a general-purpose…

Open weights apache-2.0 transformers

Model · Image classification

AI-image-detector

Matthew Maybe

NOTE: Unless you are trying to detect imagery generated using older models such as VQGAN+CLIP, please use the updated version of this detector instead. This model is a proof-of-concept demonstration of using a ViT model to predict whether an artistic image was generated using AI. It was created in October 2022, and as such, the training data did not include any samples generated by Midjourney 5, SDXL, or DALLE-3. It still may be able to correctly identify samples from these more recent models due to being trained on outputs of their predecessors. Furthermore the intended scope of this tool is artistic images; that is to say, it is not a deepfake photo detector, and general computer imagery…

Open weights cc-by-4.0 transformers

Measured on device (edge-compat): Raspberry Pi 5 · LiteRT 2.2.0.dev20260804 · CPU/XNNPACK, 4 threads · 34.1 ms p50 (2026-08-31); browser · Chromium 151 (2026-08-11). Record: https://github.com/john-rocky/edge-compat/blob/main/cards/plantnet-300k-resnet18/CARD.md On-device fine-grained plant species identification — 1081 species — running fully on the LiteRT CompiledModel GPU delegate (no CPU fallback). A PlantNet-300K (NeurIPS 2021) ResNet18. ~16 ms/frame on a Pixel 8a. (mean [0.485,0.456,0.406], std [0.229,0.224,0.225]; center-crop then resize 224). Labels: class index i maps to the i-th species when the PlantNet-300K species-id strings are sorted (torchvision ImageFolder order); names…

Open weights apache-2.0 litert

Model · Image classification

traffic-sign-adverse-weather

Yy

Official model checkpoints for the solution in the Traffic Sign Recognition under Adverse Weather Competition. See classes.txt for the 25 traffic sign classes. For inference scripts, training code, and in-depth engineering retrospective, visit the GitHub Repository.

Open weights mit timm

Model · Image classification

tinyvit-5m-int8-imagenet

Core Epoch

TinyViT-5M (timm/tinyvit5m224.distin22kftin1k, Apache-2.0) quantized to INT8 with Kenosis — 128-image calibration, no retraining. 80.53% top-1 from a 9.2 MB single file, on ONNX Runtime or OpenVINO, CPU or GPU, no accelerator required. ImageNet-1K validation, 49,872 images (disjoint from the 128 calibration images). Measured on a CPU with AVX-VNNI; on CPUs without VNNI this model's INT8 top-1 sits ~0.9 below FP32 rather than 0.34. Input 1x3x224x224, RGB, /255, ImageNet mean/std. Output logits [1,1000], sorted-synset order. runclassify.py / evalimagenet.py reproduce the demo and table. tinyvit5m224int8kenosis.onnx (9,228,567 B) — SHA-256…

Open weights apache-2.0 onnx