Skip to main content

A CNN-based classifier for OCTMNIST retinal disease classification with training, prediction, and CLI tools.

Project description

OCTMNIST Classifier

A Python package for classifying retinal OCT images into four categories: CNV, DME, Drusen, and Normal, based on the OCTMNIST dataset. Built with a custom CNN and includes preprocessing, class balancing strategies, and a CLI for inference.

🔧 Installation

pip install octmnist-classifier

Make sure to have 'torch', 'medmnist', and other dependencies listed in 'setup.py' installed.

📦 Features

  • Preprocessing and loading of the OCTMNIST dataset

  • Class balancing using:

    • SMOTE
    • SMOTE + Tomek Links
    • Undersampling
  • CNN model with ReLU, BatchNorm, MaxPooling

  • Trainable via script interface ('scripts/train.py')

  • CLI interface to run inference on new images

🧠 Pretrained Models

Download pretrained models from the Releases page:

  • 'model_smote.pt'
  • 'model_smote_tomek.pt'

Place them in the 'saved_model/' directory before running predictions.

🚀 Usage

1. Predict a single image

octmnist-predict --image retina.png --model saved_model/model_smote.pt

Output:

Predicted class: NORMAL (Class ID: 3)

2. Training with balancing

python scripts/train.py --strategy smote --epochs 15

Options for '--strategy': 'smote', 'smote_tomek', 'undersample'

🧪 Evaluation (planned)

In future versions, you'll be able to run:

octmnist-eval --model saved_model/model_smote.pt --test_dir test_images/

🔍 Model Architecture

  • 4 Conv layers with ReLU, BatchNorm, MaxPooling
  • Final Linear layer with Dropout
  • Xavier/He initialization supported

🗂️ Project Structure

octmnist-classifier/
├── octmnist_classifier/
│   ├── model.py
│   ├── preprocess.py
│   ├── predict.py
│   └── cli.py
├── saved_model/
│   └── model_smote.pt
├── scripts/
│   └── train.py
└── setup.py

📄 License

MIT License


Maintained by Kirupanandan Jagadeesan. Contributions and feedback welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

octmnist_classifier-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

octmnist_classifier-0.1.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file octmnist_classifier-0.1.1.tar.gz.

File metadata

  • Download URL: octmnist_classifier-0.1.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for octmnist_classifier-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9efd31eb5c39cdcf3bed7db59e64fe9d7a201656752436b94585696c0f327abc
MD5 21f9bda44e52e73a6c337fb3dae8b02a
BLAKE2b-256 ca1e919689fa322cabbae91fab084e62a0ef901a23a2fc84a915c8e5d1b356a8

See more details on using hashes here.

File details

Details for the file octmnist_classifier-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for octmnist_classifier-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f85bcf957892e9dc7efbcfacbbba54304183a696bb03108ec9ad809209017c1a
MD5 fd34a467e14182c1b394f4a9a42f63d4
BLAKE2b-256 100e5c18293932d27dc74974050f95921ec3bd7d50c535272c2d5db897c11929

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page