đ EfficientNet Parkinson's Prediction Model đ¤
This repository houses a Hugging Face EfficientNet model designed to predict Parkinson's disease through patient drawings, achieving an accuracy of approximately 83%. It is developed using EfficientNet and Torch.
⨠Features
- Utilizes the EfficientNet architecture to analyze patient drawings and predict the likelihood of Parkinson's disease.
- The model is trained on a dataset from Kaggle, enhancing its reliability.
- Open - source, welcoming contributions via pull requests.
đĻ Installation
No specific installation steps are provided in the original document.
đģ Usage Examples
Basic Usage
import torch
from transformers import AutoModel
from torch import nn
from PIL import Image
import numpy as np
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = AutoModel.from_pretrained('/content/final')
model = model.to(device)
image_size = (224, 224)
new_image = Image.open('/content/health.png').convert('RGB').resize(image_size)
new_image = np.array(new_image)
new_image = torch.from_numpy(new_image).transpose(0, 2).float().unsqueeze(0)
new_image = new_image.to(device)
with torch.no_grad():
predictions = model(new_image)
logits = predictions.last_hidden_state
logits = logits.view(logits.shape[0], -1)
num_classes=2
feature_reducer = nn.Linear(logits.shape[1], num_classes)
logits = logits.to(device)
feature_reducer = feature_reducer.to(device)
logits = feature_reducer(logits)
predicted_class = torch.argmax(logits, dim=1).item()
confidence = torch.softmax(logits, dim=1)[0][predicted_class].item()
if(predicted_class == 0):
print(f'Predicted class: Parkinson\'s with confidence {confidence:.2f}')
else:
print(f'Predicted class: Healthy with confidence {confidence:.2f}')
đ Documentation
Overview
Parkinson's disease is a progressive nervous system disorder that affects movement. Symptoms start gradually, sometimes starting with a barely noticeable tremor in just one hand. Tremors are common, but the disorder also commonly causes stiffness or slowing of movement.
This model uses the EfficientNet architecture to predict the likelihood of Parkinson's disease in patients by analysing their drawings. Contributors are welcome to open a pull request.
Dataset
The dataset used to train this model was provided by Kaggle.
đ License
This project is licensed under the MIT license.