# Improving Moving Insect Detection with Difference of Features Maps in YOLO Architecture
## 2 Materials and Methods
### Dataset
This refinement allowed us to focus exclusively on the detection of honeybees. The statistics of this modified dataset are shown in Table 2.  
As indicated in Table 2, the resulting dataset comprises a total of 9676 images, evenly distributed between samples containing honeybees and background-only images. To facilitate model development and ensure a fair evaluation, we partitioned the dataset into training, validation, and test sets following a 0.8/0.1/0.1 ratio, respectively. This split was performed in a stratified manner across camera systems to preserve the diversity of scenes and plant species in each subset. Some instances from this dataset are shown in Figure 2. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Camera**} & **Images with** & **Background** & \multirow{2}{*}{**Total Images**} & \multirow{2}{*}{**Plant**} \\  & **Honeybees** & **Images** & & \\ \hline S1-0 & 15 & 15 & 30 & Rocket \\ S1-1 & 54 & 54 & 108 & Clover \\ S2-0 & 302 & 302 & 604 & Mallow \\ S2-1 & 395 & 395 & 790 & Mallow \\ S3-0 & 1697 & 1697 & 3394 & Clover \\ S4-0 & 1784 & 1784 & 3568 & Clover \\ S4-1 & 591 & 591 & 1182 & Clover \\ \hline Total & 4838 & 4838 & 9676 & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Summary statistics of the modified dataset constructed from the original test split in [29]. The table shows the number of images containing honeybees, the number of images without honeybees (background images), and the total number of samples per camera system, after data cleaning and filtering to ensure balanced classes and temporal consistency. Figure 2: Example of six images from the modified honeybees dataset. Reprinted with permission from Ref. [29]. Copyright ©2018 AU Signal Processing Group. To further evaluate the generalization capability of our model across different insect types, we created a synthetic dataset by overlaying pest images onto raspberry plant images. This synthetic dataset was necessary due to the scarcity of publicly available datasets featuring insects in motion under field conditions. By generating this dataset, we are able to simulate a wide range of insect appearances, poses and positions, which allow us to more thoroughly evaluate the generalization capability of our approach. For the synthetic dataset generation, we first captured high-resolution images of raspberry plants in agricultural fields located in Jocotepec, Jalisco, Mexico. To simulate the presence of multiple pest species we then artificially overlaid pest images onto these plant background images. The pest included in this synthetic dataset are nine common species known to affect raspberry crops: _Tetranychus urticae_ (red spider), _Polyp phagocytosisemus latus_ (broad mite), _Cococidae_ (cocidae), _Curculionidae_ (weevil), _Cotinis mutabilis_ (figeater), _Rhugoletis_ spp., _Lampronia corticella_ (raspberry moth), _Aphididae_ (aphid) and _Frankliniella_ spp. (thrips). According to [39], it is uncommon for multiple competing pest species to coexist on the same individual plant. Therefore, each synthetic image includes only one pest type overlaid per plant background, aligning with real-world biological patterns. For each generated image, we simulate a corresponding previous frame by shifting the position of the insects present in the scene. For each pest class a total of 1000 main frames with the insect in a certain position were generated. Then, for each of these frames, a corresponding previous frame was generated by shifting the position of each insect within the corresponding scene. This process resulted in 2000 images per class: 1000 main frames for pest detection and the other 1000 images used to provide temporal context, enabling the integration of motion information into the detection pipeline. Similar to honeybees dataset, we created training, validation and test splits using a 0.8/0.1/0.1 ratio, respectively. The splits were performed in a stratified manner to preserve the distribution of images for each insect class across all splits. All images were cropped to size 640 \(\times\) 640 pixels.