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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file octmnist_classifier-0.1.2.tar.gz.
File metadata
- Download URL: octmnist_classifier-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c51894f80a612a45cd5c54d5eb4bb32d029cb3c8c1f3c7f68e47fcdaa568d31
|
|
| MD5 |
4d98afc9c6e980cdb36760666d8270a7
|
|
| BLAKE2b-256 |
b9bf8973dc703101f5c8d186fd45f6f74fdc0e1abf9a84d6c127bdef74365fb7
|
File details
Details for the file octmnist_classifier-0.1.2-py3-none-any.whl.
File metadata
- Download URL: octmnist_classifier-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05124abb3a9438b686ff77937d68fce40cd79e552b75695216e42d1f7b624c2c
|
|
| MD5 |
03a09b76636efc1c80bf552d4e5c8bc8
|
|
| BLAKE2b-256 |
04e8e7b4b3b4a91761997fb5fc4cc69109418f69360ccc1c7768dd6c6ca5b4bf
|