Skip to content

poojitha66/Optical-coherence-tomography-Classification

Repository files navigation

OCTMNIST Classification

The OCTMNIST is based on a prior dataset of 109,309 valid optical coherence tomography (OCT) images for retinal diseases. Each example is a 28x28 image, associated with a label from 4 classes.

Data

MedMNIST is a collection of multiple datasets References for dataset:

Install the MedMNIST package using:

pip install medmnist

Data preprocessing

  • Preprocessing the OCTMNIST dataset is achieved by applying transformations to each image, such as resizing to 28x28 pixels, converting to a tensor, and normalizing with mean and standard deviation of 0.5.
  • On Normalizing the pixel values are scaled appropriately, improving the stability and performance of the neural network during training.

Splitting data to train, validation and testing data:

  • The transformed dataset is then split into training, validation, and testing sets to facilitate model evaluation and development.

Model Architechture:

The OCTMNIST_CNN model architecture comprises convolutional layers followed by ReLU activation functions and max-pooling, which reduce the spatial dimensions and introduce non-linearity to the model. This is followed by several fully connected layers, with ReLU activation functions applied after each layer to ensure non-linearity.

Regularization Techniques:

  • Dropout layers are incorporated between the fully connected layers to prevent overfitting by randomly setting a fraction of the input units to zero during training.
  • Regularization techniques like L1 or L2 regularization is applied to the model's parameters to penalize large weights and enhance generalization.
  • Early stopping is used to monitor the validation performance and halt training when the model's performance ceases to improve, thereby preventing overfitting.

Model Summary:

The following is a summary of the CNN model used for classifying OCTMNIST images:

  OCTMNIST_CNN(
(conv1): Conv2d(1, 16, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(relu1): ReLU()
(conv2): Conv2d(16, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(relu2): ReLU()
(pool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(fc1): Linear(in_features=1568, out_features=256, bias=True)
(fc2): Linear(in_features=256, out_features=128, bias=True)
(fc3): Linear(in_features=128, out_features=64, bias=True)
(fc4): Linear(in_features=64, out_features=32, bias=True)
(fc5): Linear(in_features=32, out_features=4, bias=True)
(dropout): Dropout(p=0.1, inplace=False)
)

Model Evaluation Results

The evaluation results of the CNN model over 7 epochs are shown below:

Training and Validation Accuracy

accuracy_plot

Training and Validation Loss

loss graph-train-valid

Confusion Matrix

oct_confusion_matrix

Results:

  • The model achieved a consistent improvement in both training and validation accuracy over the 7 epochs, starting with 71.75% training accuracy and reaching 86.20% by the end. Validation accuracy also increased from 80.36% to 85.88%, demonstrating effective learning and generalization.

  • The final test accuracy of 85.76%, along with a precision of 0.8309, recall of 0.8576, and F1 score of 0.8318, indicates that the model performs well on unseen data, balancing precision and recall effectively. The training process, completed in approximately 1971.55 seconds, showcases the efficiency and robustness of the model.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published