File size: 2,191 Bytes
b855174 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
---
language: en
license: mit
tags:
- tensorflow
- image-classification
- medical-imaging
- vascular-dementia
datasets:
- custom
---
# EfficientNet Model for Vascular Dementia Detection
This model was trained to detect Vascular Dementia (VAD) from MRI scans. It uses an EfficientNet architecture fine-tuned on a custom dataset of brain MRI images.
## Model Description
- **Model Type:** EfficientNet
- **Task:** Binary classification (VAD-Demented vs. Non-Demented)
- **Input:** MRI brain scans (224x224 RGB)
- **Output:** Binary classification with confidence score
## Usage
```python
import tensorflow as tf
import numpy as np
from PIL import Image
# Load the model
model = tf.keras.models.load_model("path/to/downloaded/model")
# Preprocess your image
image = Image.open("path/to/your/mri.jpg")
image = image.resize((224, 224))
image_array = np.array(image) / 255.0
image_array = np.expand_dims(image_array, axis=0)
# Get prediction
prediction = model.predict(image_array)
predicted_class = "VAD-Demented" if prediction[0][0] > 0.5 else "Non-Demented"
confidence = prediction[0][0] * 100 if prediction[0][0] > 0.5 else (1 - prediction[0][0]) * 100
print(f"Prediction: {predicted_class}")
print(f"Confidence: {confidence:.2f}%")
```
## API Usage
This model can be used directly with the Hugging Face Inference API:
```python
import requests
import base64
from PIL import Image
import io
# Convert image to base64
image = Image.open("path/to/your/mri.jpg")
buffered = io.BytesIO()
image.save(buffered, format="JPEG")
img_str = base64.b64encode(buffered.getvalue()).decode()
# API endpoint
API_URL = "https://api-inference.huggingface.co/models/thakshana02/vad-efficientnet-model"
# API headers with your token
headers = {"Authorization": "Bearer YOUR_TOKEN"}
# Make prediction request
response = requests.post(API_URL, headers=headers, json={"inputs": {"image": img_str}})
result = response.json()
print(result)
```
## Limitations
This model is intended for research purposes only and should not be used for clinical diagnosis without proper validation by healthcare professionals.
|