metadata
license: apache-2.0
datasets:
- SilpaCS/Augmented_alzheimer
language:
- en
base_model:
- google/siglip2-base-patch16-224
pipeline_tag: image-classification
library_name: transformers
tags:
- Alzheimer
- Stage-Classifier
- SigLIP2
Alzheimer-Stage-Classifier
Alzheimer-Stage-Classifier is a multi-class image classification model based on
google/siglip2-base-patch16-224, designed to identify stages of Alzheimer’s disease from medical imaging data. This tool can assist in clinical decision support, early diagnosis, and disease progression tracking.
Label Classes
The model classifies input images into the following stages of Alzheimer’s disease:
0: MildDemented
1: ModerateDemented
2: NonDemented
3: VeryMildDemented
Installation
pip install transformers torch pillow gradio
Example Inference Code
import gradio as gr
from transformers import AutoImageProcessor, SiglipForImageClassification
from PIL import Image
import torch
# Load model and processor
model_name = "prithivMLmods/Alzheimer-Stage-Classifier"
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)
# ID to label mapping
id2label = {
"0": "MildDemented",
"1": "ModerateDemented",
"2": "NonDemented",
"3": "VeryMildDemented"
}
def classify_alzheimer_stage(image):
image = Image.fromarray(image).convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
prediction = {id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))}
return prediction
# Gradio Interface
iface = gr.Interface(
fn=classify_alzheimer_stage,
inputs=gr.Image(type="numpy"),
outputs=gr.Label(num_top_classes=4, label="Alzheimer Stage"),
title="Alzheimer-Stage-Classifier",
description="Upload a brain scan image to classify the stage of Alzheimer's: NonDemented, VeryMildDemented, MildDemented, or ModerateDemented."
)
if __name__ == "__main__":
iface.launch()
Applications
- Early Alzheimer’s Screening
- Clinical Diagnosis Support
- Longitudinal Study & Disease Monitoring
- Research on Cognitive Decline