Chest X-Ray Classification

ConvNeXt-V2-Tiny classifies pediatric radiographs as bacterial pneumonia, normal or viral pneumonia. Explore the classification errors.

Results

Current artifact and evaluation

Replayed on the original 624-image test fold

Metric Value
Accuracy 91.35%
Macro F1 90.30%
Macro AUROC (OvR) 97.53%

The complete confusion matrix and metrics reproduce the stored main report. Historical checkpoint training membership is unrecorded; the baseline remains a stored report.

Evaluation record · Pinned model

Evaluation protocol and numerical parity. The DINOv2 baseline remains a separately stored report; its checkpoint is absent from this snapshot.

Run the published weights

This explicit torchvision recipe preserves the exact training/evaluation geometry and uses native safetensors weights.

import torch
from PIL import Image
from torchvision.transforms import v2
from transformers import AutoModelForImageClassification

REPO = "kiselyovd/chest-xray-classifier"
REVISION = "09bd78b58c657870961faa1b79699da5ca8bc796"
model = AutoModelForImageClassification.from_pretrained(
    REPO, revision=REVISION, use_safetensors=True, trust_remote_code=False
).eval()
transform = v2.Compose([
    v2.ToImage(), v2.Resize(255, antialias=True), v2.CenterCrop(224),
    v2.ToDtype(torch.float32, scale=True),
    v2.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
])
image = Image.open("chest-xray.jpeg").convert("RGB")
with torch.inference_mode():
    scores = model(pixel_values=transform(image).unsqueeze(0)).logits.softmax(-1)[0]
print([(model.config.id2label[i], float(scores[i])) for i in scores.argsort(descending=True).tolist()])

Class order is 0 bacterial, 1 normal, 2 viral. Scores are uncalibrated model outputs. The corrected native processor includes a small MIT-licensed adapter that preserves torchvision's rounded center-crop anchor. Loading that adapter with AutoImageProcessor requires reviewing the pinned module and explicitly setting trust_remote_code=True; the standalone recipe above uses standard torchvision code.

Data and replay

The original Kaggle dataset contains 5856 pediatric radiographs. The repository derives bacterial/viral subtypes from the original pneumonia filenames. Replaying all 624 original test images reproduces the complete stored main confusion matrix and its metrics. A saved probability/target archive allows independent recalculation.

Source receipt · Test-file manifest · Complete processor comparison.

Historical training membership and patient-level independence are unrecorded. This is research on a limited pediatric cohort; clinical validation has not been performed.

Component terms and citation

Project code and the adapter are MIT. The source data are CC BY 4.0, attributed to Daniel Kermany, Kang Zhang and Michael Goldbaum; original dataset DOI 10.17632/rscbjbr9sj.2. ConvNeXt-V2 and DINOv2 base cards declare Apache 2.0. The fine-tuned artifact's MIT declaration does not replace those upstream notices or dataset attribution.

Component details · Original data · CITATION.cff.

Downloads last month
77
Safetensors
Model size
27.9M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for kiselyovd/chest-xray-classifier

Finetuned
(10)
this model

Collection including kiselyovd/chest-xray-classifier