## 3 Results
### Model Training  
#### 3.2.1 MobileNetV2  
MobileNetV2 was selected as the base model for transfer learning. To prevent overfitting, the early stopping technique was applied. The training results showed that the red light achieved a true positive (TP) rate of 1.00 for all image processing techniques, except for the original, which yielded a TP of 0.99, as shown in Figure 9. This demonstrates the model's excellent performance in accurately predicting the red light. Among the techniques, histogram equalization (HE) and CLAHE produced the lowest false positive (FP) rate of 0.0039. When comparing the image processing methods from best to worst based on overall performance, CLAHE and HE are tied for first, followed by normalization and, lastly, the original. Figure 8: Light control and egg tray. Figure 9: Confusion matrix of MobileNetV2 under red light. (**a**) Original image, (**b**) normalization, (**c**) HE, and (**d**) CLAHE. For the green light, all image processing techniques provide TP values between 0.98 and 0.99, which shows very good performance. HE and CLAHE slightly increase the false negative (FN) values compared to the original. Normalization gives a TP of 0.99, as shown in Figure 10, which is better than both CLAHE and HE. Therefore, the performance for the green light from best to worst is normalization, HE equals CLAHE, and, lastly, the original. For the blue light, the original image gives a TP of 1 and an FN of 0. However, the FP is as high as 0.098, showing a strong tendency toward over-predicting positive cases, as shown in Figure 11. This means that many good eggs are predicted as bad ones. On the other hand, CLAHE reduces the FP to 0.041 while still maintaining a TP of 1. HE increases the FN and also gives the lowest true negative (TN) value at 0.94. Based on these results, the performance from best to worst for the blue light is CLAHE, original, normalization, and, lastly, HE. For the white light, all image processing techniques give the lowest TP values compared to the other colors. The original and normalization give TP values of 0.98 and 0.97, respectively. HE and CLAHE reduce the TP to 0.94 and 0.93, and they also increase FP. This shows that HE and CLAHE are not suitable for white lighting conditions as shown in Figure 12. The performance order for this class from best to worst is original, normalization, HE, and, lastly, CLAHE. Table 2 presents the detailed analysis results. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Color** & **The Best Pre-Processing** & **Details** \\ \hline Red & HE and CLAHE & Lowest FP and FN = 0 \\ Green & Normalization & Highest TP, FP lower than HE \\ Blue & CLAHE & Reduces FP most effectively without reducing TP \\ White & Original & HE/CLAHE degrades performance. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Summary of the best pre-processing results for each color of MobileNetV2. Figure 10: Confusion matrix of MobileNetV2 under green light. (**a**) Original image, (**b**) normalization, (**c**) HE, and (**d**) CLAHE. Figure 11: Confusion matrix of MobileNetV2 under blue light. (**a**) Original image, (**b**) normalization, (**c**) HE, and (**d**) CLAHE. Figure 12: Confusion matrix of MobileNetV2 under white light. (**a**) Original image, (**b**) normalization, (**c**) HE, and (**d**) CLAHE. Figure 13 shows the training and validation loss curves of the MobileNetV2 model, illustrating the application of the early stopping technique. The validation loss is monitored throughout the training process, and training is terminated when no improvement is observed for three consecutive epochs. As seen in the graph, the validation loss begins to increase after a certain point, indicating a potential risk of overfitting. Early stopping addresses this issue by restoring the model weights from the epoch where the validation loss was at its minimum, thereby preserving the best-performing version of the MobileNetV2 model. Figure 13: Training and validation accuracy and loss curves of MobileNetV2.