Diabetic retinopathy (DR) is a progressive type of problem that affects diabetic people. In general, this condition is asymptomatic in its early stages. When the condition progresses, it can cause hazy and unclear vision of objects. As a result, it is necessary to develop a framework for early diagnosis in order to prevent visual morbidity. The suggested method entails acquiring fundus and OCT images of the retina. To acquire the lesions, techniques such as preprocessing, sophisticated Chan–Vese segmentation, and object clustering are used. Furthermore, regression-based neural network (RNN) categorization is used to achieve expected results that help foretell retinal diseases. The methodology is implemented using the MATLAB technical computing language, together with the necessary toolboxes and blocksets. The proposed system requires two steps. In the first stage, the detection of diabetic retinopathy via the proposed deep learning technique is carried out. The data collected from the MATLAB are transmitted to the approved PC via the IoT module known as ThingSpeak in the second stage. To validate the robustness of the proposed approach, comparisons with regard to plots of confusion matrices, mean square error (MSE) plots, and receiver operating characteristic (ROC) plots are performed.

1. Introduction

The medical industry is currently attempting to gain a significant advantage as the number of wearables, tablets, and virtual reality applications for Internet of Things (IoT) users has grown significantly. In this process, the combination of image processing with deep learning and data transfer IoT has become one of the most commonly used procedures today. An image can be improved or data can be extracted by using image-processing techniques to perform various operations to the image. According to the application, a picture or a set of characteristics or features can be generated by this type of signal processing [1]. Image analysts use a number of interpretative basics while working with visual tools [2]. Digital photographs can be altered using computers and digital image-processing techniques. When employing digital approaches, all kinds of data must undergo preprocessing, augmentation, presentation, and information extraction.

Colour fundus imaging and OCT are two of the most common imaging modalities used by an ophthalmologist. The colour fundus image depicts the retina’s two-dimensional image quite effectively. The retina’s reflection on the fundus camera [3] is captured and used to create a fundus image. Image sensors often capture the fundus image, which is a reflection of the eye’s internal surface. The retina, retinal veins, the macula, and the optic disc are only a few of the visible biological features that are discussed here [4]. The distortion of the retina can be seen in a colour fundus picture. However, it is impossible to gain access to the deteriorating depth of information. Imaging with the OCT is mostly employed in the field of ophthalmology to examine the retinal layers [5]. Ophthalmologists frequently detect fundus retinal illnesses, the majority of which are the result of retinopathy [6]. Automating the segmentation of retinal layers in retinal optical coherence tomography (OCT) pictures can assist better in identifying and monitoring eye illnesses [7]. Fundus nerve tissue can be examined using OCT, a minimally invasive, real-time imaging technique that provides a microresolution volumetric scan of biological tissues [8].

In this study, a deep learning-based regression neural network method for automating the segmentation of retinal layers using fundus or OCT images as input was tested. For the best potential results, deep learning techniques are applied to train the algorithms and learn which eye disease they are taught for.

Most, if not all, vision-related issues can be diagnosed and treated at an early stage. Until a few decades ago, digital image-processing methods were seen as the best option. Regression networks in combination with deep learning provide the most accurate classification results of any of the available methods, traditional or cutting-edge. The primary goals of the preprocessing and postprocessing techniques employed in this study are the reduction of image noise and the extraction of image characteristics. As a result of the simple preprocessing and postprocessing procedures employed here, any anomalies in the retina or macula can easily be seen.

2. Literature Survey

This section includes a comprehensive review of the relevant literature to the study’s findings. The use of computer-aided analysis methods, such as automatic segmentation, for segmenting retinal OCT pictures has grown steadily over the last few decades. An important and demanding stage in the development of computer-aided diagnosis systems for ocular illnesses is segmentation of the retina [9]. As an indicator of the health status or illness development, structural alterations (thickness or area measurements) are often utilized [10]. To obtain these measurements, the tissue boundaries must first be segmented [11]. As a result, specialists must manually mark these limits, which is a tedious and subjective process that could lead to inaccuracies [12].

Fundus retinal OCT images can be stratified using active contours, as described in [13]. In order to convert the segmentation method into a procedure for finding the energy function’s minimal value, they used continuous curves and an energy function. High-resolution optical coherence tomography (OCT) has been described by the authors of [5, 14]. High-resolution cross-sectional and volumetric images of the retina are provided by the SD-OCT results. To diagnose dry AMD and DME using OCT imaging, the researchers in [15] developed a classification system combining support vector machine (SVM) classifiers and histogram of oriented gradient (HOG) descriptors [16]. The inner retinal layers were not segmented in their proposed strategy. An OCT-based technique for identifying retinal diseases has been presented in [17] based on the inception network. The OCT algorithm presented with little training data and trained with nonmedical pictures can be fine-tuned. Researchers have looked into various methods of bolstering a diagnosis’ accuracy [18]. Researchers used an extreme learning machine and probabilistic neural networks to identify the retinal blood veins. Artificial neural networks and support vector machines (SVMs) were used by the researchers in [1921] for the categorization of diabetic retinopathy images, respectively, using fundus images as a source of data for machine learning identification. Data sets are small and labelling is expensive and time-consuming, making these studies difficult to implement despite their promising outcomes.

OCT research has focused on layer segmentation accuracy because it is critical for clinical interpretation. Image processing approaches such as active contour [22, 23], support vector machine [2426], and graph-based algorithms [2730] have been presented in the literature to segment retinal layer borders.

It has been demonstrated that deep learning (DL) can outperform standard methods in a variety of computer vision and image analysis applications. Consequently, its application to medical image analysis, including ophthalmology pictures, of course, has been prompted by its success in achieving the desired results by combining regression networks with current classifiers in order to achieve the desired results [6, 31, 32]. As a result, it is clear from the literature that regression-based deep learning procedures, as well as K-means clustering and morphological processing combined with IoT procedures, have not been examined. This has been identified as a research gap in order to carry out this work, together with preprocessing and postprocessing techniques involving K-means clustering and morphological processing.

3. Methodology

The proposed technique, depicted in Figure 1, begins by retrieving the retinal OCT and fundus pictures from the database. To remove undesired artefacts, the images must be preprocessed using a Gaussian filter and a bilateral filter. During the filtering process, the Gaussian filter is typically used, which is a smoothing operator that uses a convolution approach to blur the images and remove undesired information. This filtering function is commonly used to reduce noise and details in an image in order to improve the image structure. The Gaussian filter uses a Gaussian function, which describes the normal distribution function, to determine the transformation applicable to each pixel value in the associated images in a mathematical approach. The filtered image is then passed into a bilateral filter, which is a nonlinear filter that seeks to maintain edges while simultaneously reducing noise. The filtering procedure is carried out here by utilizing the geometric proximity as well as the similarity detected in neighbouring pixels to construct a filter kernel. During this edge-preserving smoothing method, each pixel in the image is replaced by a weighted average of the nearby pixels.

The filtered image is subjected to image segmentation using the Chan–Vese algorithm which is generally designed to divide the objects in an image even though a clear set of boundaries are defined. This algorithm is usually based on the level set theory which is evolved iteratively for energy minimization. This model of segmentation is quite capable for segmentation of any sort of images that would be difficult by means of classical methods of segmentation which use thresholding operation or the gradient type of procedures. Once the image is segmented by energy minimization, the objects are clustered by means of a k-means algorithm, which is an unsupervised algorithm used to segment the region of interest from the background part of an image.

Furthermore, the edge detection process is initiated by means of the gradient procedure, and the boundary tracing method for the segmented image is carried out which has foreground pixels and background pixels. The tracing of the boundaries is mainly divided into inner boundary and outer boundary labelled as one and zero, respectively, during simulation.

The resulted image provides the detected lesions which have active contours and is subjected to morphological enhancement before the features are extracted. The feature extraction is an iterative process which involves a winning process generally termed as bilinear interpolation. Further concatenation of histograms is processed to create the block of features which are normalized to be fed to regression neural network classification model. This model needs the variables to be continuous or real-valued variables (see Figure 1).

The regression models involve convolution network classification and utilize a regression layer in the network for the purpose of predicting the continuous-valued data. In this work, the training feature containing retinal issues is also fed to the model and also the target values indicated by retinal ailments such as diabetic retinopathy and other retinal diseases provide the feedback to the model. In the classification model, primarily, the SVM classifier is applied which is a supervised algorithm utilized for classification as well as regression issues. SVM uses the kernel procedure to transform the applied data and finds the optimal boundary values. The obtained values are later fed to the secondary classifier of the model represented as naive Bayes classifier. It belongs to the supervised learning algorithm family. It assists in assigning a class to the obtained features from the retinal imagery.

In the proposed application, based on the fundus images, DR-affected regions are observed as the region of interest, whereas in retinal OCT images, the thickness of the layers between the internal limiting membrane (ILM) and the retinal pigment epithelium (RPE) is considered as the region of interest. In this manner, the classification of retinal fundus and OCT images is established.

The final parameters are passed on to ThingSpeak which is MATLAB’s IoT cloud such that it can be shared to remote health centres to have multiple analyses by healthcare workers and proper treatment in time (Algorithm 1).

Step 1: Import retinal OCT and fundus images from the database
Step 2: Preprocess the images by applying Gaussian and bilateral filters
 %Gaussian filter as below equation for smooth impulse response and no ringing effects
Step 3: Image segmentation via Chan–Vese procedures
Step 4: Object clustering via K- means clustering(i)Choose “k” cluster centres at random.(ii)Determine the distance between each data point and the cluster centres.(iii)Assign the data point to the cluster centre with the shortest distance from the cluster centre among all cluster centres.(iv)Calculate the new cluster centre again.
Step 5: Edge detection and boundary tracking to identify lesions in OCT and fundus images.
Step 6: Carry out morphological enhancement for filling the gaps in objects
Step 7: Feature extraction and classification using regression deep-learning networks
Step 8: Transmission to remote areas via the IoT module

4. Experimental Results and Analysis

In a single frame, Figure 2 depicts the optical disc detection and segmentation interface. Figure 3 shows how the retinal picture is used in an iterative manner. The Gaussian filter and bilateral filters are used to preprocess the image. There are two types of smoothing filters: the Gaussian filter and the bilateral filter. The former is a low-pass filter that reduces noise by showing high-frequency components in the image and blurring areas of the image. Each pixel is replaced with a weighted average of the intensity values from surrounding pixels.

These filters change the appearance of the image by means of deep learning and smoothing. Later, the image segmentation process is carried out by means of clustering and thresholding to provide the final optical disc region as shown in Figure 4. Furthermore, the boundary tracking process is initiated at an iterative rate as shown in Figure 5, which clearly shows the marking and tracking of the boundaries of DR-affected regions.

The same process is further carried out for 60 iterations for vivid marking of the affected region as shown in Figure 6. Here, the affected region is visible in the form of an oval shape indicated as the region of interest. The framework as shown in Figure 7 is utilized for detection of diabetic retinopathy for fundus images. This framework clearly represents the procedures involved such as future extraction and classification via SVM and Bayes classification algorithms.

As a second phase of the test retinal OCT image as shown in Figure 8, performing the aforementioned procedure is considered in order to display the segmented layers of ILM and RPE. RPE describes a single layer of normal polygonal cells organized at the outer surface of the retina, whereas ILM represents the structural boundary seen between the vitreous and the retina, which has been suggested to act as a barrier for a wide range of retinal therapies; ILM represents the structural boundary between the vitreous and the retina, and RPE denotes a single layer of regular polygonal cells organized at the outer surface of the retina. The RPE is connected to Bruch’s membrane and the choroid on its outer side, while the inner side is attached to the outer layer of photoreceptor cells on its inner side.

Figure 9 explains the process of feature extraction from OCT images via the clustering process based on support vectors. Later, a trained data confusion matrix is plotted between the target and output classes which is shown in Figure 10 which clearly indicates that the performance with respect to the true value mentioned in the green boxes shows the insight into the data set.

Similarly, the test confusion matrix is derived as a final confusion matrix for target and output class variables as shown in Figure 11, which describes the performance of the classified and further utilized for which true values are known. For identifying and classifying diabetic retinopathy from OCT images, Figure 12.

To validate the performance of the proposed methodology, a plot of the mean square error (MSE) with respect to iterations (or) epochs and MSE for both trained data and validation are represented. The best MSE, which has to be low, is indicated by dotted lines on the graphical plot shown in Figure 13. It is observed that the green line is the validation value, which means the required MSE after the 46 epochs.

During the same procedure of RNN training, the error histogram as shown in Figure 14, concerning the training value at a zero-error line is mentioned as the red color line, which conveys the position if the error is a lease. Here, the histogram build with training and validation indicated by blue and green colours, respectively, is displayed at the zero-error line after 46 epochs. Similarly, gradient estimation with respect to validation check after 46 epochs is observed in Figure 15 during diabetic retinopathy with respect to OCT images.

Once training and validation are completed, an overall set of confusion matrices is derived as shown in Figure 16 during the detection process. It can be observed that the two positive values show the optimum results as indicated in green boxes for target and output classes.

After the confusion matrix is derived for training, testing, and the validation procedure shown in Figure 16, the final receiver operating characteristic (ROC) curve is as displayed in Figure 17, which is graphically plotted between the false positive rate and the true positive rate. The ROC curve is most often used to display the interrelationship between sensitivity and specificity for a cutoff value of the testing procedure. The area and the ROC graph must lie between “0.9 and 1.” Hence, the final ROC from our plot reaches the maximum best value of “1,” and the graphical plot is a linear progressive plot.

The final parameters are sent to the ThingSpeak module, MATLAB’s IoT cloud, for which interface dialog box appears as shown in Figure 18, such that it can be shared with remote health centres for numerous analyses by healthcare workers and proper treatment in real time.

5. Conclusion

A robust deep-learning regression technique is used, together with fundus and OCT layer segmentation and grouping. Following that, RNN classification using the support vector machine (SVM) and naive Bayes classifiers yields the precise segmented DR impacted regions and layers. The suggested procedure was simulated using the MATLAB programme on a system with 8 GB RAM and 2 GB VRAM to find the best solutions involving image acquisition and deep-learning toolboxes along with the ThingSpeak IoT Module. This work has been carried out on a prototype at the moment, and it can be extended further using the hardware setup to reach more population. Comparisons of confusion matrix plots, mean square error (MSE) plots, and receiver operating characteristic (ROC) plots are undertaken to confirm the robustness of the suggested technique. The classification additionally evaluates the normal and damaged retinal areas using cluster diagrams. The proposed method also included confusion matrices to characterize the subtle performance of the test data based on the true values acquired. As a result, the classification model’s performance demonstrates an ideal procedure for delivering expected outcomes by satisfying the statistical constraints specified in the findings. In order to ensure timely treatment, the final parameters are sent to ThingSpeak, MATLAB’s IoT cloud, so that it may be accessed by healthcare staff in faraway locations.

Data Availability

The processed data are available upon request from the corresponding author.

Conflicts of Interest

The authors declare that they have no conflicts of interest.