File size: 1,980 Bytes
f39ef14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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).