--- 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.