Falah/Alzheimer_MRI
Viewer • Updated • 6.4k • 1.36k • 27
How to use rmezapi/dementia-vit with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-classification", model="rmezapi/dementia-vit")
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png") # Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification
processor = AutoImageProcessor.from_pretrained("rmezapi/dementia-vit")
model = AutoModelForImageClassification.from_pretrained("rmezapi/dementia-vit")# Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification
processor = AutoImageProcessor.from_pretrained("rmezapi/dementia-vit")
model = AutoModelForImageClassification.from_pretrained("rmezapi/dementia-vit")This project was intended to test the limits of the ViT on a tough dementia dataset. The data used can be found on HuggingFace at: https://huggingface.co/datasets/Falah/Alzheimer_MRI. The project follows closely the following tutorials:
https://www.youtube.com/watch?v=r88L_yLJ4CE&ab_channel=code_your_own_AI https://www.youtube.com/watch?v=qU7wO02urYU&ab_channel=JamesBriggs I modify the code presented in the video and tune all parameters to optimize performance using mostly the same libraries and tools. This is a practice project for myself as I return to coding/designing ML models after dedicating time to AI/ML theory (model architectures, transfer learning)
Base model
google/vit-base-patch16-224-in21k
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="rmezapi/dementia-vit") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")