Skip to content

coyotegil/optical_coherence_tomography

 
 

Repository files navigation

Optical Coherence Tomography

image

A deep learning system to classify images from Optical Chorerence Tomography (OCT) images

  • Free software: MIT license

Data

The dataset can be found from: https://data.mendeley.com/datasets/rscbjbr9sj/2 It contains 84,484 images (JPEG) in 4 categories:CNV,DME, DRUSEN, NORMAL. The images are divided to train and test sets.

image

SimCLR training and evaluation

SimCLR = a simple framework for contrastive learning of visual representations. It was introduced by Google Research in 2020. The code is based on this repository: https://github.com/sayakpaul/SimCLR-in-TensorFlow-2 The Simclr folder can be found under src folder. SimCLR is a self-supervised method that tries to maximize agreement between two differently augmented views of the same sample image. The base encoder network is Resnet50v2. The model can be trained with SimCLRinTensorflow2.py. The results can be evaluated by adding a linear classifier on top of the base encoder network and training with a small amount of labelled data. This is done in linearEvaluation.py. We were able to reach 96% accuracy with 2% of training data when SimCLR was trained using transfer learning with Resnet50v2 and finetuned with labelled data. Here are the results:

Training:

image

The confusion matrix and metrics for test data:

image

t-SNE is used for visualizing the features after the base encoder network:

image

Comparison of results

image

Web application

This application lets the user upload an OCT image and shows classification results along with GradCam generated information about which parts in the image affected the model's decision. The octapp folder contains the files and folders required for a deployable web application to AWS Elastic Beanstalk. The model folder created by Tensorflow's model.save must be called "model" and saved under the folder "static". Also create a folder called "uploads" under static. The user's uploaded images will be saved here along with respective gradcam images. To run the app make sure you have configured AWS credentials. Then install EBS CLI with

pip install awsebcli --upgrade --user

To deploy, navigate to the octapp folder that contains the application.py. Change the region to whichever you need to use. Run:

eb init -p python-3.7 rpsapp --region us-west-2

Then run:

eb create rpsapp --instance_type t2.large

Finally you can open your application with

eb open

and close the application with

eb terminate octapp

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 93.3%
  • Python 4.6%
  • Swift 1.8%
  • HTML 0.2%
  • Shell 0.1%
  • JavaScript 0.0%