|
EfficientNetB0 Eye Disease Classification Model
|
|
Model Overview
|
|
This is a pre-trained EfficientNetB0 model for eye disease classification, saved in HDF5 format (efficientnet0.h5). It classifies eye images into one of the following categories:
|
|
|
|
Classes:
|
|
|
|
Normal
|
|
Diabetic Retinopathy
|
|
Glaucoma
|
|
Myopia
|
|
AMD (Age-related Macular Degeneration)
|
|
Hypertension
|
|
Not an eye Image
|
|
Others
|
|
|
|
|
|
Architecture: EfficientNetB0
|
|
|
|
Framework: TensorFlow/Keras
|
|
|
|
Task: Image Classification
|
|
|
|
Input: Images resized to 224x224 pixels, normalized to [0, 1]
|
|
|
|
Output: Predicted disease label (one of the above classes)
|
|
|
|
|
|
Usage
|
|
To use this model for inference, you can load it using TensorFlow/Keras:
|
|
|
|
Install dependencies:
|
|
pip install tensorflow pillow numpy
|
|
|
|
|
|
Load the model in Python:
|
|
from tensorflow.keras.models import load_model
|
|
model = load_model("efficientnet0.h5")
|
|
|
|
|
|
Preprocess your image (resize to 224x224, convert to RGB if needed, normalize), then run inference:
|
|
from PIL import Image
|
|
import numpy as np
|
|
img = Image.open("your_image.jpg")
|
|
img_d = img.resize((224, 224))
|
|
if len(np.array(img_d).shape) < 3:
|
|
rgb_img = Image.new("RGB", img_d.size)
|
|
rgb_img.paste(img_d)
|
|
else:
|
|
rgb_img = img_d
|
|
rgb_img = np.array(rgb_img, dtype=np.float64)
|
|
rgb_img = rgb_img.reshape(1, 224, 224, 3)
|
|
predictions = model.predict(rgb_img)
|
|
predicted_class = int(np.argmax(predictions))
|
|
classes = ["Normal", "Diabetic Retinopathy", "Glaucoma", "Myopia", "AMD", "Hypertension", "Not an eye Image", "Others"]
|
|
predicted_disease = classes[predicted_class] if 0 <= predicted_class < len(classes) else "Unknown"
|
|
|
|
|
|
|
|
Notes
|
|
|
|
This model is hosted on Hugging Face for storage. The Inference API may not support .h5 models directly. For inference, you can download the model and run it locally, or deploy a custom backend (e.g., using Flask).
|
|
The model expects images to be preprocessed as described above.
|
|
|
|
License
|
|
Specify your license here (e.g., MIT, Apache 2.0).
|
|
|