## 4 Model Implementation and Evaluation
### Model Implementation
The validation accuracy stabilizes around 0.9 but exhibits minor fluctuations, suggesting that the model is encountering difficulties in maintaining consistent performance on the validation dataset while optimizing for the training data. From 10 to 18 epochs, the training accuracy plateaus near 1.0, indicating that the model has nearly perfectly learned the training data. Meanwhile, the validation accuracy remains steady around 0.9, with slight fluctuations. Overall, the model demonstrates significant learning progress, with both training and validation accuracy improving rapidly during the early epochs. Figure 5: The training and validation accuracy of the four CNN models for each epoch using the test set with the ILRC. InceptionV3 training and validation accuracy analysis shows that during the first 0 to 3 epochs, both the training and validation accuracy start off relatively low but increase rapidly. The validation accuracy shows fluctuations during this time, suggesting that the model is refining its understanding of the data. Notably, the validation accuracy is higher than the training accuracy early on, indicating that the model generalizes well at this stage, potentially due to the regularization effect from using validation data. From 3 to 8 epochs, the training accuracy continues to rise and nearly reaches 1.0, demonstrating that the model is effectively fitting the training data. However, the validation accuracy displays some instability with fluctuations, which may indicate the model's sensitivity to varying batches of validation data. Between 8 to 13 epochs, the training accuracy stabilizes close to 1.0, indicating that the model has almost perfectly learned the training data. The validation accuracy stabilizes around 0.90 to 0.95, although it still experiences minor fluctuations. Overall, the model initially generalizes well to the validation data, as reflected by the high validation accuracy observed early in the training process. For InceptionResNetV2, the training accuracy rises quickly in the early epochs, showing that the model learns the training data patterns effectively. After around 5 epochs, the training accuracy levels off near 1.0, indicating a strong fit to the training data. In contrast, the validation accuracy starts to increase but then fluctuates between 0.90 and 0.92 after a few epochs. Figure 6 depicts the confusion matrices for the four CNN models over the test set of the balanced Kvasir v2 dataset. The test set was divided into eight classes: namely, esophagitis (313 images), dyed lifted polyps (333 images), dyed resection margins (291 images), normal pylorus (269 images), normal z-line (300 images), normal (300 images), polyps (308 images), and ulcerative colitis (286 images). The rows of the confusion matrix represent the actual classes. The columns represent the predicted classes by the model. The diagonal elements (from top-left to bottom-right) indicate the number of correct predictions for each class. Off-diagonal elements indicate misclassifications, where the model predicted the wrong class. The EfficientNet-B0 model correctly predicted the following number of instances for each class: 137 for class 0, 132 for class 1, 111 for class 2, 138 for class 3, 155 for class 4, 132 for class 5, 141 for class 6, and 147 for class 7. The ResNet101V2 model accurately predicted the number of instances for each class as follows: 141 for class 0, 129 for class 1, 105 for class 2, 138 for class 3, 156 for class 4, 122 for class 5, 134 for class 6, and 149 for class 7. The InceptionV3 model accurately predicted the number of instances for each class as follows: 139 for class 0, 134 for class 1, 123 for class 2, 132 for class 3, 155 for class 4, 125 for class 5, 145 for class 6, and 151 for class 7. The InceptionResNetV2 model accurately predicted the following number of instances for each class: 142 for class 0, 133 for class 1, 119 for class 2, 139 for class 3, 156 for class 4, 130 for class 5, 140 for class 6, and 148 for class 7.