Diagnosis of Diabetic Retinopathy Using Machine Learning

Diabetic retinopathy is an eye condition that can cause vision loss and blindness in people who have diabetics. It affects blood vessels in the retina. Initially, Diabetic retinopathy may not have any symptoms, but finding it early can help us to take steps to protect our vision. Some people notice changes in their vision, like trouble in reading or seeing faraway objects, these changes may come and go. In later stages of diseases, blood vessels in the retina starts to bleed into the vitreous. If this happens, you may see dark, floating spots or streaks that look like lobwels. Sometimes the spots clear up on their own, but it is important to start the treatment, otherwise it may get worse and the bleeding can happen again. There are various stages, it includes blurred vision, impairment of color vision, floaters, patches or streaks. Hence in our project, we came up with an idea of identifying diabetic retinopathy in early stages, to classify a given set of images into four classes, we are using supervised learning methods. For this task, we use deep learning technique with inception v3module along with skin locus model in order to achieve better results and for easy classification of images


Introduction
Damage occurs to the retina due to diabetes is known as Diabetic retinopathy.It can eventually lead to blindness.It is a systemic disease, an ocular manifestation of diabetes, affecting up to 80 percent of all patients who have had diabetes for more than 20 years.Diabetic retinopathy often has no early warning signs.Macular edema, which can cause rapid vision loss, even may not have any warning signs for some time.However, a person with macular edema is likely to have blurred vision, making it hard to do things like read or drive in general.The vision will get better or worse during the day for some cases.
There are no symptoms in the first stage which is called non-proliferative diabetic retinopathy (NPDR), the signs are not visible to the eye and patients will have 20/20 vision.Fundus photography is the only way to detect NPDR, in which micro aneurysms (microscopic bloodfilled bulges in the artery walls) can be seen.Fluorescein angiography can be done to see the back of the eye, if there is reduced vision.The blocked retinal blood vessels can be seen clearly and this is called retinal ischemia (lack of blood flow).Blood vessels leak their contents at any stage of NPDR into the macular region in Macular edema.Blurred vision and darkened or distorted images that are not the same in both eyes are the symptoms of macular edema.10% of diabetic patients will have vision loss related to macular edema.Optical 13 Coherence Tomography can show the areas of retinal thickening (due to fluid accumulation) of macular edema.Abnormal new blood vessels (neovascularisation) form at the back of the eye as part of proliferative diabetic retinopathy (PDR); these can burst and bleed (vitreous hemorrhage) and blur the vision, because these new blood vessels are fragile in the second stage.It may not be very severe at the first stage of bleeding.It will leave just a few specks of blood, or spots floating in a person's visual field, though the spots often go away after a few hours in most cases.These spots are often followed within a few days or weeks by a much greater leakage of blood, which blurs the vision.A person may only be able to tell light from dark in that eye in extreme cases.It may take the blood anywhere from a few days to months or even years to clear from the inside of the eye, and in some cases the blood will not clear.Large hemorrhages tend to happen more than once, often during sleep in most cases.A doctor will see cotton wool spots on funduscopic exam, flame hemorrhages (similar lesions are also caused by the alpha-toxin of Clostridium novyi), and dot-blot hemorrhages.
People with diabetes mellitus are at risk -mostly those with Type I diabetes and those with Type II diabetes.The longer a person has diabetes, the higher their risk of 14 developing some ocular problem.40 to 45 % of Americans diagnosed with diabetes have some stage of diabetic retinopathy.After 20 years of diabetes, nearly all patients with Type I diabetes and >60% of patients with Type II diabetes have some degree of retinopathy; however, these statistics were published in 2002 using previous four years data, limiting the usefulness of the research.The subjects would have been diagnosed with diabetes in the late 1970s, before modern fast acting insulin and home glucose testing.Diabetic retinopathy occurs due to the result of microvascular retinal changes.Hyperglycemia induced intramural pericyte death and thickening of the basement membrane led to incompetence of the vascular walls.These damages can change the formation of the blood-retinal barrier and also make the retinal blood vessels become more permeable.Hypoxia, implicated as a causative factor in the degradation of the retina and some early investigations have supported this hypothesis.Pericyte death is caused when "hyperglycemia persistently activates protein kinase to increase the expression of a previously unknown target of PKC-δ signaling, Src homology-2 domain-containing phosphatase-1 (SHP-1), a protein tyrosine phosphatase.This signaling cascade leads to PDGF receptor dephosphorylation and a reduction in downstream signaling from this receptor, resulting in pericyte apoptosis [1].Small blood vessels -such as those in the eye -are especially vulnerable to poor blood sugar (blood glucose) control.An over accumulation of glucose and/or fructose damages the tiny blood vessels in the retina.During the initial stage, called non proliferative diabetic retinopathy (NPDR), most people do not notice any change in their vision.Early changes that are reversible and do not threaten central vision are sometimes termed simplex retinopathy or background retinopathy.Diabetic retinopathy is one of the leading disabling chronic diseases, and one of the leading causes of preventable blindness in the world.Early diagnosis of diabetic 15 retinopathy enables timely treatment and in order to achieve it a major effort will have to be invested into screening programs and especially into automated screening programs.For automated screening programs to work robustly efficient image processing and analysis algorithms have to be developed.This work examines recent literature on digital image processing in the field of early detection of diabetic retinopathy using fundus photographs [2].Algorithms were categorized into 5 groups (image preprocessing, localization and segmentation of the optic disk, segmentation of the retinal vasculature, localization of the macula and fovea, localization and segmentation of diabetic retinopathy pathologies).Diabetic retinopathy pathologies were further categorized into several groups.In this paper several different databases are presented and their characteristics discussed.
The National Eye Institute provides a standardized description of the severity class of DR patients (which are the classes that our classifier predicts).There are four severity classes, the first three describe non-proliferative DR (NPDR) and the last proliferative DR (PDR).The severity scales are characterized through a progression of four stages: Mild NPDR -Lesions of micro-aneurysms, small areas of balloon-like swelling in the retinas blood vessels.Moderate NPDR -Swelling and distortion of blood vessels, extensive micro-aneurysm, retinal hemorrhage, and hard exudates.Severe NPDR -Various abnormalities, large blot hemorrhages, cotton wool spots and many blood vessels are blocked, which causes abnormal growth factor secretion PDR -Growth factors induce proliferation of new blood vessels inside surface of retina, the new vessels are fragile and may leak or bleed, scar tissue from these can cause retinal detachment.
This is an ongoing problem on kaggle which tries to develop a model for DR detection.Dataset is taken from the challenge-data part.Data set consists of highresolution eye images and graded by trained professionals in 5 classes (0-4) as shown in Figure 1 and Figure 2.

Exudates Detection
The method we have applied to detect exudates on human retina is inspired by the work described in the above Figure 3. Since the data set is of completely different characteristic as we have changed in various sides.That is why we are going to describe every step and the reason behind taking it.Here we need to mention that we have implemented some library provided.We have also used MATLAB version 2017a for this project and this detection consists of the following steps: • Preprocessing the image.
• Detection of Optic disc and other artifacts.
• Detection of exudates in terms of optic disc and artifacts.In the pre-processing step first we extract intensity constituents from an image.Here we are going to work with gray-scale images because exudates are mostly visible in such images.We then apply Median Filtering for reducing the noise and apply Histogram Equalization to enhance contrast and brightness.The resulting image helps us to detect optic disc and accordingly exudates.This works as input image.Exudates are high intensity values as well as optic disk.Therefore in order to go forexudates detection we need to find optic disc and then we need to differentiate between optic disc and exudates near and inside the optic disc area.To do this we consider that optic disc is the largest and most circular part in brightest portion of the image.We apply Gray Scale Closing to remove blood vessels in the retina mostly in the optic disc area [5].Here we take a flat disc shaped structure element and consider the radius is eight.We threshold the image to binaries it and use the resulting image as a mask.Then the mask is inverted by pixels before overlaying into the original image.We then apply reconstruction by dilation was on the overlaid image [6].We threshold the image and find the difference between the original image and the reconstructed image by the algorithm.Consequently, high intensity optic disc is detected and rests are removed.
In this part we faced a big problem of this approach.At the beginning of the process, vessels were removed by the Gray Scale Closing and reconstruction was applied on the image created from the original image.Therefore we are going to reconstruct vessels in the optic disc area.But we face a problem is that we are not getting one big circular optic disc.Rather we are actually detecting two or three big connected components in this step.To solve this problem we applied an addition dilation of the final mask.As a result the independent areas are connected together into a circular shape.Here we note that we have already detected artifacts and other bright spots in the image.That is why if we use too big dilation, it can lead to merge the optic disc with those areas [7].
For the proper additional dilation we have considered a flat disc shaped structured element with a radius of four.Since the optic disc and also some bright artifacts are detected in this process, we have estimated for every component of the mask in order to distinguish between the features some extra values.These additional values are termed as scores.Thus we have, Score = area * circularity 3 Here we have some case to give attention.Since we have situation that the feature rather than optic disc can become much larger than optic disc, we needed to give circularity more importance.We take elements of size more than 1100 pixels as an optic disc keeping the rest as artifacts.Here we do not classify small areas which can become exudates as artifacts.At this stage after optic disc extraction and artifacts detection we are going to detect exudates.As before, high intensity blood vessels are removed by Grey Scale Closing.Then we go for to get a standard deviation image which shows the main characteristics of nearly arranged exudates.The resulting image is being threshold by taking the radius is six.We than remove the outside shape of the retina and fill the holes by imfill ().We consider threshold to remove optic disc and artifacts.Finally the result is achieved when we apply a threshold at a level 0.01 between the original and the reconstructed one.The produced exudates mask image is overlaid into the main image to get a proper vision.

Color Histogram
In image processing and photography, a color histogram is a representation of the distribution of colours in an image.For digital images, a color histogram represents the number of pixels that have colours in each of a fixed list of color ranges that span the image's color space, the set of all possible colours.
The color histogram can be built for any kind of color space, although the term is more often used for three-dimensional spaces like RGB or HSV.For monochromatic images, the term intensity histogram may be used instead.For multi-spectral images, where each pixel is represented by an arbitrary number of measurements (for example, beyond the three measurements in RGB), the color histogram is Ndimensional, with N being the number of measurements taken.Each measurement has its own wavelength range of the light spectrum, some of which may be outside the visible spectrum

Skin Locus Model
Although different people have different skin color, but several studies have shown that the major difference lies largely in their intensity rather than their chrominance.
Several value distribution models have been compared in different color spaces (RGB, HSV, YCbCr, etc.)These distribution models have shown some efficiency in extracting skin-like regions under certain limited conditions.When only the chromaticity information is considered, also a relative robustness against intensity changes is achieved.However, this will not solve all the problems related to illumination and camera calibrations: skin chromaticities depend on the prevailing illumination and camera calibration light source.The more these two lighting factors differ, the bigger shift in chromaticities.Moreover, illumination color can be non-uniform over the face (in this case, even a proper calibration is not enough).To solve these problems, we propose to use the skin locus which has performed well with images under widely varying conditions.Skin locus (after Storing) is the range of skin chromaticities under varying illumination/camera calibration conditions in NCC (normalized color coordinate) space.In NCC space, intensity is defined as I= R+G+B and chromaticities are r=R/I, g=G/I and b=B/l.Because r+g+b=l, only the intensity and two chromaticity coordinates are enough for specifying any color uniquely.We considered r-b coordinates to obtain both robustness against intensity variance and good overlap of chromaticities of different skin colours.The lower bound is defined by a five-degree polynomial function.Pixels with chromaticity (r,b) are labelled as skin or not using the constraint.

Inception V3 Model
Inception v3 is a widely-used image recognition model that has been shown to attain greater than 78.1% accuracy on the ImageNet dataset.The model is the culmination of many ideas developed by multiple researchers over the years.

Parameters in Inception V3
All convolutional layers are followed by batch norm and ReLU activation.Architecture is based on their GitHub code.Inception-v3 is a successor to Inception-v1, with 24M parameters Inception Neural Network Inception is a technique originally used in LeNet, this was a successful convolutional neural network or CNN for identifying patterns in images.It was designed by Yann LeCun and his colleagues.An inception module when a CNN uses convolutions kernels of multiple sizes as well as pooling within one layer.

Deep Learning Toolbox Model for Inception-v3 Network
Inception-v3 is a pre-trained model that has been trained on a subset of the ImageNet database.The model is trained on more than a million images, has 316 layers in total, and can classify images into 1000 object categories (e.g.keyboard, mouse, pencil, and many animals).
Opening the inceptionv3.mlpkginstallfile from your operating system or from within MATLAB will initiate the installation process for their lease you have.This file is functional for R2014b and beyond.Transfer learning is a machine learning method which utilizes a pre-trained neural network.For example, the image recognition model called Inception-v3 consists of two parts: Feature extraction part with a convolutional neural network.Classification part with fully-connected and SoftMax layers as shown in Figure 4.

Results and Discussions
Image is selected from a dataset, then the image is converted to gray scale from RGB.Then it is again converted to HIS using Histogram equalization.Filtration, Segmentation and binary conversion takes place simultaneously and the result is displayed in the screen as shown in Figure 5.

Conclusion and Future Scope
The algorithm detects HE lesions based on color, using a statistical classification and by the sharpness of its edges, applying a Kirsch operator.Our results demonstrate that the system is well suited to complement the screening of DR and may be used to help the ophthalmologists in their daily practice.