Agricultural pest and disease identification method based on diagonal loss

By constructing agricultural pest data sets, designing a new loss function DDRIoU and adjusting the YOLOv7 network structure, the problem of low accuracy of existing agricultural pest identification methods is solved, and more efficient and accurate pest detection is achieved.

CN119049025BActive Publication Date: 2025-08-15JINAN ZHENGFAN ELECTRONIC TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411168178.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2025-08-15
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

The existing agricultural pest and disease recognition methods have low accuracy, the traditional methods rely on expert experience and are costly, and the deep learning-based methods have high calculation costs and low accuracy. The existing bounding box regression loss function has the same value under different prediction results, which affects the convergence speed and accuracy of the model.

Method used

A agricultural pest and disease data set was constructed, a new loss function DDRIoU based on bounding box similarity comparison was designed, and combined with Focal-Loss idea, the YOLOv7 network structure was adjusted, the C3 and MobileViTv3 modules were introduced to form the APD-YOLOv7 network structure, and the feature extraction and bounding box regression of the model were optimized.

Benefits of technology

It improves the accuracy of agricultural pest identification and model stability, reduces the computational complexity and parameter quantity, and achieves more efficient pest detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119049025B_ABST
    Figure CN119049025B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of agricultural pest and disease identification, and specifically to an agricultural pest and disease identification method based on diagonal loss. The present invention realizes accurate identification of crop pests and diseases through a model for agricultural pest and disease detection, designs a new loss function, and uses DDRIoU as a new metric for comparing the similarity between the predicted bounding box and the true bounding box in the BBR process. Based on the DDRIoU loss and combined with the Focal-Loss idea, a new loss function is designed to enhance the contribution of high-quality anchor boxes in model optimization while suppressing irrelevant anchor boxes. The network structure of YOLOv7 is adjusted to reduce the number of model parameters and computational complexity, enhance the network's feature extraction and fusion capabilities, and further improve the accuracy of the model, thereby solving the problem of low accuracy of existing agricultural pest and disease identification methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of agricultural pest identification, and in particular to an agricultural pest identification method based on diagonal loss. Background Art

[0002] There is a constant demand for innovative agricultural technologies, improved agricultural efficiency, and maximum food production to feed a growing population. However, due to the large number of invasive organisms and microorganisms present in the growing environment, crops are increasingly vulnerable to pests and diseases. These pests and diseases pose a serious threat to agricultural production security and the sustainable supply of food. Therefore, accurate identification of crop pests and diseases and effective early warning of their outbreaks can help prevent agricultural disasters and ensure farmland quality and yield.

[0003] However, most traditional pest and disease identification methods rely on the subjective experience of agricultural experts, resulting in low efficiency, large errors, and high costs. With the development of image processing technology, crop pest and disease identification methods based on machine learning have become possible. However, these methods still require manual feature extraction, which is cumbersome, makes it difficult to extract abstract features, and has difficulty improving accuracy to a level suitable for practical application. Subsequently, with the development of graphics processing units (GPUs), deep learning technology, which relies on the powerful processing power of GPUs, has rapidly developed and is widely used in agricultural pest and disease identification. Applying deep learning technology to crop pest and disease identification has achieved higher accuracy than traditional pest and disease identification and machine learning-based identification methods.

[0004] Although many studies have provided references and feasibility for using deep learning neural networks to identify agricultural pests and diseases, it is still challenging for existing deep learning models to solve problems such as high computational cost and low accuracy of agricultural pests and diseases.

[0005] Most state-of-the-art object detectors rely on a bounding box regression (BBR) module to determine the location of objects. Based on this paradigm, a well-designed loss function is crucial to the success of BBR. To date, most BBR-based loss functions fall into two categories: The loss function of n-norm and the loss function based on Intersection over Union (IoU).

[0006] However, the existing BBR loss function sometimes has the same value under different prediction results, which reduces the convergence speed and accuracy of BBR. The existing BBR loss function is also not fully applicable to the accurate identification of agricultural pests and diseases. Summary of the Invention

[0007] The purpose of the present invention is to provide an agricultural pest and disease identification method based on diagonal loss, aiming to solve the problem of low accuracy of existing agricultural pest and disease identification methods.

[0008] To achieve the above object, the present invention provides an agricultural pest and disease identification method based on diagonal loss, comprising the following steps:

[0009] Construct a dataset of agricultural pests and diseases;

[0010] Design a bounding box regression loss function based on the bounding box similarity comparison metric;

[0011] Improve the network structure to obtain an improved network;

[0012] The improved network is trained using the bounding box regression loss function to obtain an agricultural pest and disease detection model;

[0013] The agricultural pest and disease detection model is used to accurately identify crop pests and diseases.

[0014] Among them, in "Constructing an Agricultural Pest and Disease Dataset", the agricultural pest and disease dataset includes field photos, public datasets and Internet data. The field photos include citrus canker and snow pea cabbage caterpillars; the public dataset includes Acridoidea insects and bean blister beetles; the Internet data includes grape black rot and grape leaf blight.

[0015] Among them, in "Designing a bounding box regression loss function based on bounding box similarity comparison metric", it includes:

[0016] The difference ratio of the diagonal of the predicted bounding box and the true bounding box is introduced into the bounding box similarity comparison metric to design the bounding box similarity comparison metric DDRIoU, and a new loss function L is obtained. DDRIoU ;

[0017] Use the traditional bounding box similarity comparison metric IoU to loss function L DDRIoU Weighted, we get a new loss function L Focal-DDRIoU .

[0018] Among them, "improving the network structure to obtain an improved network" includes:

[0019] The two ELAN modules of the YOLOv7 network structure were removed, and the C3 module was added to supplement the feature extraction capability of the network;

[0020] A MobileViTv3 module is embedded between the remaining two ELAN modules to form a new APD-YOLOv7 network structure.

[0021] Among them, in "Improving the network structure to obtain an improved network", the C3 module is a key component in YOLOv5, which adopts a hierarchical structure to extract features and connects low-level feature maps to high-level feature maps through a series of convolutional layers and bottleneck structures. The MobileViTv3 module is a lightweight model suitable for mobile vision tasks.

[0022] The present invention's agricultural pest and disease identification method based on diagonal loss includes the following steps: constructing an agricultural pest and disease dataset; designing a bounding box regression loss function based on a bounding box similarity comparison metric; improving the network structure to obtain an improved network; training the improved network using the bounding box regression loss function to obtain an agricultural pest and disease detection model; and accurately identifying crop pests and diseases using the agricultural pest and disease detection model. The present invention constructs the agricultural pest and disease dataset through field photography and web crawling. This dataset encompasses the most prominent issues currently encountered in agricultural pest and disease datasets. Secondly, referring to existing bounding box regression loss functions, the geometric features of the predicted and ground-truth bounding boxes in BBR are reconsidered. Based on the characteristics of the agricultural pest and disease dataset, a bounding box similarity comparison metric is proposed. This is then combined with the Focal-Loss concept to focus the regression process on high-quality anchor boxes. Based on the bounding box similarity comparison metric, a Focal-Bounding Box Similarity Comparison metric is designed. Furthermore, the YOLOv7 loss function is replaced with the Focal-Bounding Box Similarity Comparison metric instead of the CIoU loss. Finally, the YOLOv7 network structure was adjusted, embedding the MobileViTv3 module in the 17th layer of the backbone. This results in a model for agricultural pest and disease detection, which can be used for crop pest and disease identification in precision agriculture. The model's performance was evaluated on a dataset of agricultural pest and disease data. Experiments showed that the Focal-Bounding Box Similarity Comparison metric significantly outperformed the other commonly used BBR loss. Furthermore, the adjusted network structure also outperformed the original YOLOv7 network structure. This model demonstrates superior performance in agricultural pest and disease detection, addressing the low accuracy of existing agricultural pest and disease identification methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0024] Figure 1 It is a commonly used boundary regression loss function.

[0025] Figure 2This is a map of the current status of the agricultural pest and disease dataset, where (a) is citrus canker, (b) is grape black rot, (c) is snow pea cabbage caterpillar, (d) is Acridoidea insect, (e) is bean blister beetle, and (f) is grape leaf blight.

[0026] Figure 3 is the bounding box regression loss calculation result, where (a) and (b) are two different cases.

[0027] Figure 4 It is the DDRIoU element.

[0028] Figure 5 It is the YOLOv7 network structure.

[0029] Figure 6 It is the structure of the MobileViTv3 module.

[0030] Figure 7 It is the APD-YOLOv7 network structure.

[0031] Figure 8 The present invention provides a flowchart of a method for identifying agricultural pests and diseases based on diagonal loss. DETAILED DESCRIPTION

[0032] The following describes embodiments of the present invention in detail, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and are not to be construed as limiting the present invention.

[0033] See also Figures 1 to 8 The present invention provides an agricultural pest and disease identification method based on diagonal loss, comprising the following steps:

[0034] S1 builds the agricultural pest and disease dataset;

[0035] The agricultural pest and disease dataset includes field photos, public datasets, and internet data. The field photos include photos of citrus canker and snow pea cabbage caterpillars; the public dataset includes insects of the superfamily Acridoidea and bean blister beetles; and the internet data includes grape black rot and grape leaf blight.

[0036] Specifically, a crop pest and disease dataset, called FIP6Set, was constructed. FIP6Set draws on three main sources: first, images taken on-site in Nanning, Guangxi Zhuang Autonomous Region, including images of citrus canker and snow pea cabbage caterpillars; second, images from the public dataset IP102, including insects from the superfamily Acridoidea and bean blister beetles; and third, images from the internet, including grape black rot and grape leaf blight. Based on the specific conditions, these images were cleaned and high-quality images were included in the dataset. Subsequently, under the guidance of agricultural experts, the images were annotated to construct the new dataset, FIP6Set.

[0037] At the same time, the more prominent problems in the current agricultural pest and disease datasets are taken into consideration. In terms of image selection, there are both Figure 2 (d) and (f) are complex lesions that are suitable for broad labeling. Figure 2 (a) This type of disease has simple lesions and is suitable for fine marking; Figure 2 (c) and (d) are insect pests with colors close to the leaves. Figure 2 (e) This pest is a different color from the leaves.

[0038] According to research, the minimum amount of image data required for training is 150-500. Combined with the current agricultural pest and disease dataset, the number of images of each class in the dataset is controlled between 435-475, which ensures the consistency of the dataset and ensures that the training effect will not be affected by the number of datasets.

[0039] S2 designs the bounding box regression loss function based on the bounding box similarity comparison metric;

[0040] S21 introduces the difference ratio of the predicted bounding box and the true bounding box diagonal into the bounding box similarity comparison metric to design the bounding box similarity comparison metric DDRIoU, and obtains a new loss function L DDRIoU ;

[0041] Specifically,

[0042]

[0043] Among them, c gt is the length of the hypotenuse of the true bounding box, c pr is the length of the hypotenuse of the predicted bounding box. Therefore, the DDRIoU loss is defined as follows:

[0044]

[0045] The core part is the penalty item as follows:

[0046]

[0047] use Function, limiting the penalty term to:

[0048]

[0049] This helps stabilize the training process and prevents the loss value from being too large and causing the gradient to explode.

[0050]

[0051] It reflects the relative difference in scale between the predicted bounding box and the true bounding box, which is advantageous for some target detection tasks with large changes in scale (such as detecting objects of different sizes). Compared with the traditional loss function, using the square of the hypotenuse of the bounding box as a metric can improve the stability of the loss function. The square of the hypotenuse of the bounding box is not affected by the aspect ratio of the bounding box. The traditional metric based on aspect ratio (or aspect difference) may cause instability during training, especially in tasks that require frequent detection of large and small objects. At the same time, it uses:

[0052]

[0053] As an expression:

[0054]

[0055] This not only avoids the instability of the training process that may be caused when the size of the true bounding box is too small, but also makes the loss function more affected by the change in the size of the predicted bounding box, thereby prompting the model to better adjust the size of the predicted bounding box to approach the true bounding box.

[0056] In this way, the features of CIoU are retained. At the same time, DDRIoU takes the predicted bounding box and the true bounding box into consideration, avoiding the problem of the same loss when the predicted bounding box and the true bounding box have the same aspect ratio but different widths and heights.

[0057] S22 uses the traditional bounding box similarity comparison metric IoU to the loss function L DDRIoU Weighted, we get a new loss function L Focal-DDRIoU .

[0058] Specifically, BBR suffers from the problem of imbalanced training examples. Due to the sparsity of target objects in images, the number of high-quality examples with low regression error is far less than that of low-quality examples. Outliers can generate excessively large gradients, which are detrimental to the training process. Therefore, ensuring that high-quality examples contribute more to training is crucial. Therefore, the Focal-DDRIoU loss is proposed to improve the performance of the DDRIoU loss.

[0059] The DDRIoU loss is weighted by the IoU value to obtain the Focal-DDRIoU loss. The loss function = DDRIoU loss = LDDRIoU = bounding box similarity measure = IoU, as shown in the formula:

[0060] L Focal-DDRIoU =IoU γ L DDRIoU

[0061] Where IOU = |A∩B| / |A∪B|, γ is a parameter that controls the degree of outlier suppression.

[0062] S3 improves the network structure to obtain an improved network;

[0063] The C3 module is a key component in YOLOv5. It uses a hierarchical structure to extract features and connects low-level feature maps to high-level feature maps through a series of convolutional layers and bottleneck structures. The MobileViTv3 module is a lightweight model suitable for mobile vision tasks.

[0064] S31 removes the two ELAN modules of the YOLOv7 network structure and adds a C3 module to supplement the feature extraction capability of the network;

[0065] Specifically, in the backbone, two ELAN modules were removed and a C3 module was added to supplement the network's feature extraction capabilities. The C3 module and the MobileViTv3 module were introduced. The C3 module is a key component in YOLOv5. It uses a hierarchical structure to extract features, connecting low-level feature maps to high-level feature maps through a series of convolutional layers and bottleneck structures. This design enables the C3 module to better capture contextual information and perform better when dealing with complex backgrounds.

[0066] S32 embeds the MobileViTv3 module between the remaining two ELAN modules to form a new APD-YOLOv7 network structure.

[0067] Specifically, to further improve model performance, a MobileViTv3 module was embedded between the remaining two ELAN modules. In the head, C3 modules replaced all ELAN-W modules, forming a new APD-YOLOv7 network structure. MobileViT (MobileViTv1) is a lightweight model suitable for mobile vision tasks that combines convolutional neural networks (CNN) and vision transformers (ViTs). Figure 6As shown in the figure, the MobileViTv3 module fuses the features of the local and global representation blocks in the fusion block, using 1x1 convolutions to simplify the learning task while avoiding a significant increase in parameters and FLOPs when scaling. In the local representation block, 3x3 depthwise separable convolutions are used to further reduce parameters. Before the module's overall output, the input features are added to the fusion block's output, using residual connections to improve accuracy. The introduction of the MobileViTv3 module helps reduce model parameters and improve model accuracy.

[0068] S4 uses the bounding box regression loss function to train the improved network to obtain an agricultural pest and disease detection model;

[0069] Specifically, the YOLO v7 model is used for experiments, and the baseline results are obtained by training with the default CIoU loss of YOLOv7. Only the use of IoU loss is changed, that is, the YOLO v7 model is trained with GIoU, DIoU, CIoU, EIoU, DDRIoU and Focal-DDRIoU losses, so only the IoU loss of BBR needs to be replaced with L GIoU , L DIoU , L CIoU , L EIoU , L DDRIoU and L Focal-DDRIoU .

[0070]

[0071] Table 1: Five-fold cross validation method, using the default loss (L CIoU ), and L GIoU , L DIoU , L EIoU , L DDRIoU and L Focal-DDRIoU Performance comparison of training YOLOv7 models.

[0072] As shown in Table 1, using the FIP6Set dataset, averaging five experiments using five-fold cross-validation, DDRIoU and Focal-DDRIoU losses outperformed GIoU, DIoU, CIoU, and EIoU. Using the CIoU loss used by default in YOLOv7 as a baseline, the mAP75 value of DDRIoU improved by 0.76%, and Focal-DDRIoU improved by 1.04%.

[0073] This improvement is primarily attributed to the DDRIoU loss. When the predicted and ground-truth bounding boxes have the same aspect ratio but different widths and heights, other IoU loss functions all yield the same loss value. This limitation prevents the model from effectively distinguishing between these two different cases during optimization, affecting detection accuracy. The DDRIoU loss addresses this issue by introducing the diagonal difference ratio between the predicted and ground-truth bounding boxes. This design enables the DDRIoU loss to more accurately reflect the actual difference between the predicted and ground-truth bounding boxes, guiding the model for more effective optimization.

[0074] The superiority of the DDRIoU loss lies not only in its improved model accuracy but also in its ability to more subtly reflect the actual difference between the predicted and ground-truth bounding boxes by introducing the concept of diagonal difference ratio. This design helps improve the stability and consistency of the model's predictions, thereby reducing the variance of the predictions.

[0075] Compared to DDRIoU loss, Focal-DDRIoU loss exhibits a slightly higher variance, but its variance remains relatively low. This result demonstrates that by introducing the concept of Focal-Loss, the model can more effectively focus on difficult-to-classify samples during training, improving performance without significantly increasing the instability of the results. This design helps the model perform more robustly and reliably in complex scenarios.

[0076] A comparative experiment was conducted between the APD-YOLOv7 network structure (hereinafter referred to as the APD network structure) and the YOLOv7 network structure. The experimental steps are as follows:

[0077] ① Only the use of IoU loss is changed, that is, GIoU loss, DIoU loss, CIoU loss, EIoU loss and Foacl-DDRIoU loss are used to train the YOLO v7 model respectively to test the performance of the original YOLOv7 network structure;

[0078] ②Replace the original network structure of the YOLOv7 model with the APD network structure;

[0079] ③Repeat step ①, change the loss function, and test the performance of the APD network structure.

[0080]

[0081] Table 2 uses L GIoU , L DIoU , L CIoU , L EIoU and L Focal-DDRIoU Performance comparison of trained YOLOv7 network structure and APD network structure

[0082]

[0083] Table 3 Comparison of YOLOv7 network structure and APD network structure parameters (batch=1)

[0084] As shown in Table 2, under the same IoU loss, the APD network architecture outperforms the YOLOv7 architecture. After replacing the YOLOv7 architecture with the APD network architecture, experiments using GIoU loss, DIoU loss, CIoU loss, EIoU loss, and Foacl-DDRIoU loss showed mAP75 improvements of 0.68%, 0.68%, 0.78%, 0.6%, and 0.56%, respectively. Overall, under the same conditions, training with the Foacl-DDRIoU loss and the APD-YOLOv7 architecture improved mAP75 by 2.06% compared to training with the EIoU loss and the YOLOv7 architecture.

[0085] As shown in Table 3, compared with the YOLOv7 network structure, the parameter size of the APD network structure is reduced by 3.9MB, and the GigaFloating-point Operations Per Second (GFLOPs) is reduced by 9.74%, reducing the number of model parameters and the computational burden.

[0086] The performance of other widely used object detection models is evaluated on the FIP6Set dataset.

[0087]

[0088] Table 4 Performance comparison of APD-YOLOv7 and other target detection models

[0089] As shown in Table 4, the APD-YOLOv7 model outlined in this paper significantly outperforms the YOLOv7 and YOLOv5-L models in terms of model detection accuracy. Its mAP 75 performance is 1.86% higher than that of the YOLOv5-L and YOLOv7 models, and its model parameter size is reduced by 13.5MB and 3.9MB, respectively. Regarding model detection speed, the APD-YOLOv7 model achieves a single-image inference time of 10.8ms. While this inference time is somewhat longer than that of the YOLOv7 and YOLOv5-L models, it still meets the standard for rapid identification of agricultural pests and diseases.

[0090] This is primarily due to improvements to the YOLOv7 network structure. The YOLOv7 network architecture was adjusted, with relatively redundant modules removed, appropriately supplemented with the C3 module, and the MobileViTv3 module embedded. This successfully reduced the model's parameter count and computational complexity, while further improving model accuracy.

[0091] Although the inference time for a single image has increased relatively, in agricultural pest and disease identification, strict real-time performance is usually not required. As long as the identification results can be given within a few seconds, it is sufficient for most application scenarios, so it still meets the needs of rapid identification of agricultural pests and diseases.

[0092] S5 uses the agricultural pest and disease detection model to accurately identify crop pests and diseases.

[0093] Specifically, the agricultural pest and disease detection model is used to accurately identify crop pests and diseases.

[0094] This paper first studies and designs a new loss function - Focal-DDRIoU loss, which improves the efficiency and accuracy of BBR;

[0095] Then, the network structure of YOLOv7 was adjusted and the C3 and MobileViTv3 modules were introduced. The MobileViTv3 module was embedded in the 17th layer of the backbone, which reduced the computational complexity, parameter count, and floating-point operations of the model, while further improving the recognition accuracy of the model.

[0096] The present invention uses mAP75 as the evaluation indicator and conducts performance evaluation on the FIP6Set dataset. Experiments show that the APD-YOLOv7 model is 1.6% and 1.86% higher than mainstream models such as YOLOv7 and YOLOv5-L, respectively. In addition, the Focal-DDRIoU loss proposed in this invention also outperforms the mainstream GIoU loss, DIoU loss, CIoU loss, and EIoU loss, which are 1.12%, 1.24%, 1.04%, and 1.5%, respectively. Although the single-image inference time of the APD-YOLOv7 model increases, it still meets the needs of rapid identification of agricultural pests and diseases.

[0097] Figure 3 Medium L GIOU L represents the loss value: that is, L GIOU is the loss value of GIoU, L DIOU is the loss value of DIoU, and so on. CIOU is the loss value of CIoU. EIOU is the loss value of EIoU. DDRIOU is the loss value of DDRIoU.

[0098] Figure 5 It is the network structure of YOLOv7, where input is input and output is output.

[0099] CBS convolutional batch normalization activation layer; ELAN efficient long-range attention network: MPconv multi-scale convolution operation; SPC pooling layer; Upsample upsampling layer; Concat splicing layer; ELAN-W efficient long-range attention network variant: it is very similar to the ELAN module. REPconv reparameterization layer: Backbone network. Head: Detection head, representing the top of the network structure.

[0100] Figure 6 In the figure: C is the number of channels of the image, H is the height of the image, and W is the width of the image; LocalRepresentationblock is the local representation module. Conv-1x1 is a 1x1 convolution operation, DWconv-3x3 is a 3x3 depth-separable convolution operation; Global Representation block is the global representation module. LinearTransfomersx N is N Transformer layers with linear properties. Transformer is a neural network model based on the self-attention mechanism. There is currently no official or widely recognized Chinese translation for Transformer. Fusionblock is a fusion module used to fuse the local representation module and the global representation module. Conv-1x1 is a 1x1 convolution operation

[0101] Figure 7 MobileViTBv3 is a lightweight module that combines convolutional neural networks (CNN) and vision transformers for mobile vision tasks. It should be translated as the third generation mobile vision transformer model (but there is currently no official or widely recognized Chinese translation). The C3 module: contains a cross-stage partial bottleneck structure module with 3 convolutional layers. The rest of the Figure 5 Input: input, output: output. CBS: convolutional batch normalization activation layer; ELAN: efficient long-range attention network: MPconv: multi-scale convolution operation; SPPC: pooling layer: concat layer; Upsample: upsampling layer. REPconv: reparameterization layer: backbone network. Head: detection head, representing the top of the network structure.

[0102] Beneficial effects:

[0103] (1) In order to solve the problem that the existing BBR loss function has the same value under different prediction results, a new BBR loss function, Diagonal Difference Ratio IoU (DDRIoU), is designed. DDRIoU is used as a new metric to compare the similarity between the predicted bounding box and the true bounding box in the BBR process.

[0104] (2) Considering the imbalance between high-quality and low-quality anchor frames in BBR, a regression version of the focus loss, Focal-DDRIoU loss, is designed based on the DDRIoU loss and combined with the Focal-Loss idea to enhance the contribution of high-quality anchor frames in model optimization while suppressing irrelevant anchor frames.

[0105] (3) The network structure of YOLOv7 was adjusted, and the MobileViTv3 module was introduced. The new network structure reduces the number of model parameters and computational complexity, enhances the network's feature extraction and fusion capabilities, and further improves the accuracy of the model.

[0106] The above disclosure is only a preferred embodiment of the agricultural pest and disease identification method based on diagonal loss of the present invention. Of course, this cannot be used to limit the scope of rights of the present invention. Ordinary technicians in this field can understand that implementing all or part of the processes of the above embodiment and making equivalent changes in accordance with the claims of the present invention still fall within the scope of the invention.

Claims

1. A method for identifying agricultural pests and diseases based on diagonal loss, characterized in that: The following steps are involved: Constructing a dataset of agricultural pests and diseases; Design a bounding box regression loss function based on the bounding box similarity comparison metric; Improve the network structure to obtain an improved network; The improved network is trained using the bounding box regression loss function to obtain an agricultural pest and disease detection model; Use the agricultural pest and disease detection model to accurately identify crop pests and diseases; In designing the bounding box regression loss function based on the bounding box similarity comparison metric, we include: The difference ratio of the diagonal of the predicted bounding box and the true bounding box is introduced into the bounding box similarity comparison metric to design the bounding box similarity comparison metric DDRIoU, and a new loss function L is obtained. DDRIoU ; The definition of DDRIoU loss is as follows: Use the traditional bounding box similarity comparison metric IoU to loss function L DDRIoU Weighted, we get a new loss function L Focal-DDRIoU ; The network structure is improved to obtain an improved network, including: The two ELAN modules of the YOLOv7 network structure were removed, and the C3 module was added to supplement the feature extraction capability of the network; Specifically: in the backbone part, two ELAN modules were removed, and a C3 module was added to supplement the network's feature extraction capabilities, introducing the C3 module and the MobileViTv3 module; A MobileViTv3 module is embedded between the remaining two ELAN modules to form a new APD-YOLOv7 network structure; Specifically, a MobileViTv3 module is embedded between the remaining two ELAN modules; in the head part, a C3 module is used to replace all ELAN-W modules, thus forming a new APD-YOLOv7 network structure.

2. The agricultural pest identification method based on diagonal loss according to claim 1, characterized in that: In constructing an agricultural pest and disease dataset, the agricultural pest and disease dataset includes field photos, public datasets, and Internet data. The field photos include citrus canker and snow pea cabbage caterpillars; the public dataset includes Acridoidea insects and bean blister beetles; and the Internet data includes grape black rot and grape leaf blight.

3. The agricultural pest identification method based on diagonal loss according to claim 1, characterized in that: In the improved network structure, the C3 module is a key component in YOLOv5, which adopts a hierarchical structure to extract features and connects low-level feature maps to high-level feature maps through a series of convolutional layers and bottleneck structures. The MobileViTv3 module is a lightweight model suitable for mobile vision tasks.