This model is a fine-tuned version of microsoft/resnet-50 on the imagefolder dataset. It achieves the following results on the evaluation set: The following hyperparameters were used during training: - learningrate: 0.0001 - trainbatchsize: 8 - evalbatchsize: 16 - gradientaccumulationsteps: 2 - totaltrainbatchsize: 16 - lrschedulertype: cosine - numepochs: 20 - labelsmoothingfactor: 0.1 - Transformers 5.16.1 - Pytorch 2.11.0+cu128 - Datasets 4.8.5 - Tokenizers 0.23.1
Open-weight model · Image classification
resnet50-chest-xray-256-fullframe-gray
by Trương Thành Đạt Purino/resnet50-chest-xray-256-fullframe-gray
resnet50-chest-xray-256-fullframe-gray is an open-weight model for image classification from Trương Thành Đạt, released under Creative Commons Attribution 4.0. It has 24M parameters. At 16-bit it needs about 0.1 GB of GPU memory, which fits on 1x MI300X from $1.85 an hour, at the lowest prices in the SAVRN Index.
Binary classifier (NORMAL vs PNEUMONIA): torchvision ResNet50 (ImageNet IMAGENET1KV2 weights) fully fine-tuned on Purino/chest-xray-pneumonia-256-fullframe-gray. Research/educational use only, not a diagnostic tool.
Runs On
What it takes to serve resnet50-chest-xray-256-fullframe-gray (24M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.
| Precision | Weights | Memory needed | Cheapest setup | Per hour | Also fits |
|---|---|---|---|---|---|
| 16-bit | 0.0 GB | 0.1 GB | 1x MI300X (192 GB) Vultr |
$1.85 | 1x H100 $1.99 · 1x MI325X $2.00 |
| 8-bit | 0.0 GB | 0.0 GB | 1x MI300X (192 GB) Vultr |
$1.85 | 1x H100 $1.99 · 1x MI325X $2.00 |
| 4-bit | 0.0 GB | 0.0 GB | 1x MI300X (192 GB) Vultr |
$1.85 | 1x H100 $1.99 · 1x MI325X $2.00 |
Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Oct 19, 2026.
Model Card
By Trương Thành Đạt, published under cc-by-4.0, revision d6d59dfeba27.
Binary classifier (NORMAL vs PNEUMONIA): torchvision ResNet50 (ImageNet IMAGENET1KV2 weights) fully fine-tuned on Purino/chest-xray-pneumonia-256-fullframe-gray. Research/educational use only, not a diagnostic tool. Confusion matrix (rows = true, columns = predicted): Validation (15% stratified hold-out of train, 783 images) at the selected epoch 8: accuracy 0.9885, recall 0.9880, macro-F1 0.9851, AUC 0.9983. - The dataset has no patient-level split or deduplication, so validation (and possibly test) images may come from patients seen in training; scores can be optimistic. - Trained on one pediatric dataset (Kermany et al.); it will likely not generalize to other scanners, populations or…
Read Trương Thành Đạt's full model card
ResNet50: chest X-ray pneumonia (256x256 full-frame grayscale)
Binary classifier (NORMAL vs PNEUMONIA): torchvision ResNet50 (ImageNet IMAGENET1K_V2 weights) fully fine-tuned on
Purino/chest-xray-pneumonia-256-fullframe-gray. Research/educational use only, not a diagnostic tool.
Evaluation (official test split, 624 images, evaluated once with the best-validation checkpoint)
| Metric | Test |
|---|---|
| Accuracy | 0.8718 |
| Precision (PNEUMONIA) | 0.8312 |
| Recall / sensitivity (PNEUMONIA) | 0.9974 |
| F1 (PNEUMONIA) | 0.9068 |
| Macro-F1 | 0.8508 |
| ROC-AUC | 0.9636 |
| Cross-entropy loss | 0.5630 |
Per class (threshold 0.5):
| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| NORMAL | 0.9936 | 0.6624 | 0.7949 | 234 |
| PNEUMONIA | 0.8312 | 0.9974 | 0.9068 | 390 |
Confusion matrix (rows = true, columns = predicted):
| pred NORMAL | pred PNEUMONIA | |
|---|---|---|
| true NORMAL | 155 | 79 |
| true PNEUMONIA | 1 | 389 |
Validation (15% stratified hold-out of train, 783 images) at the selected epoch 8: accuracy 0.9885, recall 0.9880, macro-F1 0.9851, AUC 0.9983.
Training
- Data: official train split (5216 images) -> 4433 train / 783 val (stratified, seed 42); official val split unused (too small); test held out.
- Input: 256x256 grayscale replicated to 3 channels, ImageNet mean/std. Augmentation: random affine (±10°, 5% shift, 0.9-1.1 scale), brightness/contrast jitter, no flips.
- Head: Dropout(0.3) + Linear(2048, 2). Loss: class-weighted cross-entropy (train class counts {'NORMAL': 1140, 'PNEUMONIA': 3293}).
- Optimizer: AdamW (lr 0.0001, weight decay 0.0001), cosine schedule, batch 64, up to 20 epochs, mixed precision, 2 GPU(s).
- Checkpoint: best validation macro-F1 (epoch 8), early-stopping patience 5.
Usage
import torch, torch.nn as nn
from torchvision import models, transforms as T
from safetensors.torch import load_file
from huggingface_hub import hf_hub_download
from PIL import Image
m = models.resnet50(); m.fc = nn.Sequential(nn.Dropout(0.3), nn.Linear(2048, 2))
m.load_state_dict(load_file(hf_hub_download("Purino/resnet50-chest-xray-256-fullframe-gray", "model.safetensors"))); m.eval()
tf = T.Compose([T.Resize((256, 256)), T.ToTensor(), T.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
x = tf(Image.open("xray.png").convert("RGB")).unsqueeze(0)
with torch.no_grad(): p = m(x).softmax(1)[0]
print(["NORMAL", "PNEUMONIA"][p.argmax().item()], p.tolist())
Limitations
- The dataset has no patient-level split or deduplication, so validation (and possibly test) images may come from patients seen in training; scores can be optimistic.
- Trained on one pediatric dataset (Kermany et al.); it will likely not generalize to other scanners, populations or adult chest X-rays without further validation.
- Images were resized to 256x256 without cropping, which changes aspect ratio. Labels were not independently verified here.
Data & credits
Source: Kermany et al. (Mendeley, CC BY 4.0) via Paul Mooney's Kaggle upload, converted to full-frame grayscale 256x256.
Identity and Version
- Repository
- Purino/resnet50-chest-xray-256-fullframe-gray
- Publisher
- Trương Thành Đạt
- Task
- Image classification
- Modality
- Image
- Library
- pytorch
- Parameters
- 24M parameters
- Languages
- Not stated by the source
- Revision
- d6d59dfeba27d0d871ca6c5ca6b407f37cd4a9bd
- First published
- 2026-10-01
- Last updated
- 2026-10-01
Files and Weights
7 files, 94.4 MB in total. The weights are 1 file totalling 94.3 MB in safetensors.
Every file
| File | Type | Size | SHA-256 |
|---|---|---|---|
| model.safetensors | Weights | 94.3 MB | aab73c7a326b |
| config.json | Configuration | 257 B | — |
| metrics.json | Configuration | 4.9 KB | — |
| README.md | Documentation | 3.9 KB | — |
| confusion_matrix.png | Other | 17.7 KB | — |
| curves.png | Other | 58.0 KB | — |
| .gitattributes | Repository | 1.5 KB | — |
License and Download
- License
- cc-by-4.0
- Access
- Open weights, no gate
- Download size
- 94.3 MB
Released by Trương Thành Đạt through its official repository on Hugging Face. Read the license.
Built From
- Trained on (disclosed) Purino/chest-xray-pneumonia-256-fullframe-gray
Evaluations
Each result is shown as reported, with the conditions its reporter stated. None is a SAVRN measurement. A comparison lines two results up only when their configuration, unit and setup are all stated and identical.
| Benchmark | Conditions | Result | Reported by | Revision | Date |
|---|---|---|---|---|---|
| chest-xray-pneumonia-256-fullframe-gray (test) | Task image-classificationMetric accuracyComparison conditions not established | 0.8718 | Purino Publisher reported |
Evaluated revision not stated | — |
| chest-xray-pneumonia-256-fullframe-gray (test) | Task image-classificationMetric f1Comparison conditions not established | 0.9068 | Purino Publisher reported |
Evaluated revision not stated | — |
| chest-xray-pneumonia-256-fullframe-gray (test) | Task image-classificationMetric recallComparison conditions not established | 0.9974 | Purino Publisher reported |
Evaluated revision not stated | — |
Memory Requirements
| Precision | Weights in memory |
|---|---|
| As published | 94.3 MB |
| 16-bit | 0.0 GB |
| 8-bit | 0.0 GB |
| 4-bit | 0.0 GB |
Weights only, from the published parameter count; the key-value cache and runtime add to this.
Questions About resnet50-chest-xray-256-fullframe-gray
How much GPU memory does resnet50-chest-xray-256-fullframe-gray need?
About 0.1 GB at 16-bit and 0 GB at 4-bit: the weights (24M parameters) plus a working margin. A long context needs more.
What is the cheapest GPU to run resnet50-chest-xray-256-fullframe-gray on?
At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.
Can I use resnet50-chest-xray-256-fullframe-gray commercially?
Yes. resnet50-chest-xray-256-fullframe-gray is released under Creative Commons Attribution 4.0. CC BY 4.0 permits sharing and adapting the work, including commercially, provided the creator is credited and changes are indicated.
Similar Models
A Vision Transformer (ViT) image classification model. Trained on ImageNet-21k and fine-tuned on ImageNet-1k (with additional augmentation and regularization) in JAX by paper authors, ported to PyTorch by Ross Wightman. - How to train your ViT? Data, Augmentation, and Regularization in Vision Transformers: https://arxiv.org/abs/2106.10270 - An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale: https://arxiv.org/abs/2010.11929v2 Explore the dataset and runtime metrics of this model in timm model results.
A ResNet-B image classification model. single layer 7x7 convolution with pooling 1x1 convolution shortcut downsample Trained on ImageNet-1k in timm using recipe template described below. ResNet Strikes Back A1 recipe - Deep Residual Learning for Image Recognition: https://arxiv.org/abs/1512.03385 Explore the dataset and runtime metrics of this model in timm model results.
A EfficientNet-v2 image classification model. Trained on ImageNet-21k and fine-tuned on ImageNet-1k in Tensorflow by paper authors, ported to PyTorch by Ross Wightman. Explore the dataset and runtime metrics of this model in timm model results.
A ResNet-B image classification model. single layer 7x7 convolution with pooling 1x1 convolution shortcut downsample Trained on ImageNet-1k in timm using recipe template described below. Based on ResNet Strikes Back A1 recipe Stronger dropout, stochastic depth, and RandAugment than paper A1 recipe - Deep Residual Learning for Image Recognition: https://arxiv.org/abs/1512.03385 Explore the dataset and runtime metrics of this model in timm model results.
A ResNet-B image classification model. single layer 7x7 convolution with pooling 1x1 convolution shortcut downsample Trained on ImageNet-1k in timm using recipe template described below. ResNet Strikes Back A1 recipe - Deep Residual Learning for Image Recognition: https://arxiv.org/abs/1512.03385 Explore the dataset and runtime metrics of this model in timm model results.