# A New Hybrid ConvViT Model for Dangerous Farm Insect Detection
## 4 The Experimental Results
As seen in Table 6, VGG-16 had 0.7955 precision, 0.7694 recall, and a 0.7743 F-score. ResNet-50 had F-scores above 0.8 for classes 8, 9, 11, 13, 14, and 15 compared to other classes. Table 6 highlights that VGG-16 had significantly lower precision and recall across multiple classes, suggesting its limited capability in detecting pests accurately. The model may benefit from more complex architectures or increased training data. Figure 9 shows the confusion matrix for EfficientNetB0, which achieved an accuracy of 90.27%, correctly identifying 325 out of 360 images. The confusion matrix suggests that the most common misclassifications occurred in Africanized honey bees (Class 1) and Colorado potato beetles (Class 7). Table 7 confirms this trend, showing lower F-scores for these classes while maintaining competitive precision and recall overall. As seen in Table 7, EfficientNetB0 had 0.9078 precision, 0.9027 recall, and a 0.9021 F-score. Compared to other classes, EfficientNetB0 had F-scores below 0.9 for classes 1, 5, 7, and 12. The results indicate that EfficientNetB0 is a reliable model but may require further tuning for improved performance in challenging pest categories. Experimental results for ConvViT are shown in Figure 10 and Table 8.  
Figure 10 shows the confusion matrix for ConvViT. It shows that ConvViT correctly classified 337 out of 360 images and incorrectly classified 23. The ViT had 93.61% accuracy. As seen in Table 8, ConvViT had 0.9396 precision, 0.9361 recall, and a 0.9355 F-score. Compared to other classes, ConvViT had an F-score below 0.9 for classes 1, 5, and 7. Table 8 confirms ConvViT's superiority, consistently achieving the highest F-scores across nearly all classes. The hybrid approach, integrating CNN-based local feature extraction with vision transformer-based global attention mechanisms, contributed significantly to its outstanding performance. Table 9 and Figure 11 summarize the comparative analysis of all models. ConvViT emerged as the best-performing model, with the highest classification accuracy (93.61%) and precision (93.96%). These results suggest that ConvViT successfully balances local and global feature extraction, resulting in superior classification performance across diverse pest species. Following ConvViT, the ViT, EfficientNetB0, DenseNet201, ResNet-50 and VGG-16 were the next most successful, in that order. \begin{table}
\begin{tabular}{c c c c} \hline
**Class** & **Accuracy** & **Precision** & **Recall** & **F-Score** \\ \hline \hline \multirow{2}{*}{Africanized honey bees (Class 1)} & 0.6666 & 0.5000 & 0.5714 \\ \hline \hline \multirow{2}{*}{Aphids (Class 2)} & 0.9166 & 0.9166 & 0.9166 \\ \cline{2-4}  & 1.0000 & 1.0000 & 1.0000 \\ \hline \multirow{2}{*}{Brown marmorated stink bugs (Class 4)} & 1.0000 & 0.8333 & 0.9090 \\ \cline{2-4}  & 0.9523 & 0.8333 & 0.8888 \\ \cline{2-4}  & 0.9583 & 0.9583 & 0.9583 \\ \hline \multirow{2}{*}{Colorado potato beetles (Class 7)} & 0.6129 & 0.7916 & 0.6909 \\ \cline{2-4}  & 1.0000 & 0.9583 & 0.9787 \\ \hline \multirow{2}{*}{Corn genurorms (Class 9)} & 0.9600 & 1.0000 & 0.9795 \\ \cline{2-4}  & 0.9230 & 1.0000 & 0.9600 \\ \hline \multirow{2}{*}{Fruit flies (Class 11)} & 0.9545 & 0.8750 & 0.9130 \\ \cline{2-4}  & 0.8214 & 0.9583 & 0.8846 \\ \hline \multirow{2}{*}{Thrips (Class 13)} & 1.0000 & 0.9583 & 0.9787 \\ \cline{2-4}  & 1.0000 & 1.0000 & 1.0000 \\ \hline \multirow{2}{*}{Western corn rootworms (Class 15)} & 0.8518 & 0.9583 & 0.9019 \\ \cline{2-4}  & 0.9027 & 0.9078 & 0.9027 & 0.9021 \\ \hline \end{tabular}
\end{table} 
Table 7: Classification report for EfficientNetB0. Table 9 and Figure 11 show that ConvViT outperformed the compared models with 93.61% classification accuracy. The reason why ConvViT outperforms other models is that by combining the strengths of CNN and transformer architectures, it can effectively learn both local and global features.