keremberke/chest-xray-classification
Viewer • Updated • 5.84k • 1.2k • 27
How to use kiselyovd/chest-xray-classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-classification", model="kiselyovd/chest-xray-classifier")
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png") # Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification
processor = AutoImageProcessor.from_pretrained("kiselyovd/chest-xray-classifier")
model = AutoModelForImageClassification.from_pretrained("kiselyovd/chest-xray-classifier")Production-grade 3-class chest X-ray classifier: normal vs bacterial pneumonia vs viral pneumonia.
| Metric | Value |
|---|---|
| auroc_macro_ovr | 0.9752638346619307 |
| accuracy | 0.9134615384615384 |
| macro_f1 | 0.9029730638714358 |
from transformers import AutoImageProcessor, AutoModelForImageClassification
import torch
from PIL import Image
processor = AutoImageProcessor.from_pretrained("kiselyovd/chest-xray-classifier")
model = AutoModelForImageClassification.from_pretrained("kiselyovd/chest-xray-classifier")
image = Image.open("your_image.png")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
predicted_class = logits.argmax(-1).item()
print(model.config.id2label[predicted_class])
Trained on Chest X-Ray Images (Pneumonia).
This model is provided for research and educational purposes. The authors make no warranties about its suitability for any particular application. Users are responsible for evaluating the model's fitness for their use case, including fairness, safety, and compliance with applicable regulations.
Note: This model card was generated from the ml-project-template scaffold.
Base model
facebook/convnextv2-tiny-22k-224