🧠 Stroke Classifier – Brain CT using ViT

This project is a binary classification model designed to detect stroke in brain CT slices using the Vision Transformer (ViT) architecture.


🧠 Task

Objective: Given a single axial CT slice, classify whether stroke is present:

  • 0 β†’ No Stroke
  • 1 β†’ Stroke

πŸ§ͺ Dataset

  • Modality: Brain CT
  • Format: .png slices (converted from DICOM if needed)
  • Preprocessing:
    • HU windowing and CLAHE applied only if original PNG did not exist.
    • Normalization parameters computed from training set:
      mean β‰ˆ 0.189, std β‰ˆ 0.318 Source:
      This dataset is derived from the 2021 Stroke CT Dataset shared during the
      TEKNOFEST 2021 Medical AI Competition, organized in collaboration with the
      Turkish Ministry of Health.
      These anonymized images are used solely for research and educational purposes. Public datasets can be accessed via the Ministry’s Open Data Portal.

πŸ—οΈ Model

  • Architecture: ViT-Base (google/vit-base-patch16-224)
  • Pretrained Weights: ImageNet-21k
  • Fine-tuned for binary slice-level classification

πŸ”— Pretrained Model

πŸ‘‰ View on Hugging Face

from transformers import ViTImageProcessor, ViTForImageClassification
from PIL import Image
import torch

# Load model and processor from Hugging Face Hub
model = ViTForImageClassification.from_pretrained("Sahende/teknofest_ct_stroke_binary")
processor = ViTImageProcessor.from_pretrained("Sahende/teknofest_ct_stroke_binary")

# Load and process an image
image = Image.open("example.png").convert("RGB")
inputs = processor(images=image, return_tensors="pt")

# Make prediction
with torch.no_grad():
    outputs = model(**inputs)
    predicted_class = torch.argmax(outputs.logits, dim=-1).item()

print(f"🧠 Predicted class: {predicted_class}")
Downloads last month
2
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Paper for Sahende/teknofest_ct_stroke_binary