Metadata-Version: 2.4
Name: octmnist-classifier
Version: 0.1.2
Summary: A CNN-based classifier for OCTMNIST retinal disease classification with training, prediction, and CLI tools.
Author: Kirupanandan Jagadeesan
Author-email: kirupana@buffalo.edu
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=1.9.0
Requires-Dist: numpy>=1.19
Requires-Dist: matplotlib>=3.3
Requires-Dist: scikit-learn>=0.24
Requires-Dist: medmnist
Requires-Dist: seaborn>=0.11
Requires-Dist: pillow>=8.0
Requires-Dist: clustimage>=1.2.6
Requires-Dist: imbalanced-learn>=0.8
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# OCTMNIST Classifier

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

## 🔧 Installation

```bash
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](https://github.com/anandhkirupa/octmnist-classifier/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

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

Output:

```
Predicted class: NORMAL (Class ID: 3)
```

### 2. Training with balancing

```bash
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:

```bash
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](https://www.linkedin.com/in/kirupanandanjagadeesan/). Contributions and feedback welcome!
