Downloads · 30 days
13
4% of all-time downloads
itsomk/vit-xray-v1
vit-xray-v1 is a image classification model from itsomk. Use it when you need a label for an image. The card lists the license as mit.
This model is a fine-tuned Vision Transformer (google/vit-base-patch16-224-in21k) for multi-label classification of chest X-rays. It predicts the presence of multiple findings such as: - Nodule - Infiltration - Effusi…
Downloads · 30 days
13
4% of all-time downloads
All-time downloads
359
Public
Parameters
85.8M
343 MB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors343 MB · 100%
From the Hugging Face model README
This model is a fine-tuned Vision Transformer (google/vit-base-patch16-224-in21k) for multi-label classification of chest X-rays.
It predicts the presence of multiple findings such as:
Author: Om Kumar (Hugging Face: @itsomk)
The model is designed for research and educational purposes only and should not be used as a substitute for clinical diagnosis.
⚠️ Not intended for clinical use. Predictions should not guide medical decisions.
from transformers import AutoImageProcessor, AutoModelForImageClassification
import torch
from PIL import Image
MODEL = "itsomk/vit-xray-v1"
processor = AutoImageProcessor.from_pretrained(MODEL)
model = AutoModelForImageClassification.from_pretrained(MODEL)
img = Image.open("path/to/xray.jpg").convert("RGB")
inputs = processor(images=img, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
probs = torch.sigmoid(logits).squeeze().tolist()
results = {model.config.id2label[i]: float(probs[i]) for i in range(len(probs))}
print(results)