# Colorectal Cancer Detection Tool Developed with Neural Networks
## 3 Results
### The CNN Model Results  
The architecture of the CNN has already been discussed, and the only changes occurring throughout the experiments are affecting the input resolution of the images. Firstly, the resolution of the images has increased from 128-by-156 to 640-by-640. These values must be specified when declaring the training parameters. Secondly, a third value for the resolution of the images is employed to ascertain whether the images are grayscale or RGB. The training parameters have been established. After the procedure, the following window will appear. Figure 8 presents information about the trained CNN, focusing on accuracy and training time. The cycle length is user-defined (20 epochs with 23 iterations per epoch). Performance metrics include accuracy, measured as the percentage of successful predictions. For example, with 100 images and 97% accuracy, the model correctly predicts the outcome for 97 images. Next, the results of CNN-based models are presented. Figure 8: Training information and results. Figure 7: Confusion matrix for the ANN model. Table 6 shows the performance of models with two outputs. The cases analyzed include gray and RGB images at various resolutions. Performance, measured as the percentage of images correctly labeled, is the more important characteristic, while training time is less important. Training time increases with higher image resolution and with RGB images instead of gray. This is due to increased computations. In RGB images, the number of matrices defining the image increases from 1 to 3. The best performance, 97.1%, is obtained at a resolution of 256 by 256. As illustrated in Figure 9, the progression of accuracy is demonstrated. In accordance with the principles that govern any training modality, the initial parameters are selected at random, and subsequent refinements to the performance can be made. In the initial 30 epochs, the error value for the modified validation images exhibited greater variability. However, in subsequent epochs, the error remained relatively constant and did not undergo significant fluctuations. In the context of experimentation, the number of epochs remains constant. However, it is possible to attain equivalent performance levels while utilizing a reduced number of epochs. For a better evaluation of the obtained models, a 10-fold cross-validation is used with stratified splitting to avoid class imbalance. The images are divided into 10 folds, using one for testing and the rest for training. This technique is used to have a better generalization estimate. A slight increase in performance has been observed when compared to models that have not employed the 10-fold cross-validation. All the models in this study used the same 10-fold cross-validation for the obtained CNN models. In Figure 10, the confusion matrix for the trained CNN is presented. Healthy and polyp-labeled present 99 and 97 predicted values out of 100. The confusion matrix is created using only the 200 images reserved for testing from the initial dataset. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Case** & **Resolution** & **Performance** & **Training Time (min:s)** \\ \hline Kvasir gray & 128 \(\times\) 156 & 91\% & 0:35 \\ \hline Kvasir gray rotated & 128 \(\times\) 156 & 92.5\% & 2:01 \\ \hline Kvasir rgb & 128 \(\times\) 156 & 93\% & 3:07 \\ \hline Kvasir gray rotated & 256 \(\times\) 256 & 96.7\% & 5:52 \\ \hline Kvasir rgb rotated & 256 \(\times\) 256 & 97.1\% & 9:16 \\ \hline Kvasir rgb rotated & 512 \(\times\) 512 & 96.9\% & 46:42 \\ \hline Kvasir rgb rotated & 640 \(\times\) 640 & 94.5\% & 120:29 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Training results for the CNN-based models with two outputs. Figure 9: Epoch evolution for the CNN with two possible outputs. Since the best results have been obtained for the 256-by-256 resolution, it has been chosen for the CNN with three possible outputs. The CNN model is trained with a new output for detecting ulcers. As performed before, 500 images are added, rotated, and resized for training.