Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👁️ Cataract Detection & Severity Prediction

Deep Learning powered system for cataract classification and severity estimation
Built with PyTorch, Torchvision, and ResNet architectures.


📌 Overview

This repository contains two complementary modules:

  • main.py – Trains a ResNet50 model for severity prediction (regression output as percentage).
  • test.py – Loads a ResNet18 model for binary classification (Cataract vs No Cataract) and predicts on new images.

✨ Features

  • 📊 Severity Prediction – Outputs cataract severity as a percentage using regression (MSE loss).
  • 🩺 Binary Classification – Distinguishes between Cataract and No Cataract cases.
  • ⚡ Transfer Learning – Fine-tunes pre-trained ResNet models for medical imaging tasks.
  • 🎯 Data Augmentation – Includes resizing, rotation, color jitter, and normalization for robust training.
  • 💾 Model Persistence – Saves trained weights for later inference.

🛠️ Tech Stack

  • Frameworks: PyTorch, Torchvision
  • Models: ResNet50 (regression), ResNet18 (classification)
  • Tools: Matplotlib, PIL

⚙️ Usage

Training (Severity Prediction)

python main.py

This will:

  • Train ResNet50 on cataract images
  • Save weights to cataract_severity_model.pth
  • Report mean severity prediction error

Testing (Classification)

python test.py

This will:

  • Load ResNet18 with trained weights (cataract_model.pth)
  • Predict Cataract vs No Cataract for a given image
  • Print the predicted class

📂 Repository Structure

├── main.py        # Train ResNet50 for severity regression
├── test.py        # Test ResNet18 for binary classification
├── Cataract/
│   └── processed_images/
│       ├── train/
│       └── test/
└── README.md

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages