## 5 Modeling
### Transfer Learning Utilizing Custom Fully Connected Layers  
The transfer learning approach is used to examine whether pre-trained models are more accurate in determining the data. For this purpose, ResNet50 and VGG16 models are used, both of which are integrated via Keras and used with their respective Imagenet [55] weights. As both models in the original configuration are not compatible with the classification of the four classes, the pre-trained classification head of the model is truncated and replaced by a custom head (see Figure 6). The architecture of the new classification head is based on experimental iterative experience. The size of the dense layers is gradually reduced in order to minimize the resulting space without using too large dense layers. Dense layers influence the computing time of a model considerably due to their high number of connections. In addition, two drop-out layers are used to prevent overfitting of the model. It is necessary to determine a sufficient learning rate for the model. Figure 7 shows the accuracy for three different learning rates across the course of the epochs. The number of epochs depends crucially on the initial weights and can therefore vary from seed to seed. Seed refers to a pre-defined value used to initialize the random number generator involved in the modeling process, ensuring that operations involving randomness are reproducible. The graphs of Figure 7 show the progression of accuracy on both training and validation datasets. Figure 7a displays the trend of the accuracy over the course of the epochs for dataset 1 (see Table 4) and Figure 7b displays the trend of the accuracy over the course of the epochs for dataset 2 (see Table 4). It can be seen that the three learning rates investigated achieve almost identical accuracy. In the course of the experiments, the learning rate \(1\times 10^{-5}\) is utilized, as it offers a good balance between not too rapid convergence and not too prolonged training times. The results of the model with both datasets show that neither the non-augmented nor the augmented dataset yields a validation accuracy of more than 0.9. The layer architecture settings are already specified by the base network architecture in transfer learning. Settings such as the batch size or the number of epochs provide scope through predefinition. Table 7 lists the relevant hyperparameters for the ResNet50 and VGG16 models. The number of epochs is set to 100. The use of 'early stopping' causes the learning process to be suspended after a phase of 10 epochs without further improvement. The best model weights are found and the performance of the model is checked with the test dataset. Figure 6: Top-layer architecture of the employed transfer learning models. The results of the F1 score in Table 8 show that both the ResNet50 model and the VGG16 model achieve almost identical performance. Even the type and nature of the input \begin{table}
\begin{tabular}{l l l} \hline  & **Hyperparameter** & **Specification** \\ \hline \multirow{3}{*}{General} & batch size & 32 \\  & epochs & 100 \\  & loss & sparse categorical crossentropy \\  & metrics & accuracy \\ \hline \multirow{3}{*}{EarlyStopping} & monitor & validation loss \\  & patience & 10 \\  & mode & auto \\  & restore best weights & True \\ \hline \multirow{3}{*}{Model Checkpoint} & monitor & val loss \\  & save weights only & False \\  & save best only & True \\ \hline \multirow{2}{*}{Optimizer} & Optimizer & adam \\  & Learning Rate & \(1\times 10^{-5}\) \\ \hline \end{tabular}
\end{table} 
Table 7: Hyperparameters of the pre-trained models (transfer learning). Figure 7: Training progress for learning rates \(1\times 10^{-4}\), \(1\times 10^{-5}\), and \(1\times 10^{-6}\) for the ResNet50 model with (**a**) dataset 1 (seed 456) and (**b**) with dataset 2 (seed 456). files are not of significant importance. The use of augmented datasets does not significantly improve the performance of the models either. The class'solid' is classified almost optimally in all models.