YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Alzheimer's MRI Vision Transformer (ViT)
This repository hosts a Vision Transformer (google/vit-base-patch16-224-in21k) fine-tuned to classify structural MRI images across various stages of Alzheimer's Disease progression.
Overview
- Architecture: Vision Transformer (ViT-Base)
- Task: Medical Image Classification
- Domain: Neurodegenerative Disease Diagnosis (Alzheimer's Disease)
- Classes:
NonDementedVeryMildDementedMildDementedModerateDemented
Model Training
The model was fine-tuned using Hugging Face's Trainer API with automatic mixed precision (fp16=True) for efficiency. The classification head was replaced and adapted to the custom medical imaging classes based on cortical atrophy patterns.
Training Setup
- Base Model:
google/vit-base-patch16-224-in21k(86M parameters) - Framework: PyTorch & Hugging Face Transformers
- Hardware: Google Colab (Tesla T4 GPU)
- Precision: FP16
- Optimization: AdamW
Usage
You can use this model for inference using the Hugging Face pipeline or by loading the model and processor directly.
Using the pipeline API
from transformers import pipeline
# Load the image classification pipeline
classifier = pipeline("image-classification", model="your-username/alzheimers-vit-model")
# Run inference on an MRI image
results = classifier("path/to/mri_scan.jpg")
print(results)
Loading the Model and Processor directly
from transformers import ViTForImageClassification, ViTImageProcessor
from PIL import Image
import torch
# Load the model and processor
model_id = "your-username/alzheimers-vit-model"
processor = ViTImageProcessor.from_pretrained(model_id)
model = ViTForImageClassification.from_pretrained(model_id)
# Load and process the MRI image
image = Image.open("path/to/mri_scan.jpg")
inputs = processor(images=image, return_tensors="pt")
# Run inference
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
# Output the predicted class
predicted_class_idx = logits.argmax(-1).item()
predicted_class = model.config.id2label[predicted_class_idx]
print(f"Predicted Diagnosis: {predicted_class}")
Intended Use & Limitations
This model is intended for research and educational purposes in the field of medical AI. It should not be used for actual clinical diagnosis or treatment planning. Diagnostic conclusions should only be made by certified medical professionals utilizing comprehensive clinical evaluations. (Tathagata Marik)
- Downloads last month
- -