Views
No views yet
Objective: Given a single axial CT slice, classify whether stroke is present:
0 → No Stroke1 → Stroke.png slices (converted from DICOM if needed)mean ≈ 0.189, std ≈ 0.318
Source:ViT-Base (google/vit-base-patch16-224)1from transformers import ViTImageProcessor, ViTForImageClassification
2from PIL import Image
3import torch
4
5# Load model and processor from Hugging Face Hub
6model = ViTForImageClassification.from_pretrained("Sahende/teknofest_ct_stroke_binary")
7processor = ViTImageProcessor.from_pretrained("Sahende/teknofest_ct_stroke_binary")
8
9# Load and process an image
10image = Image.open("example.png").convert("RGB")
11inputs = processor(images=image, return_tensors="pt")
12
13# Make prediction
14with torch.no_grad():
15 outputs = model(**inputs)
16 predicted_class = torch.argmax(outputs.logits, dim=-1).item()
17
18print(f"🧠 Predicted class: {predicted_class}")