Professional Documents
Culture Documents
Deep Learning
Understanding and using deep learning networks
< Gartner Peer Insights 2020 Multiple-Order Modeling for Accuracy Improvement >
ANNOUNCEMENT Diabetic Retinopathy (DR) is one of the leading cause for blindness, affecting over 93 million people across the world. DR is an eye disease
Redesign of File Exchange Review associated with diabetes. Detection and grading DR at an early stage would help in preventing permanent vision loss. Automated detection and
Section grading during the retinal screening process would help in providing a valuable second opinion. In this blog, we implement a simple transfer-learning
based approach using a deep Convolutional Neural Network (CNN) to detect DR.
The community team is pleased to
Please cite the following articles if you're using any part of the code for your research:
release a new design for File...
Narayanan, B. N., Hardie, R. C., De Silva, M. S., & Kueterman, N. K. (2020). Hybrid machine learning architecture for automated detection and
grading of retinal images for diabetic retinopathy. Journal of Medical Imaging, 7(3), 034501.
Recent Posts Archive Narayanan, B. N., De Silva, M. S., Hardie, R. C., Kueterman, N. K., & Ali, R. (2019). Understanding Deep Neural Network Predictions for
Medical Imaging Applications. arXiv preprint arXiv:1912.09621.
28 JUN Jumpstart your DCASE Challenge 2021
using MATLAB
The Kaggle blindness detection challenge dataset (APTOS 2019 Dataset) contains separate training and testing cases. In this blog, we solely
3 JUN Building a High Five Counter Using Deep utilize the training dataset to study and estimate the performance. These images were captured at the Aravind Eye Hospital, India. The training
Learning dataset contains 3662 images marked into different categories (Normal, Mild DR, Moderate DR, Severe DR, and Proliferative DR) by expert
clinicians. Note that, in this blog, we solely focus on detecting DR, you could find more details about our grading architecture in our paper.
21 MAY Deep Learning Based Surrogate
Models Grouping Data by Category
10 MAY Semantic Segmentation for Medical
Imaging We extract the labels from excel sheet and segregate the images into 2-folders as 'no' or 'yes' as we're solely focused on detecting DR in this blog.
The helper code for splitting the data into categories is at the end of this post.
3 MAY Accelerating Deep Learning Training with
MATLAB and NVIDIA NGC Load the Database
MATLAB for Deep Learning Let's begin by loading the database using imageDatastore. It's a computationally efficient function to load the images along with its labels for
analysis.
A. Overview
Start Hunting!
Let's visualize the images and see how images differ for each class. It would also help us determine the type of classification technique that could
be applied for distinguishing the two classes. Based on the images, we could identify preprocessing techniques that would assist our classification
process. We could also determine the type of CNN architecture that could be utilized for the study based on the similarities within the class and
differences across classes. In this article, we implement transfer learning using inception-v3 architecture. You can read our paper to see the
performance of different preprocessing operations and other established architectures.
% Number of Images
num_images=length(imds.Labels);
subplot(4,5,idx);
imshow(imread(imds.Files{perm(idx)}));
title(sprintf('%s',imds.Labels(perm(idx))))
end
Let’s split the dataset into training, validation and testing. At first, we are splitting the dataset into groups of 80% (training & validation) and 20%
(testing). Make sure to split equal quantity of each class.
Let’s adopt a transfer learning approach to classify retinal images. In this article, I’m utilizing Inception-v3 for classification, you could utilize other
transfer learning approaches as mentioned in the paper or any other architecture that you think might be suited for this application. My MathWorks
blogs on transfer learning using other established networks can be found here: AlexNet, ResNet
Training
We will utilize validation patience of 3 as the stopping criteria. For starters, we use 'MaxEpochs' as 2 for our training, but we can tweak it further
based on our training progress. Ideally, we want the validation performance to be high when training process is stopped. We choose a mini-batch
size of 32 based on our hardware memory constraints, you could pick a bigger mini-batch size but make sure to change the other parameters
accordingly.
netTransfer = trainNetwork(augimdsTrain,incepnet,options);
% Actual Labels
actual_labels = imdsTest.Labels;
% Confusion Matrix
figure
plotconfusion(actual_labels,predicted_labels)
title('Confusion Matrix: Inception v3');
% ROC Curve
test_labels=double(nominal(imdsTest.Labels));
[fp_rate,tp_rate,T,AUC] = perfcurve(test_labels,posterior(:,2),2);
figure;
plot(fp_rate,tp_rate,'b‐');hold on;
grid on;
xlabel('False Positive Rate');
ylabel('Detection Rate');
We visualize the Class Activation Mapping (CAM) results for these networks for different DR cases using the code:
https://www.mathworks.com/help/deeplearning/examples/investigate-network-predictions-using-class-activation-mapping.html. This would help in
providing insights behind the algorithm's decision to the doctors.
Conclusions
In this blog, we have presented a simple deep learning-based classification approach for CAD of DR in retinal images. The classification algorithm
using Inception-v3 without any preprocessing performed relatively well with an overall accuracy of 98.0% and an AUC of 0.9947 (results may vary
because of the random split). In the paper, we studied the performance of various established CNN architectures for the same set of training and
testing cases under different preprocessing conditions. Combining the results of various architectures provides a boost in performance both in
terms of AUC and overall accuracy. A comprehensive study of these algorithms, both in terms of computation (memory and time) and performance,
allows the subject matter experts to make an informed choice. In addition, we have presented our novel architecture approaches in the paper for
detection and grading of DR.
Dr. Barath Narayanan graduated with MS and Ph.D. degree in Electrical Engineering from the
University of Dayton (UD) in 2013 and 2017 respectively. He currently holds a joint appointment as
a Research Scientist at UDRI's Software Systems Group and as an Adjunct Faculty for the ECE
department at UD. His research interests include deep learning, machine learning, computer vision,
and pattern recognition.
Helper Code
Code for grouping data by DR category (yes or no)
After downloading the ZIP files from the website and extracting them to a folder called "train_images". Make sure to download the excel sheet
(train.csv - convert it to .xlsx for this code) containing the true labels by expert clinicians. We extract the labels from excel sheet and segregate the
images into 2-folders as 'no' or 'yes' as we solely focus on detecting DR in this blog.
% Class Names
class_names={'No','Yes'};
mkdir(sprintf('%s%s',two_class_datapath,class_names{1}))
mkdir(sprintf('%s%s',two_class_datapath,class_names{2}))
% Merge all labels marked into Mild, Medium, Severe and Proliferative DR
% into a single category 'Yes'
train_labels(train_labels~=0)=2;
% Filename
filename=text_data(2:end,1);
% Now, write these images 2‐folders 'Yes' or 'No' for us to develop a deep
% learning architecture utilizing Deep learning toolbox
% Determine the Files put them in separate folder
for idx=1:length(filename)
clear img;
end
Like | Follow
Category: Deep Learning Tweet Share Share 5
< Gartner Peer Insights 2020 Multiple-Order Modeling for Accuracy Improvement >
See Also
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.
MathWorks Explore Products Try or Buy Learn to Use Get Support About MathWorks
Accelerating the pace of engineering and
MATLAB Downloads Documentation Installation Help Careers
science
Help
Simulink Trial Software Tutorials Newsroom
MathWorks is the leading developer of
Answers
mathematical computing software for Student Software Contact Sales Examples Social Mission
engineers and scientists. Consulting
Hardware Support Pricing and Videos and Contact Sales
Licensing Webinars License Center
Discover… File Exchange About MathWorks
How to Buy Training Contact Support
United States
Join the conversation
Patents Trademarks Privacy Policy Preventing Piracy Application Status Terms of Use
© 1994-2021 The MathWorks, Inc.