Insect identification methods, electronic devices and storage media

CN117475477BActive Publication Date: 2026-08-14JILIN AGRICULTURAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-08
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

对虫情诱捕装置而言,最终收集到的害虫均经过干燥烘干两个步骤,使得虫体残缺及花纹颜色模糊,较于干燥烘干之前的形态会有不同,这将导致虫子识别结果不准确,无法准确高效地实现水稻害虫识别,进而无法及时预测害虫虫期及进行害虫防治,不利于农业生产;而且,通常需要占用较多的计算资源,对硬件设备要求较高,增加害虫防治的成本,也不利于害虫防治的自动化实施

Benefits of technology

[0041]本申请实施例提供的该方法,采用改进的MobileVitv3的YOLOv6的虫子识别模型,该方法中的骨干网络具有扩大感受野和丰富特征样本的作用,可以提升小目标检测和目标位置精度。而且,该方法的颈部网络能够充分融合低维特征和高维特征,同时,特征融合模块采用结构重参数化,能够在推理模式下使用简单的维度调整和加权计算公式对算子进行调整,大幅提升模型推理速度。所以本方法的检测模型相较于其他的检测模型,可以实现更高效的特征提取和融合过程,并且具有更高的推理速度,适合部署于嵌入式系统中,以降低害虫防治的成本,提高害虫防治的自动化,对农田虫情诱捕装置及农业生产的实际场景提供有效的技术支持。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117475477B_ABST
    Figure CN117475477B_ABST
Patent Text Reader

Abstract

This invention relates to an insect identification method, electronic device, and storage medium. The insect identification method includes: acquiring an image containing insects to be identified; inputting the image to be identified into a preset insect identification model, so that the insect identification model outputs an insect identification result; wherein the insect identification model is a YOLOv6 model based on an improved MobileVit3 model, the YOLOv6 model including: a backbone network, a neck network, and a head network. The backbone network is a MobileVit3 model, used to extract image features of the image to be identified to obtain a feature image; the neck network is a RepGFPN network, used to fuse low-level semantic features and high-level semantic features in the feature image to obtain a feature fusion result; and the head network is used to output a detection result based on the feature fusion result. The embodiments of this application can improve the accuracy of insect identification and reduce the consumption of computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method for identifying insects, an electronic device, and a storage medium. Background Technology

[0002] As one of my country's most important food crops, rice requires effective control of pests to ensure food security and yield. The degree of damage caused by pests, their peak infestation periods, and the corresponding control methods vary. Therefore, the ability to accurately detect and identify common rice pests and predict infestations of different species is of great significance for guiding agricultural production and ensuring food security.

[0003] However, rice pests are diverse in species, small in size, and different species have different patterns. For insect trapping devices, the collected pests undergo two drying processes, resulting in incomplete bodies and blurred patterns, differing from their original form. This leads to inaccurate insect identification, hindering accurate and efficient pest identification, and consequently, making it impossible to predict pest development stages and implement timely control measures, thus negatively impacting agricultural production. Furthermore, these devices typically require significant computing resources and demand high-quality hardware, increasing the cost of pest control and hindering its automation. Summary of the Invention

[0004] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, this application provides an insect identification method, an electronic device, and a storage medium.

[0005] In a first aspect, this application provides a method for insect identification, which involves acquiring an image containing insects to be identified;

[0006] The image to be identified is input into a preset insect recognition model so that the insect recognition model outputs the insect recognition result;

[0007] The insect identification model is a YOLOv6 model based on an improved MobileVit3. The YOLOv6 model includes a backbone network, a neck network, and a head network. The backbone network is a MobileVit3 model used to extract image features from the image to be identified to obtain a feature image. The neck network is a RepGFPN network used to fuse low-level semantic features and high-level semantic features in the feature image to obtain a feature fusion result. The head network is used to output the insect identification result based on the feature fusion result.

[0008] The insect identification results are uploaded to the cloud server.

[0009] Optionally, the backbone network includes: an improvement module, a MobileVIT block, and a CSPSPPF block;

[0010] The improved module is used to extract fine features from the image to be identified;

[0011] The MobileVIT block is used to output a C5 feature map based on the fine features of the image to be identified;

[0012] The CSPSPPF block is used to extract multi-scale information from the C5 feature map.

[0013] Optionally, the MobileVIT block is also used to output C3 feature map and C4 feature map based on the fine features of the image to be identified;

[0014] The neck network is used to input the fusion result corresponding to the C3 feature map as the P3 feature map into the third head network, input the fusion result corresponding to the C4 feature map as the P4 feature map into the third head network, and input the fusion result corresponding to the C5 feature map after passing through the CSPSPPF block as the P3 feature map into the third head network.

[0015] Optionally, the improved module includes: a two-dimensional convolution module, multiple residual modules, an inverse residual module, a max pooling layer, a first convolution module, a first batch normalization layer, a stacking module, a first SiLU activation function, and a second convolution module;

[0016] The two-dimensional convolution module is used to perform two-dimensional convolution calculation on the image to be recognized to obtain a first convolution result;

[0017] Multiple residual modules are used to perform multiple convolution weighting processes based on the first convolution result to obtain residual output features;

[0018] The inverted residual module is used to downsample the residual output features to obtain a first downsampling result;

[0019] The max pooling layer is used to downsample the image to be identified to obtain a second downsampling result;

[0020] The first convolution module is used to perform convolution processing on the second downsampling result to obtain shallow feature information;

[0021] The first batch normalization layer is used to perform batch normalization processing on the shallow feature information to obtain normalized feature information;

[0022] The overlay module is used to overlay the first downsampling result and the normalized feature information to obtain overlay features;

[0023] The first SiLU activation function is used to output combined features based on the superimposed features;

[0024] The second convolution module is used to perform dimensionality reduction on the combined features to obtain high-weight features.

[0025] Optionally, the residual module includes: a first convolutional unit, a weighted summation unit, and a second SiLU activation function;

[0026] The first convolutional unit is used to perform convolution processing on the first convolution result to obtain the second convolution result;

[0027] The weighted summation unit is used to perform a weighted summation of the first convolution result and the second convolution result to obtain a weighted summation result;

[0028] The second SiLU activation function is used to generate the residual output feature based on the weighted summation result.

[0029] Optionally, the two-dimensional convolution module includes: a 3x3 convolution unit, a second batch normalization layer, and a third SiLU activation function;

[0030] The 3x3 convolution unit is used to perform two-dimensional convolution calculation on the image to be recognized using a two-dimensional convolution with a convolution size of 3x3 to obtain convolution data;

[0031] The second batch normalization layer is used to perform batch normalization processing on the first convolutional data to obtain normalized feature data;

[0032] The third SiLU activation function is used to output the first convolution result based on the normalized feature data.

[0033] Optionally, the fusion blocks in the neck network adopt a structure with reparameterized structure.

[0034] Optionally, before inputting the image to be identified into the insect recognition model, the method further includes:

[0035] The image to be identified is preprocessed, including: HSV enhancement processing, Mosic data enhancement processing, random translation and rotation processing, fill scaling processing, and shearing processing.

[0036] Secondly, this application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0037] Memory, used to store computer programs;

[0038] The processor, when executing a program stored in memory, implements the insect identification method described in any of the first aspects.

[0039] Thirdly, this application provides a computer-readable storage medium storing a program for an insect identification method, wherein when the program for the insect identification method is executed by a processor, it implements the steps of the insect identification method described in any of the first aspects.

[0040] The technical solutions provided in this application have the following advantages compared with the prior art:

[0041] The method provided in this application employs an improved YOLOv6 insect recognition model based on MobileVitv3. The backbone network in this method expands the receptive field and enriches feature samples, improving the accuracy of small target detection and target location. Furthermore, the neck network of this method can fully integrate low-dimensional and high-dimensional features. Simultaneously, the feature fusion module uses structural reparameterization, enabling simple dimensionality adjustments and weighted calculation formulas to adjust operators during inference, significantly improving model inference speed. Therefore, compared to other detection models, this method achieves a more efficient feature extraction and fusion process and has a higher inference speed, making it suitable for deployment in embedded systems to reduce pest control costs, improve the automation of pest control, and provide effective technical support for agricultural insect trapping devices and practical agricultural production scenarios. Attached Figure Description

[0042] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 A flowchart illustrating an insect identification method provided in this application embodiment;

[0045] Figure 2 A structural diagram of an improved module provided in an embodiment of this application;

[0046] Figure 3 A structural diagram of a two-dimensional convolution module provided in an embodiment of this application;

[0047] Figure 4This is an overall structural diagram of an insect recognition model provided in an embodiment of this application;

[0048] Figure 5 A structural diagram of a residual module provided in an embodiment of this application;

[0049] Figure 6 A structural diagram of a reverse residual module provided in an embodiment of this application;

[0050] Figure 7 A structural diagram of a CSPSPPF provided in an embodiment of this application;

[0051] Figure 8 A structural diagram of a MobileVIT block provided in an embodiment of this application;

[0052] Figure 9 A structural diagram of a fusion block provided in an embodiment of this application;

[0053] Figure 10 A structural diagram of a Simple Rep provided in an embodiment of this application;

[0054] Figure 11 A schematic diagram illustrating the training principle of an insect recognition model provided in an embodiment of this application;

[0055] Figure 12 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0056] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0057] Because rice pests are diverse, small in size, and possess different patterns, and because insect trapping devices ultimately collect pests through drying processes, resulting in incomplete insect bodies and blurred patterns, their morphology differs from before drying. This leads to inaccurate insect identification, hindering accurate and efficient identification of rice pests and consequently impairing timely prediction of pest development and control, thus negatively impacting agricultural production. Furthermore, such methods typically require significant computing resources and demand high-performance hardware, increasing the cost of pest control and hindering its automation. Therefore, this application provides an insect identification method, electronic device, and storage medium. This application selects the YOLOv6 model, which is more suitable for deployment on hardware platforms or edge computing devices, as the base model. To improve the detection accuracy and generalization of the base model, this method improves upon it by proposing a YOLOv6 model based on an improved MobileVitv3, capable of automatically learning and extracting effective features from images and achieving high-precision rice insect identification.

[0058] This application provides a method for insect identification. This method can be applied to a processor, which can be configured in a computer or an embedded device. The computer can be a local computer or a cloud computer; the local computer can be a PC, tablet, etc. The embedded device can be NVIDIA's Jetson series, Raspberry Pi series, etc. No specific limitations are made here. Figure 1 As shown, the insect identification method includes:

[0059] Step S101: Obtain an image containing insects to be identified;

[0060] In this step, images of dried insects can be acquired to obtain images to be identified. The insects can be agricultural pests, forest pests, etc. For example, the insects can refer to rice pests. Different images to be identified can be obtained by adjusting the color parameters of the camera.

[0061] Before inputting the image to be identified into the insect recognition model, the method further includes:

[0062] The image to be identified is preprocessed, including HSV enhancement, Mosic data enhancement, random translation and rotation, padding and scaling, and shearing, to enhance the generalization of the dataset.

[0063] Step S102: Input the image to be identified into a preset insect recognition model so that the insect recognition model outputs the insect recognition result;

[0064] The insect identification model is based on the improved MobileVit3 YOLOv6 model, such as... Figure 4 As shown, the YOLOv6 model includes a backbone network, a neck network, and a head network. The backbone network is a MobileVit3 model, used to extract image features from the image to be identified to obtain a feature image. The neck network is a RepGFPN network, used to fuse low-level semantic features and high-level semantic features in the feature image to obtain a feature fusion result. The head network is used to output the insect identification result based on the feature fusion result.

[0065] The MobileVit series of models combines the local feature extraction advantages of Convolutional Neural Networks (CNNs) with the long-range feature dependency advantages of Transformers. This not only overcomes the limitations of CNNs, such as the ambiguity of low- and high-dimensional feature locations in the receptive field, but also compensates for the spatial inductive bias of Transformers. This application improves the inverse residual module in MobileVit3, including expanding the receptive field of convolutions and acquiring more refined feature information. Specifically, this application uses the MobileVit3 model as the backbone network of YOLOv6 and improves the inverse residual block using the improved module described later. A CSPSPPF block is added to the output of the fifth layer of the backbone network to capture multi-scale information of the input feature image. This application mainly addresses the problems of the small receptive field and scarce feature samples in the downsampling layers of MobileVit3. The improved backbone network in this application has a deeper depth and a larger receptive field, thereby significantly improving the accuracy of model recognition.

[0066] In addition, the neck network RepBiFPN of the YOLOv6 model is replaced with RepGFPN. The neck network is based on the PAFPN network. It connects other cross-layer scale features in the previous layer and the current layer of each layer. The multi-scale feature fusion part occurs in the different scale features of the previous layer and the current layer. The cross-layer connection according to log2n can more effectively provide the transmission of high-level semantic and low-level semantic spatial information, and can more fully integrate the original input features and the intermediate fused features, thereby improving the accuracy of small target detection.

[0067] The head network performs convolution operations on the feature fusion results output by the neck network and outputs the insect identification result. In this embodiment, the head network adopts a decoupled head architecture. The decoupled architecture can improve the performance of the model, i.e., the accuracy, more than the original classification and regression architecture. Therefore, a hybrid channel strategy is adopted to construct an efficient decoupled head. That is, based on the decoupled head of YOLOX, one 3x3 convolution in the middle of each layer is reduced, and the width is reduced in the same way as the other two networks. Its width is scaled by the width factor of the backbone network and the neck network, thereby directly reducing the computational cost and latency.

[0068] In the embodiments of this application, such as Figure 4 As shown, the decoupled head architecture separates several tasks. For example, in the second to last column of the head network in Figure 4, there are three branch outputs. The features of these three branch outputs are then superimposed during the final prediction to obtain the block diagram in the last column.

[0069] In yet another embodiment of this application, as Figure 4 As shown, the backbone network includes: an improvement module, a MobileVIT block, and a CSPSPPF block;

[0070] The improved module is used to extract fine features from the image to be identified;

[0071] The improved module improves the inverted residual blocks of different lengths in MobileVit3. The purpose of the improvement is to mine the current features as much as possible and reduce the feature size by one-quarter to obtain fine features, thereby helping to improve the receptive field of the model.

[0072] like Figure 2 As shown, the improved module is divided into two branches. The first branch includes: a max pooling layer and a first convolutional module (i.e., ...). Figure 2 1x1 convolutions in the first batch of normalization layers (i.e., the first batch of normalization layers) Figure 2 The batch normalization layer in the middle is used to extract the relatively superficial pest features in the feature dimension of this layer. The second branch includes: a two-dimensional convolutional module (i.e., Figure 2 SConv in the middle), multiple residual modules (i.e. Figure 2 The CSB_RES and inverse residual modules in MobileNetv2 primarily function to cascade multiple residual modules to expand the receptive field and extract useful features from the current feature dimension. The "expansion-convolution-compression" module architecture not only reduces the loss rate of high-dimensional information, but the depthwise convolution used also reduces computational costs, efficiently extracting useful features from the current feature dimension. Subsequently, the outputs of the two branches are fused and superimposed, and then processed by a one-dimensional convolution (i.e.,...). Figure 2 The width of the feature map is controlled by a 1x1 convolution following SiLU, which helps to improve the location accuracy of the target and its feature representation ability.

[0073] In one embodiment of this application, such as Figure 2 As shown, the improved module includes: a two-dimensional convolution module, multiple residual modules, an inverse residual module, a max pooling layer, a first convolution module, a first batch normalization layer, a stacking module, a first SiLU activation function, and a second convolution module;

[0074] The two-dimensional convolution module is used to perform two-dimensional convolution calculation on the image to be recognized to obtain a first convolution result;

[0075] In one embodiment of this application, such as Figure 3 As shown, the two-dimensional convolutional module (i.e. Figure 2 The SConv in the middle includes: 3x3 convolutional units, a second batch normalization layer, and a third SiLU activation function;

[0076] The 3x3 convolution unit is used to perform two-dimensional convolution calculation on the image to be recognized using a two-dimensional convolution with a stride of 1 and a convolution size of 3x3, to obtain convolution data;

[0077] The second batch normalization layer is used to perform batch normalization processing on the first convolutional data to obtain normalized feature data;

[0078] The third SiLU activation function is used to output the first convolution result based on the normalized feature data.

[0079] like Figure 4 As shown, the image to be identified can be input into a two-dimensional convolution (i.e., a 3x3 convolutional unit) with a stride of 1 and a convolution size of 3x3, preserving relatively shallow features, and then the detection result is inferred through the YOLOv6 model based on the improved MobileVitv3.

[0080] Multiple residual modules are used to perform multiple convolution weighting processes based on the first convolution result to obtain residual output features;

[0081] In one embodiment of this application, such as Figure 5 As shown, the residual module (i.e. Figure 2 The CSB_RES in the model includes: a first convolutional unit SConv, a weighted summation unit, and a second SiLU activation function;

[0082] The first convolutional unit is used to perform convolution processing on the first convolution result to obtain the second convolution result;

[0083] The weighted summation unit is used to perform a weighted summation of the first convolution result and the second convolution result to obtain a weighted summation result;

[0084] The second SiLU activation function is used to generate the residual output feature based on the weighted summation result. The second SiLU activation function is used to introduce nonlinear features to determine whether the neuron is activated.

[0085] The first convolution result is processed by the residual module to obtain the second convolution result, and the features of the second convolution result are weighted and summed with those of the first convolution result. The SiLU activation function is added to change the weight arrangement to obtain the output features of the residual block. A portion of the fine features of the output features are retained, and the remaining coarse features are input into the next residual block. The fine features retained by the last residual block are the residual output features of the residual block.

[0086] The inverted residual module is used to downsample the residual output features to obtain a first downsampling result;

[0087] The residual module outputs residual output features to an inverted residual block with a stride of 2 for downsampling, resulting in the convolution result of branch one (i.e., the first downsampling result), thereby mining more depth information in the current dimension.

[0088] like Figure 6 As shown, the structure of the inverse residual module includes: a one-dimensional convolution with a convolution size of 1, a batch normalization layer, a SiLU activation function, a depthwise convolution, a batch normalization layer, a SiLU activation function, a one-dimensional convolution with a convolution size of 1, and a batch normalization layer;

[0089] The residual output features are first fed into a one-dimensional convolution with a stride of 1 and a convolution size of 1 to expand the limited feature channels. The expanded output features are then used to extract image features through depthwise separable convolutions and pointwise convolutions, which enhances the network's expressive power. Finally, the output features are fed into a one-dimensional convolution with a stride of 1 and a convolution size of 1 to adjust the number of output channels. Figure 6 As shown, C, 4C, 4C, and C represent the changes in the number of feature maps, that is: the number of feature maps input to the first one-dimensional convolution with a size of 1 is C, the number of feature maps input to the depthwise convolution is 4C, the number of feature maps output by the depthwise convolution is 4C, and the number of feature maps output by the second one-dimensional convolution with a size of 1 is C.

[0090] The max pooling layer is used to downsample the image to be identified to obtain a second downsampling result;

[0091] The first convolution module is used to perform convolution processing on the second downsampling result to obtain shallow feature information;

[0092] The first batch normalization layer is used to perform batch normalization processing on the shallow feature information to obtain normalized feature information;

[0093] like Figure 2 As shown, the image to be recognized is input into a max pooling layer with a stride of 2, followed by a first convolutional module with a kernel of 1x1 and the number of feature channels is adjusted to obtain more shallow feature information with a small amount of computation. Then, it is passed through the first batch normalization layer to speed up the convergence of the model and obtain the output features of the second branch.

[0094] The overlay module is used to overlay the first downsampling result and the normalized feature information to obtain overlay features;

[0095] The first SiLU activation function is used to output combined features based on the superimposed features;

[0096] The second convolution module is used to perform dimensionality reduction on the combined features to obtain high-weight features.

[0097] like Figure 2 As shown, the first downsampling result of branch one is superimposed with the normalized feature information of branch two, and a combined feature with four times the number of input features is obtained through the SiLU activation function; then the combined feature is input to a second convolution module with a convolution size of 1x1 for dimensionality reduction, and high-weight features are selected as the output features of the improvement module.

[0098] The MobileVIT block is used to output a C5 feature map based on the fine features of the image to be recognized; the structure of the MobileVIT block is as follows: Figure 8 As shown.

[0099] The CSPSPPF block is used to extract multi-scale information from the C5 feature map.

[0100] like Figure 7 As shown in the CSPSPPF structure diagram, the input feature map passes through pooling layers of different sizes, avoiding repeated feature extraction from local maps. At the same time, this multi-scale spatial pyramid pooling framework can capture target information of different sizes, improving the model's receptive field and its ability to recognize features such as the shape, texture, and color of rice pests.

[0101] The MobileVIT block is also used to output C3 and C4 feature maps based on the fine features of the image to be identified;

[0102] The C5 feature map output by the backbone network MobileVit3 is input into the CSPSPPF block. The feature map is then processed by pooling kernels of three different sizes to obtain different feature scale information. This not only reduces the number of channels but also helps to improve the receptive field and feature representation ability of the model.

[0103] Accordingly, the neck network is used to input the fusion result corresponding to the C3 feature map as the P3 feature map into the third head network, the fusion result corresponding to the C4 feature map as the P4 feature map into the third head network, and the fusion result corresponding to the C5 feature map after passing through the CSPSPPF block as the P3 feature map into the third head network. The fusion block in the neck network adopts a structure reparameterization structure.

[0104] The neck network adds features of different scales at the same level to the shallow layers of the PAFPN network structure, thereby more fully integrating low-level and high-level semantic features. The feature fusion module employs structural reparameterization, featuring two variable structures for training and inference, allowing adjustments to operators in inference mode and significantly improving model inference speed. Low-level semantic features improve target location accuracy, while high-level semantic features improve accuracy for small targets. Therefore, the replaced neck network structure can improve both the detection accuracy of large, medium, and small targets and real-time inference speed.

[0105] Fusion block in neck network (e.g.) Figure 9 As shown, a structure with reparameterized structure is used (the structure with reparameterized structure is the same as the structure of Simple Rep, such as...). Figure 10 As shown, it can adjust the operator by switching the convolutional structure in the inference mode, thereby reducing real-time inference latency.

[0106] The head network comprises four layers. The weighted bidirectional feature pyramid network of the neck network is used to input the fusion result corresponding to the sampling result into the head network, input the fusion result corresponding to the C3 feature map as the P3 feature map into the second head network, input the fusion result corresponding to the C4 feature map as the P4 feature map into the third head network, and input the fusion result corresponding to the C5 feature map after passing through the CSPSPPF block as the P3 feature map into the third head network. The final image feature sizes output by the three head networks are 80×80, 40×40, and 20×20, respectively. Because this insect recognition method detects 14 kinds of rice pests, the predicted value of the detected category plus the predicted value of the background and the predicted value of the bounding box result in 19 feature maps output by each layer, i.e., 19×80×80, 19×40×40, and 19×20×20.

[0107] Step S103: Upload the insect identification results to the cloud server.

[0108] The insect identification results are uploaded to a cloud server for storage via network protocols. These results include images of the detected insect species and their names, laying the foundation for subsequent pest infestation prediction applications. While the pest species names in the detection results are uploaded in packets using the TCP protocol, packet loss and merging can occur with TCP when transmitting large amounts of data. Therefore, the images of the detection results are uploaded using the HTTP protocol.

[0109] The insect identification model uses weights derived from the optimal results obtained through rice pest images and labeled samples. Here, the rice pest image samples are raw images captured by a camera in a real-world scene. These raw images are augmented through data augmentation methods such as rotation, scaling, and noise reduction to obtain the final image samples. Then, the location and category of rice pests in the image samples are manually labeled to obtain rice pest tags. The pest image samples include training samples and validation samples; such as... Figure 11 As shown, the insect recognition model is trained based on the following steps:

[0110] The training samples are scaled to a size of 640×640, and various types of data augmentation are performed on the images according to the set random scaling factor. The images are then input into the YOLOv6 model based on the improved MobileVitv3. After the model training is completed, the training detection results are obtained.

[0111] Based on the training detection results and the insect labels carried by the training samples, a loss function value is calculated. Based on the loss function value, the stochastic gradient descent algorithm is used to iteratively update the structural parameters of the YOLOv6 model based on the improved MobileVitv3 to obtain the accuracy of the detection model. The detection model is then validated and tested based on the test samples to obtain the model evaluation index.

[0112] Specifically, based on the training detection results and the insect labels carried by the training samples, the loss function value is calculated, including: selecting GioU to calculate the bounding box regression value based on the training detection results and the insect labels carried by the training samples, and selecting VariFocal Loss as the classification loss.

[0113] Based on the verification samples, a verification test is performed on the YOLOv6 model based on the improved MobiletVit3, including: inputting the verification samples into the YOLOv6 model based on the improved MobiletVit3 to obtain the detection results output by the improved model; and calculating the values ​​of the model evaluation index based on the verification detection results and the insect tags carried by the verification samples.

[0114] The model evaluation metrics include at least one of precision, recall, and average precision.

[0115] The formulas for calculating the evaluation metrics of object detection models include:

[0116]

[0117]

[0118]

[0119]

[0120] In the formula, TP is the number of correctly detected targets, meaning the sample prediction and the actual target are both correct; FP is the number of incorrectly detected targets, meaning the sample prediction is correct but the actual target is incorrect; and FN is the number of missed targets, representing the sample prediction that is incorrect but the actual target is correct.

[0121] Under the PyTorch framework, the evaluation metrics of the rice pest detection model provided in this application embodiment are shown in Table 1.

[0122] Table 1. Statistical Table of Evaluation Indicators for Object Detection Models under PyTorch Framework

[0123] Our 92.3 85.6 88.7 27.2

[0124] The following parameter settings were used in this embodiment:

[0125] A YOLOv6 model based on an improved MobileVitv3: YOLOv6 is used as the base network, and the backbone network is replaced with MobileVitv3. The improved modules in each layer are configured with 1, 2, 6, 4, and 1 residual blocks. In layers 3 through 5, each improved module is followed by an Mvit block, with the number of Tensor generators set to 4, 5, and 4 respectively.

[0126] Image Data: A dataset containing images of 12 rice pests (rice stem borer, rice leaf roller, rice leaf roller, brown planthopper, cutworm, mole cricket, armyworm, cotton bollworm, cricket, and large black gill beetle, white-backed planthopper, and brown planthopper) was used. Each image contained a different number of different pests, totaling 957 images. The image dataset was divided into training and testing sets in an 8:1:1 ratio, and the training set was augmented to 3828 images.

[0127] Training parameters: During training, the model uses stochastic gradient descent (SGD) as the optimizer and cosine annealing to adjust the learning rate. The momentum factor is set to 0.937, the initial learning rate is 0.053, the cyclic learning rate is 0.12, the weight decay coefficient is 0.0036, the training image resolution is 640x640x3, the batch size is 6, and the number of iterations is 550.

[0128] The insect identification method provided by this invention employs an improved YOLOv6 insect identification model based on MobileVitv3. The backbone network in this method expands the receptive field and enriches feature samples, improving the accuracy of small target detection and target location. Furthermore, the neck network of this method can fully integrate low-dimensional and high-dimensional features. Simultaneously, the feature fusion module uses structural reparameterization, enabling simple dimensionality adjustments and weighted calculation formulas to adjust operators during inference, significantly improving model inference speed. Therefore, compared to other detection models, this method achieves a more efficient feature extraction and fusion process and has a higher inference speed, making it suitable for deployment in embedded systems to reduce pest control costs, improve the automation of pest control, and provide effective technical support for agricultural insect trapping devices and practical agricultural production scenarios.

[0129] In another embodiment of this application, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.

[0130] Memory, used to store computer programs;

[0131] The processor, when executing a program stored in memory, implements the insect identification method described in any of the foregoing method embodiments.

[0132] The electronic device provided in this invention employs an improved MobileVitv3-based YOLOv6 insect detection model by executing a program stored in memory. The backbone network in this method expands the receptive field and enriches feature samples, improving the accuracy of small target detection and target location. Furthermore, the neck network of this method can fully integrate low-dimensional and high-dimensional features. Simultaneously, the feature fusion module uses structural reparameterization, enabling simple dimensionality adjustments and weighted calculation formulas to adjust operators during inference, significantly improving model inference speed. Therefore, compared to other detection models, this detection model achieves more efficient feature extraction and fusion processes and has a higher inference speed, making it suitable for deployment in embedded systems to reduce pest control costs, improve the automation of pest control, and provide effective technical support for agricultural insect trapping devices and practical agricultural production scenarios.

[0133] The communication bus 1140 mentioned in the above-mentioned electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus 1140 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 12 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0134] The communication interface 1120 is used for communication between the above-mentioned electronic device and other devices.

[0135] The memory 1130 may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0136] The processor 1110 mentioned above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0137] In another embodiment of this application, a computer-readable storage medium is also provided, on which a program for an insect identification method is stored, wherein when the program for the insect identification method is executed by a processor, the steps of the insect identification method described in any of the foregoing method embodiments are implemented.

[0138] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0139] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for identifying insects, characterized in that, Obtain the image to be identified that contains insects; The image to be identified is input into a preset insect recognition model so that the insect recognition model outputs the insect recognition result; The insect identification model is a YOLOv6 model based on an improved MobileVit3. The YOLOv6 model includes a backbone network, a neck network, and a head network. The backbone network is a MobileVit3 model used to extract image features from the image to be identified to obtain a feature image. The neck network is a RepGFPN network used to fuse low-level semantic features and high-level semantic features in the feature image to obtain a feature fusion result. The head network is used to output the insect identification result based on the feature fusion result. The backbone network includes: an improvement module, a MobileVIT block, and a CSPSPPF block; the improvement module is used to extract fine features of the image to be identified; the MobileVIT block is used to output a C5 feature map based on the fine features of the image to be identified; and the CSPSPPF block is used to extract multi-scale information from the C5 feature map. The insect identification results are uploaded to the cloud server.

2. The insect identification method according to claim 1, characterized in that, The MobileVIT block is also used to output C3 and C4 feature maps based on the fine features of the image to be identified; The neck network is used to input the fusion result corresponding to the C3 feature map as the P3 feature map into the third head network, input the fusion result corresponding to the C4 feature map as the P4 feature map into the third head network, and input the fusion result corresponding to the C5 feature map after passing through the CSPSPPF block as the P3 feature map into the third head network.

3. The insect identification method according to claim 1, characterized in that, The improved module includes: a two-dimensional convolution module, multiple residual modules, an inverse residual module, a max pooling layer, a first convolution module, a first batch normalization layer, a stacking module, a first SiLU activation function, and a second convolution module; The two-dimensional convolution module is used to perform two-dimensional convolution calculation on the image to be recognized to obtain a first convolution result; Multiple residual modules are used to perform multiple convolution weighting processes based on the first convolution result to obtain residual output features; The inverted residual module is used to downsample the residual output features to obtain a first downsampling result; The max pooling layer is used to downsample the image to be identified to obtain a second downsampling result; The first convolution module is used to perform convolution processing on the second downsampling result to obtain shallow feature information; The first batch normalization layer is used to perform batch normalization processing on the shallow feature information to obtain normalized feature information; The overlay module is used to overlay the first downsampling result and the normalized feature information to obtain overlay features; The first SiLU activation function is used to output combined features based on the superimposed features; The second convolution module is used to perform dimensionality reduction on the combined features to obtain high-weight features.

4. The insect identification method according to claim 3, characterized in that, The residual module includes: a first convolutional unit, a weighted summation unit, and a second SiLU activation function; The first convolutional unit is used to perform convolution processing on the first convolution result to obtain the second convolution result; The weighted summation unit is used to perform a weighted summation of the first convolution result and the second convolution result to obtain a weighted summation result; The second SiLU activation function is used to generate the residual output feature based on the weighted summation result.

5. The insect identification method according to claim 3, characterized in that, The two-dimensional convolutional module includes: a 3x3 convolutional unit, a second batch normalization layer, and a third SiLU activation function; The 3x3 convolution unit is used to perform two-dimensional convolution calculation on the image to be recognized using a two-dimensional convolution with a convolution size of 3x3 to obtain convolution data; The second batch normalization layer is used to perform batch normalization processing on the first convolutional data to obtain normalized feature data; The third SiLU activation function is used to output the first convolution result based on the normalized feature data.

6. The insect identification method according to claim 1, characterized in that, The fusion blocks in the neck network adopt a structure with reparameterized structure.

7. The insect identification method according to claim 1, characterized in that, Before inputting the image to be identified into the insect recognition model, the method further includes: The image to be identified is preprocessed, including: HSV enhancement processing, Mosic data enhancement processing, random translation and rotation processing, fill scaling processing, and shearing processing.

8. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor, when executing a program stored in memory, implements the insect identification method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program for an insect identification method, which, when executed by a processor, implements the steps of the insect identification method according to any one of claims 1-7.