# Influence of Hyperparameters in Deep Learning Models for Coffee Rust Detection
## 4 Results
### Comparison between the Best Models by Pre-Trained Network  
Taking into account the validation results obtained in the previous section, the best model is chosen for each of the following backbones: DenseNet201, Xception, InceptionV3, MobileNetV2, VGG19, and InceptionResNetV2. For each trained model, inference was performed with the corresponding test images, and from the confusion matrices (Figure 10), four metrics were calculated, taking into account correct and incorrect classifications. Table 5 presents the values of _acc_, \(P\), \(R\), and \(F\)1 for the best model from each backbone obtained by transfer learning.  
Regarding the computational cost of the models, Table 6 presents the name of the last layer transferred, the training time of each epoch/step, the size in MB, and the number of model parameters. From this point of view, it is clear that VGG19 and MobileNetv2 are the fastest models to train, and the latter is significantly one of the lightest models in terms of disk size and number of parameters. Although the F1-score performance of these two models is relatively competitive, it is slightly lower than those obtained from DenseNet201 and InceptionV3.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Architecture** & **Last Layer** & **Time (s/epoch)** & **Avg ms/Step** & **Size (MB)** & **Param Num** \\ \hline Densenet201 & conv5\_block31\_concat & 112 & 93.2 & 219.1 & 30,112,963 \\ Inceptionv3 & mixed6 & 329 & 135.5 & 263.9 & 26,494,243 \\ Xception & block13\_sepconv1\_acc & 398 & 310.0 & 378.7 & 40,899,419 \\ MobileNetv2 & block14\_add & 30 & 25.9 & 16.9 & 20,066,755 \\ VGG19 & block4\_pool & 82 & 90.0 & 269 & 29,461,571 \\ InceptionResnetv2 & block8\_8\_mixed & 177 & 59.3 & 199 & 47,164,995 \\ \hline \hline \end{tabular}
\end{table}
Table 6: Classification models specification in terms of training time and size for models with the best result in present study.  
Figure 10: Confusion matrices of the models obtained from DenseNet201, Xception, MobileNetV2, Inception, VGG19 and InceptionResNetV2, by transfer learning. Multi-class classification with 0: Healthy, 1: Other, and 2: Rust. The darker the grid, the greater the number of cases located in that condition.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Pre-Trained Model** & **Learning Rate** & **Neurons** & **Optimizer** & **P** & **R** & **F1** & **Acc** \\ \hline DenseNet201 & \(1\times 10^{-5}\) & 256 & Nadam & 94.60 & 94.80 & 94.70 & 94.80 \\ InceptionV3 & \(1\times 10^{-5}\) & 256 & RMSprop & 94.10 & 94.30 & 94.20 & 94.20 \\ Xception & \(1\times 10^{-4}\) & 256 & RMSprop & 93.20 & 93.20 & 93.30 & 93.30 \\ MobileNetV2 & \(1\times 10^{-4}\) & 256 & RMSprop & 91.50 & 91.80 & 91.60 & 91.60 \\ VGG19 & \(1\times 10^{-4}\) & 256 & Nadam & 88.90 & 89.00 & 88.90 & 89.10 \\ InceptionResNetV2 & \(1\times 10^{-4}\) & 256 & RMSprop & 88.57 & 88.77 & 88.59 & 88.58 \\ \hline \hline \end{tabular}
\end{table}
Table 5: Performance metrics on test data of the best classification model for each architecture. \(P\) is precision, \(R\) is recall, \(F\)1 is F1-score and _acc_ is accuracy. Values are in percentages, with 100% being the best result and 0% being the worst performance result.