The money crisis has become all too real over the past few years. A generation like ours is in limbo — torn between having a growth mindset or giving up on one altogether. Everything around us feels so volatile that it’s become harder to sustain our careers, forcing us to pivot every few years.
It’s made us realize that all those years we spent studying and chasing higher education might not even be worth it by the time we graduate.
AI is moving faster than we ever imagined. It’s reshaping how quickly new ideas are tested — and then outdated. Still, there are breakthrough moments happening here and there. One of those moments is AI in bioscience.
No matter how conservative or narrowly focused scientists may be, we now have the power to fail fast and explore freely. That’s a massive shift.
Yes, there are still concerns — are we doing things right?
Does faster always mean better or more accurate?
But that’s part of the growing pains. Every change goes through scrutiny and criticism.
That’s what shapes it into something better over time.
Now, Google has the Co-Scientist platform — arguably one of the most exciting ideas among scientists today. It’s already making waves in fields like drug discovery and protein folding, helping researchers test ideas faster and iterate smarter.
But Co-Scientist didn’t work perfectly on day one. It took time. It took collaboration. As they say, Rome wasn’t built in a day.
Recently, I started learning & researching more on Hybrid Deep Learning Framework for Multi-Class Ocular Disease Detection Using Retinal Fundus Imaging!
Early detection of eye diseases is more important than ever. With the rise of vision-threatening conditions like diabetic retinopathy and glaucoma, deep learning offers a scalable and accurate way to screen patients — especially in resource-constrained settings.
So, what exactly is a hybrid deep learning framework, and why does it matter for something like eye disease detection?
Well, in simple terms — instead of sticking to a single deep learning architecture (like just using ResNet or VGG), a hybrid model takes the best of multiple networks and combines them.
Think of it like teaming up a sharp-eyed detective with a data-crunching genius — you get better results than either could deliver alone.
In our case, we’re working with retinal fundus images — detailed pictures of the back of the eye, which hold a wealth of clues about a person’s ocular health. These images can reveal signs of multiple diseases, often before the patient notices any symptoms. But here’s the challenge: manually reviewing these images is time-consuming, subjective, and depends heavily on specialist availability.
This is where deep learning steps in.
The Dataset
We used the ODIR-5K dataset — a publicly available collection of 5,000+ labeled retinal images sourced from real-world clinical settings. Each image is tagged with multiple disease labels such as:
- Normal
- Diabetic Retinopathy
- Glaucoma
- Cataract
- AMD (Age-related Macular Degeneration)
- Hypertension
- Myopia
- Other/Unknown
This multi-label setup makes it perfect for training a system that doesn’t just look for one disease, but scans holistically — like an AI-powered eye doctor.
The Model Architecture
The idea was simple: instead of reinventing the wheel, let’s combine proven architectures. So, we merged ResNet50 (known for its depth and accuracy) with VGG16 (great at preserving fine details).
This hybrid model we experimented with, let’s call it RNVGG, leverages:
- ResNet50 for its residual learning capabilities (helps with very deep networks)
- VGG16 for its straightforward and consistent convolutional layers (great for image textures)
Here’s a rough architecture flow:
Input Image (224x224)
↓
[ResNet50 backbone] → Feature Map A
↓
[VGG16 backbone] → Feature Map B
↓
Concatenate A + B
↓
Fully Connected Layers
↓
Multi-Class Sigmoid Output (8 disease probabilities)
Training & Evaluation
We trained the model using standard image augmentation techniques (rotation, flipping, brightness adjustments) to simulate real-world conditions. The model was evaluated using:
- Accuracy
- F1-score
- AUC (Area Under Curve)
And the results? Impressive.
Model Accuracy
ResNet50–93.2%
InceptionV3–82.0%
MobileNetV2–89.0%
Standard CNN — 97.0%
RNVGG (Hybrid) — 98.2%
Even a small percentage gain in accuracy can mean detecting thousands more patients early — and that can be life-changing.
What’s Next?
Right now, I’m exploring ways to make this model lightweight enough to run on low-resource devices — think rural clinics, mobile screening vans, or smartphone-based fundus cameras.
Because innovation isn’t just about accuracy — it’s about accessibility.
I’m also experimenting with Grad-CAM visualizations to show where the model is looking while making predictions.
This adds an extra layer of transparency and helps build trust among clinicians who might use it in real scenarios.
If you’re wondering how this translates into an actual working system — here’s a prototype I’ve been playing with.
It’s a hybrid model (RNVGG) combining ResNet50 and VGG16 using TensorFlow/Keras, trained on a multi-label dataset like ODIR-5K.
Step 1: Install and Import Dependencies
# Install required packages (only if not already installed)
# !pip install tensorflow opencv-python matplotlib scikit-learn
import tensorflow as tf
from tensorflow.keras.applications import ResNet50, VGG16
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Dense, GlobalAveragePooling2D, Concatenate, Dropout
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.optimizers import Adam
import matplotlib.pyplot as plt
import numpy as np
Step 2: Preprocessing Data
Assume your images are organized like this:
dataset/
├── train/
│ ├── img1.jpg
│ ├── img2.jpg
│ └── ...
├── val/
└── test/
And you have a CSV file with multi-label targets like:
filename,Normal,Diabetic_Retinopathy,Glaucoma,...
img1.jpg,0,1,0,...
img2.jpg,1,0,0,...
Here’s how to load the data:
import pandas as pd
from sklearn.model_selection import train_test_split
# Load your CSV
df = pd.read_csv("labels.csv") # Make sure this file has a 'filename' column and binary labels for diseases
# Split into train/val
train_df, val_df = train_test_split(df, test_size=0.2, random_state=42)
# Image generators
datagen = ImageDataGenerator(rescale=1./255)
train_gen = datagen.flow_from_dataframe(
train_df,
directory="dataset/train",
x_col='filename',
y_col=df.columns[1:].tolist(),
target_size=(224, 224),
batch_size=32,
class_mode='raw' # for multi-label
)
val_gen = datagen.flow_from_dataframe(
val_df,
directory="dataset/val",
x_col='filename',
y_col=df.columns[1:].tolist(),
target_size=(224, 224),
batch_size=32,
class_mode='raw'
)
Step 3: Build the Hybrid Model
def build_hybrid_model(input_shape=(224, 224, 3), num_classes=8):
input_layer = Input(shape=input_shape)
# ResNet50 branch
resnet = ResNet50(weights='imagenet', include_top=False, input_tensor=input_layer)
for layer in resnet.layers:
layer.trainable = False
x1 = GlobalAveragePooling2D()(resnet.output)
# VGG16 branch
vgg = VGG16(weights='imagenet', include_top=False, input_tensor=input_layer)
for layer in vgg.layers:
layer.trainable = False
x2 = GlobalAveragePooling2D()(vgg.output)
# Merge branches
merged = Concatenate()([x1, x2])
merged = Dropout(0.5)(merged)
merged = Dense(128, activation='relu')(merged)
output = Dense(num_classes, activation='sigmoid')(merged)
model = Model(inputs=input_layer, outputs=output)
return model
model = build_hybrid_model(num_classes=len(df.columns)-1)
model.compile(optimizer=Adam(learning_rate=1e-4),
loss='binary_crossentropy',
metrics=['accuracy'])
model.summary()
Step 4: Train the Model
history = model.fit(
train_gen,
validation_data=val_gen,
epochs=10
)
Step 5: Plot Training Performance
plt.plot(history.history['accuracy'], label='Train Acc')
plt.plot(history.history['val_accuracy'], label='Val Acc')
plt.xlabel('Epochs')
plt.ylabel('Accuracy')
plt.legend()
plt.title('Training vs Validation Accuracy')
plt.show()
Step 6: Make Predictions
# Predict on one batch
images, labels = next(val_gen)
predictions = model.predict(images)
for i in range(3): # Show first 3 images
plt.imshow(images[i])
plt.title(f"True: {labels[i].round()} | Pred: {predictions[i].round()}")
plt.axis('off')
plt.show()
So that’s the core setup — a hybrid model built by combining ResNet50 and VGG16, trained on multi-label retinal fundus data.
It covers everything from preprocessing and data loading to building, training, and evaluating the model.
Next steps?
- Try it on your own dataset
- Fine-tune the model layers for better accuracy
- Add Grad-CAM for explainability
- Experiment with model compression for edge deployment
This is still an evolving space, and there’s so much more to explore — but even a basic setup like this shows how powerful deep learning can be in transforming eye disease detection.
Follow a tech philosopher’s perspective on AI and the world, while navigating an AI career.
