Downloads · 30 days
0
nismal1u/chestX-rays-DenseNet121
chestX-rays-DenseNet121 is a image classification model from nismal1u. Use it when you need a label for an image. It is set up for pytorch. The card lists the license as mit.
A DenseNet121 chest X-ray classifier (CheXNet-style backbone) that reports a per-image uncertainty score alongside its prediction, and uses that uncertainty to drive a selective-referral (risk-coverage) analysis: when…
Downloads · 30 days
0
Access
Public
Updated Jul 16, 2026
Repo size
28.4 MB
Likes
0
Public
Click a slice to open those files.
.pt28.4 MB · 100%
From the Hugging Face model README
A DenseNet121 chest X-ray classifier (CheXNet-style backbone) that reports a per-image uncertainty score alongside its prediction, and uses that uncertainty to drive a selective-referral (risk-coverage) analysis: when the model defers its most-uncertain cases to a radiologist, AUROC on the cases it keeps goes up.
Dropout(p=0.3) -> Linear(in_features, 1), kept active at
inference time (Monte Carlo Dropout) so repeated stochastic forward passes
give a distribution over predictions.BCEWithLogitsLoss, on a single NVIDIA B200 GPU (HiPerGator).The model returns a single logit. torch.sigmoid(logit) gives the
probability that the image is class index 1 (PNEUMONIA). Running
mc_predict() (30 stochastic forward passes with dropout active) returns two
values per image instead of one:
This model does not output segmentation masks, bounding boxes, or localization — whole-image binary classification only.
referral_curve.png.
import torch
from model import build_model, mc_predict # from this repo
from data import _tf # preprocessing transform
model = build_model(num_classes=1)
model.load_state_dict(torch.load("ckpt.pt", map_location="cpu"))
# x: a batch of preprocessed images, shape (B, 3, 224, 224)
mean_prob, uncertainty = mc_predict(model, x, n_passes=30)
ckpt.pt — trained model weights (state dict).model.py — DenseNet121 + MC-dropout head; mc_predict for sampled inference.data.py — preprocessing transforms (grayscale->3ch, resize, ImageNet norm).referral_curve.png — AUROC-vs-coverage plot (the headline result).