# A Study on Pine Larva Detection System Using Swin Transformer and Cascade R-CNN Hybrid Model
## 5 Conclusions  
In this paper, there were insufficient data in the data collection process of the existing pine pests, and the sizes of the pests were small. Therefore, in this study, data were augmented and used, and a model that combined the advantages of the Swin Transformer model and the Cascade R-CNN model was proposed to detect pine pests.  
In the process of collecting artificial intelligence learning data, a data augmentation model was used to increase the image data to 8640 from the original data set.  
This paper compared the YOLOv5s, Faster R-CNN, and Cascade R-CNN models to compare their performances with the performance of the Cascade R-CNN_Swin Transformer mixed model.  
In the detection of pine pests, for the YOLOv5s model, the AP (IoU = 0.5) was 56.3% and the recall value was 66.8%, and the Faster R-CNN model showed an AP (IoU = 0.5) of 92.5%, the accuracy of the AP (IoU = 0.75) was 87.9%, and the recall was 91.1%. More  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Division** & **Model** & **Backbone** & \begin{tabular}{c} **Learning** \\ **Method** \\ \end{tabular} & \
\begin{tabular}{c} **AP** \\ **(IoU = 0.5)** \\ \end{tabular} &
\begin{tabular}{c} **AP** \\ **(IoU = 0.75)** \\ \end{tabular} & **Recall** \\ \hline
1 & YOLOv5s & Focus+C3 &
\begin{tabular}{c} Supervised \\ learning \\ \end{tabular} & 56.3\% & Null & 66.8\% \\
2 & Faster R-CNN & ResNet50 &
\begin{tabular}{c} Supervised \\ learning \\ \end{tabular} & 92.5\% & 87.9\% & 91.1\% \\
3 & Cascade & ResNet50 &
\begin{tabular}{c} Supervised \\ learning \\ \end{tabular} & 93.2\% & 89.5\% & 92.9\% \\
4 & Cascade & Swin & Supervised \\ R-CNN & Transformer & learning & 94.6\% & 89.6\% & 93.5\% \\ \hline \hline \end{tabular}
\end{table}
Table 4: Comparison of performances of 4 models for detecting pine pests.  
over, the Cascade R-CNN model showed an accuracy of AP (IoU = 0.5) of 93.2%, an AP (IoU = 0.75) of 89.5%, and a recall of 92.9%.  
Finally, the mixed model Cascade R-CNN_Swin Transformer proposed in this study showed an accuracy of 94.6% for AP (IoU = 0.5), 89.6% for AP (IoU = 0.75), and 93.5% for recall in the detection of pine pests. As a result of comparing the performances of the four models for detecting pine pests, YOLOv5s and Faster R-CNN showed a lower performance compared with the Cascade model, and the Cascade R-CNN_Swin Transformer mixed model showed the highest accuracy.  
In addition, as a result of this study, it was found that setting a high IoU threshold in the Faster R-CNN-based pine pest detection model resulted in an insufficient number of positive samples and syntheses as a result of training. Setting a low IoU threshold is advantageous for training a model because a large number of samples can be obtained, but there is a problem in that a lot of errors occur when testing is performed. To solve this problem, a Cascade structure can be used. In addition, it is believed that the mixed model presented in this paper can be applied to agriculture and forestry to monitor and predict caterpillars and moths.  
Conceptualization, S.-H.L. and G.G.; methodology, G.G.; software, G.G.; validation, S.-H.L. and G.G.; formal analysis, G.G.; resources, S.-H.L.; data curation, G.G.; writing--original draft preparation, G.G.; writing--review and editing, S.-H.L.; visualization, S.-H.L. and G.G.; supervision, S.-H.L.; project administration, S.-H.L.; funding acquisition, S.-H.L. All authors have read and agreed to the published version of the manuscript.  
This research was supported by the Honam University Research Fund, 2022.  
Not applicable.  
The authors declare no conflict of interest.