Downloads · 30 days
0
Kashif-Mahmood007/chestx6-ssl-checkpoints
chestx6-ssl-checkpoints is a image classification model from Kashif-Mahmood007. Use it when you need a label for an image. It is set up for pytorch. The card lists the license as mit.
This repository hosts the pretrained and fine-tuned model checkpoints accompanying the manuscript:
Downloads · 30 days
0
Access
Public
Updated Oct 10, 2026
Repo size
6.9 GB
Likes
0
Public
Click a slice to open those files.
.pt6.4 GB · 93%
From the Hugging Face model README
This repository hosts the pretrained and fine-tuned model checkpoints accompanying the manuscript:
"A Deployment Risk Score Framework for Self-Supervised Chest X-Ray Classification: Calibrated Multi-Objective Evaluation Under Annotation Scarcity and Distribution Shift"
Authors: Kashif Mahmood, Romana Aziz, Muhammad Ramzan, Mahwish Ilyas, and Ala Saleh Alluhaidan
Research use only. These models are not medical devices, have not been validated for clinical use, and must not be used to inform diagnosis or treatment.
The checkpoints correspond to the experiments performed on the ChestX6 dataset and include:
ssl_trainonly_data/), used for the evaluation-independence sensitivity analysisModels are provided for 10%, 20%, and 100% labeled-data settings with three random seeds (42, 123, 456) for each configuration. SimCLR and MAE were each pretrained once; only fine-tuning was repeated across seeds.
| Model | Pretraining | Folder |
|---|---|---|
| ResNet50 (Scratch) | None | supervised/ |
| ResNet50 (ImageNet) | Supervised ImageNet | supervised/ |
| EfficientNet-B0 | Supervised ImageNet | supervised/ |
| MobileViT-XS | Supervised ImageNet | supervised/ |
| ViT-S/16 (Scratch) | None (architecture-matched control for MAE) | supervised/ |
| SimCLR + ResNet50 | Contrastive SSL (ChestX6) | finetuned/ (encoder in ssl/; training-partition-only encoder in ssl_trainonly_data/) |
| MAE + ViT-S/16 | MAE-style SSL (ChestX6); only the patch-embedding layer was pretrained | finetuned/ (encoder in ssl/; training-partition-only encoder in ssl_trainonly_data/) |
What the "MAE" checkpoints contain. In the pretraining code used for the paper the visible patch embeddings were passed directly to the decoder, so the ViT's transformer blocks, class token, positional embedding and final norm were not part of the pretraining forward pass and were not updated. The
mae_vits16checkpoints therefore have a pretrained patch-embedding layer and randomly initialised transformer blocks, as invit_s16_scratch. They do not represent masked-reconstruction pretraining of a full ViT encoder. A corrected implementation (not used for the paper's results) is in the GitHub repository underscripts/. For SimCLR, the NT-Xent loss was computed inside micro-batches of 64 images (126 negatives per anchor), not over the effective batch of 256.
supervised/
ResNet50 (Scratch)
ResNet50 (ImageNet)
EfficientNet-B0
MobileViT-XS
ViT-S/16 (Scratch)
ssl/
SimCLR pretrained encoder (.pth)
MAE-style pretrained encoder (.pth; patch-embedding layer pretrained, see note above)
SimCLR ResNet50 Encoder (.pth)
SimCLR log loss (.json)
ssl_trainonly_data/
MAE-style pretrained encoder - training data only (.pth; patch-embedding layer pretrained, see note above)
SimCLR pretrained encoder - training data only (.pth)
SimCLR log loss (.json)
finetuned/
SimCLR fine-tuned models (.pt)
MAE fine-tuned models (.pt)
Supervised and fine-tuned checkpoints are named {model_name}_{subset}_seed{seed}_best.pt, where subset identifies the label budget (10%, 20% or 100%) and model_name is one of resnet50_scratch, resnet50_pretrained, efficientnet_b0, mobilevit_xs, vit_s16_scratch, simclr_resnet50 or mae_vits16.
The experiments use ChestX6, a six-class chest X-ray benchmark (Covid-19, Emphysema, Normal, Pneumonia-Bacterial, Pneumonia-Viral, Tuberculosis). ChestX6 is a compilation of two independently verified public sources; it is not hosted as a standalone dataset. No images are included in this repository.
A further 0.3% matched the curated dataset of Sait et al. and the COVID-19 Radiography Database. The source datasets remain under their providers' terms; see the licence table in the GitHub repository (data/README.md).
18,036 images were collected. During preprocessing, 48 exact duplicates were removed (MD5 audit), resulting in 17,988 unique images used in all experiments (split 70/10/20, seed 42, stratified).
Cross-dataset evaluation uses ChestMNIST (28×28 release, binary labels, derived from NIH ChestX-ray14) through the MedMNIST package. It is used as an external test set only. NIH ChestX-ray14 was provided by the NIH Clinical Center.
The checkpoints store PyTorch model weights (torch.load(path)["model_state"] for supervised and fine-tuned models). Use the pinned revision below so you get exactly the files used in the paper:
import torch, timm, torchvision
from huggingface_hub import list_repo_files, hf_hub_download
REPO = "Kashif-Mahmood007/chestx6-ssl-checkpoints"
REV = "1764b2409e06a91e81eda0f8bfe0c8ae4e199a38" # the revision cited in the paper
print(list_repo_files(REPO, revision=REV)) # every file at this revision
# Pick a file from the listing (adjust the filter to choose the model, budget and seed)
files = list_repo_files(REPO, revision=REV)
fname = next(f for f in files if "simclr_resnet50" in f and "seed42" in f and f.endswith(".pt"))
path = hf_hub_download(REPO, filename=fname, revision=REV)
def build(model_name, num_classes=6):
"""Architectures as defined in the repository notebooks (NB2/NB3)."""
if model_name in ("resnet50_scratch", "resnet50_pretrained"):
m = torchvision.models.resnet50(weights=None)
m.fc = torch.nn.Linear(2048, num_classes)
return m
if model_name == "efficientnet_b0":
return timm.create_model("efficientnet_b0", pretrained=False, num_classes=num_classes)
if model_name == "mobilevit_xs":
return timm.create_model("mobilevit_xs", pretrained=False, num_classes=num_classes)
if model_name == "vit_s16_scratch":
return timm.create_model("vit_small_patch16_224", pretrained=False, num_classes=num_classes)
if model_name == "simclr_resnet50":
enc = torchvision.models.resnet50(weights=None)
enc.fc = torch.nn.Identity()
return torch.nn.Sequential(enc, torch.nn.Linear(2048, num_classes))
if model_name == "mae_vits16":
enc = timm.create_model("vit_small_patch16_224", pretrained=False, num_classes=0)
return torch.nn.Sequential(enc, torch.nn.Linear(384, num_classes))
raise ValueError(model_name)
model = build("simclr_resnet50")
model.load_state_dict(torch.load(path, map_location="cpu")["model_state"])
model.eval()
Refer to the accompanying GitHub repository for the complete training pipeline, preprocessing and normalisation, configuration files, and evaluation code.
The complete source code, training pipeline, notebooks, configuration files, dataset split definitions, and reproduction instructions are available on GitHub:
Repository: ChestX6-SSL-Benchmark
The archived release used for the paper is available at Zenodo: https://doi.org/10.5281/zenodo.23288310 (release v1.1.0-scirep).
The GitHub repository includes:
1764b2409e06a91e81eda0f8bfe0c8ae4e199a38v1.1.0-scirep): https://doi.org/10.5281/zenodo.23288310If you use these checkpoints, please cite the associated manuscript.
@unpublished{mahmood2026drs,
title = {A Deployment Risk Score Framework for Self-Supervised Chest X-Ray Classification: Calibrated Multi-Objective Evaluation Under Annotation Scarcity and Distribution Shift},
author = {Kashif Mahmood and Romana Aziz and Muhammad Ramzan and Mahwish Ilyas and Ala Saleh Alluhaidan},
note = {Manuscript under revision at Scientific Reports},
year = {2026}
}
MIT License (code and model checkpoints). No image data is included. The datasets used for training remain under their providers' terms, and some of those terms may restrict derivative or commercial use of models trained on the data: check them before any use beyond research on this benchmark.