Ocular diseases are extensively-studied in the healthcare world as they affect millions of people. With this in mind, we decided to build an ML model in PerceptiLabs that applies image recognition techniques on fundus images to detect possible cataracts in patients. Using a model like this could help doctors, optometrists, and researchers to more easily classify and detect such conditions.
To train our model, we grabbed the Ocular Disease Recognition dataset on Kaggle that is comprised of fundus images representing seven ocular-related conditions as well as normal images (i.e., those depicting no-ocular-related conditions).
For our use case, we narrowed down the dataset to 293 images representing normal images and 293 representing cataracts. Each image is a .jpg file and has been preprocessed to 512x512 pixels.
We created a .csv file (dataset.csv) to map the classification labels for cataracts (C) and normal (N) to their respective image files for use in loading the data using PerceptiLabs' Data Wizard.
Below is a partial example of how the .csv file looks:
Example of the .csv file to load data into PerceptiLabs that maps the labels to their associated image files.
Our model was built with just three Components:
Training and Results
With a training time of just over 77 seconds, we were able to achieve a training accuracy of 100% and a validation accuracy of 97.44%. In the following screenshot from PerceptiLabs, you can see how the training and validation accuracy quickly ramped up during the first epoch, after which both remained fairly stable:
A model like this could be used to help screen for a variety of conditions detectable through fundus images and to notify doctors as to which cases may require a closer look.
Such a project could also be used by medical students or practitioners looking to build next-generation ML-based medical technology. The model itself could also be used as the basis for transfer learning to create additional models for detecting a variety of conditions using fundus images or other types of medical scans/imagery.
This use case is a simple example of how ML can be used to identify ailments using image recognition. If you want to build a deep learning model similar to this, run PerceptiLabs and grab a copy of our pre-processed dataset from GitHub.