## 4 Results and Discussion
### Network Architecture
After applying GlobalMaxPool2D, the resulting tensor can be passed to a fully connected layer or other types of layers that process one-dimensional data vectors. In this study, the model was compiled using the Adam optimizer with customized beta parameters and a defined loss function, which was the sum of MSE and MAE. When the loss function is a combination of MSE and MAE, it affects how the model learns to minimize errors. MSE penalizes large errors more severely (due to the squares of differences), whereas MAE treats all errors equally. Combining these loss functions means that the model will aim to reduce both large and small errors. The gradient of MSE is steeper for larger errors, causing the model to learn faster from significant errors. The MAE gradient is constant, leading to a more consistent learning rate across all errors. MAE is more resistant to outliers than MSE because it does not involve squared differences. A loss function that combines MSE and MAE can lead to faster convergence in some cases by leveraging the strengths of both methods. MSE can accelerate the reduction of large errors, while MAE can provide stability and a consistent learning pace. During training, a modification of the learning rate was applied after reaching a stable val_loss level for five epochs. The initial value was 0.001. Details regarding the learning parameters are provided in Table 3.  
The input dataset consisted of images with dimensions of 400 \(\times\) 400 and was divided into three parts: training, validation, and test sets in a 60/20/20 ratio. During training, \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Setting** \\ \hline Image size & 50 \(\times\) 50 \(\times\) 3 \\ Loss function & MSE + MAE \\ Optimizer & Adam \\ Initial learning rate & 0.001 \\ Metric & RMSE \\ Batch size & 30 \\ Epoch & 20 \\ Shuffle & Every epoch \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Parameters of network training. 50 \(\times\) 50 squares were dynamically cropped from the images, and these squares served as the direct input to the first layer of the network. There were six different variations of testing in deep learning for training a regression algorithm to determine vitamin C concentration based on images: original images for artificial lighting, matched images for artificial lighting, original images for natural lighting, matched images for artificial lighting, original images for mixed dataset, and matched images for mixed dataset. For each of them, the model was trained (Section 3.2) and predictions were made. Training and validation losses for calculations of artificial light data, for both original and histogram-matched images, are presented in Figure 11. The range was similar in both cases; however, the value fluctuations were smaller for matched images, and in this condition, validation and training losses were more similar to each other. Figure 12 presents the results of the prediction made using the presented neural network. There were three sets of pairs of outcomes: artificial lightning, natural lightning, and mixed data. Each set was repeated for both the original images and the processed ones. There was an improvement in the higher concentration values for each of the conditions (Table 4). The standard deviation of the predictions was lower when applying the proposed standardization method. The highest difference could be seen in the case of artificial light, which could be caused by the uniformization of light reflections visible in the original images.