# A Deep Learning Model for Detecting Diabetic Retinopathy Stages with Discrete Wavelet Transform
## 4 Results
### Model Evaluation  
The preprocessed image is depicted in Figure 6. The APTOS-DDR combined data are employed for training and validating the model. For training, 70% of the data are used, and 15% for validation. The CNN layers extract the features, and the fully connected layers classify the data according to the class labels provided. The validation accuracy and loss are displayed in Table 4. The initial learning rate is 0.001. It was tuned during the training by the model, using ReduceLROnPlateau. The models utilized sparse categorical loss entropy. The Adam optimizer shows approximately 75.14% validation accuracy with a loss of 0.8257. The accuracy of training and validation is shown in Figure 7. The EarlyStopping parameter stops the Adam model at the 27 th epoch, the RMSProp at the 30 th, the SGD at the 31 st, the Adagrad at the 22 nd, and the Adamax at the 27 th. Similarly, the loss of training and validation is depicted in Figure 8.  
The test data contains 650 images from APTOS-DDR images. Table 5 illustrates the model's performance. The Adam optimizer model performs better than others, with 71.85% accuracy and a 0.72 recall. The F1-score is also the highest in the Adam model, with a value of 0.71. The RMSProp optimizer has the lowest accuracy, with 62.31% accuracy, and Adagrad, with 65.59%. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Optimizers** & **Accuracy** & **Loss** \\ \hline Adam & 75.14\% & 0.8257 \\ SGD & 73.31\% & 0.7446 \\ Adamax & 73.13\% & 0.8103 \\ Adagrad & 61.54\% & 0.9456 \\ RMSProp & 62.77\% & 0.8991 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: The validation accuracy of the APTOS-DDR dataset. Figure 6: The original and preprocessed image in the model: (**a**) raw image, (**b**) CLAHE preprocessed image, and (**c**) sample of approximation coefficients from DWT preprocessing. \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline Image size & 224 \\ Initial Learning rate & 0.001 \\ Optimizer & Adam, SGD, Adamax, Adagrad, RMSProp \\ Loss function & SparseCategoricalEntropy \\ Epoch & 70 \\ Batch Size & 32 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: The training parameter of the model. Figure 7: The accuracy plot of training and validation data: (**a**) Adam optimizer, (**b**) RMSProp optimizer, (**c**) SGD optimizer, (**d**) Adagrad optimizer, and (**e**) Adamax optimizer. Figure 8: The loss plot of training and validation data: (**a**) Adam optimizer, (**b**) RMSProp optimizer, (**c**) SGD optimizer, (**d**) Adagrad optimizer, and (**e**) Adamax optimizer. The confusion matrix is depicted in Figure 10, illustrating how each class's performance is assessed for the model. The proportion of successfully categorized examples for each class is displayed in the diagonal cells. Here, class 0, the Normal images, predicts 90% of the images correctly; class 1 (mild) predicts 63%; class 2 (moderate) predicts 78%; class 3 (severe) predicts only 28%; and class 4 (proliferative) predicts 73% of the correct images. Considering more images for class 4 for better performance can be a future enhancement. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Optimizer** & **Accuracy** & **Recall** & **Precision** & **F1-Score** & **Loss** \\ \hline Adam & 71.85\% & 0.72 & 0.71 & 0.71 & 0.8049 \\ SGD & 68.43\% & 0.68 & 0.69 & 0.64 & 0.8536 \\ Adamax & 69.16\% & 0.69 & 0.59 & 0.61 & 1.0942 \\ Adagrad & 65.69\% & 0.66 & 0.64 & 0.64 & 0.8918 \\ RMSProp & 62.31\% & 0.62 & 0.63 & 0.61 & 0.8922 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: The test accuracy results of all optimizers. Figure 10: The confusion matrix of the best model with the Adam optimizer. Figure 9: The comparison of the proposed model’s performance with the test dataset. As the AUC approaches 1, the model becomes more accurate. Table 6 depicts the AUC score of the models. The AUC score shows that all models are good enough to classify the labels. The Adam optimizer model shows a 0.9042 AUC score, SGD has 0.8834, Adamax has 0.8759, Adagrad a score of 0.8815, and RMSProp has 0.8831.