Litchi disease and pest detection method, detection platform and terminal based on improved YOLOv6

By improving the YOLOv6 model and adapting to embedded devices, the insufficient accuracy of litchi pest detection and equipment deployment problems in complex backgrounds have been solved, efficient and accurate pest identification have been achieved, and the intelligent level of orchard production has been improved.

CN119418266AActive Publication Date: 2025-02-11SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411435894.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-02-11
Estimated Expiration
2044-10-15

AI Technical Summary

Technical Problem

The prior art has insufficient accuracy in lychee disease and pest detection in complex contexts, especially in natural environments, and traditional YOLO models are difficult to deploy on resource-constrained devices.

Method used

Improve the YOLOv6 model, and trained by optimizing network structure and algorithm parameters, combining data augmentation technology and deep learning framework pytorch for training, generate pt models for lychee pest detection, and adapt it to embedded models through model transformation, quantization and deployment modules. equipment.

Benefits of technology

It significantly improves the accuracy and detection speed of litchi pest detection, can be deployed stably on resource-constrained equipment, achieve real-time and accurate pest identification, and improves the intelligent level of litchi orchard production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119418266A_ABST
    Figure CN119418266A_ABST
Patent Text Reader

Abstract

The invention discloses an improved YOLOv6-based litchi disease and insect pest detection method, detection platform and terminal, and the method comprises the steps: photographing and collecting disease and insect pest pictures, marking the pictures, constructing a litchi disease and insect pest data set required by training in a real orchard scene, and carrying out the data enhancement processing of the data set through a data enhancement technology; training an improved YOLOV6 model on a pytorch framework by using the processed data set, and obtaining a trained litchi disease and insect pest detection pt model through parameter adjustment; collecting litchi plant pictures and inputting the litchi plant pictures into the trained litchi disease and insect pest detection pt model to obtain a litchi disease and insect pest detection result; the trained pt model is converted into a universal onnx model, model cutting is carried out, then the model is converted into an rknn model, ptq quantification is carried out, the model is quantified from a float32 type to an int8 type, an API interface for model reasoning is called on embedded equipment, and the model is deployed on a detection platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of orchard pest detection and target detection model deployment, and more specifically to a litchi pest detection method, a detection platform and a terminal based on improved YOLOv6. Background Art

[0002] Lychee is a common fruit, but it is also susceptible to various diseases and pests. The more common diseases and pests include stink bugs, loopers, felt disease, anthracnose, etc. These diseases and pests will affect the photosynthesis and nutrient absorption of lychees, the normal growth and function of leaves, causing the fruit to rot and deteriorate and causing certain harm to the growth of lychee trees, resulting in a decrease in lychee yield and quality, seriously affecting the economic benefits of the orchard. Due to the large number of types of lychee diseases and pests and the complex causes of diseases and pests, it is not conducive to the prevention and diagnosis of lychee diseases and pests; and the traditional method of disease and pest diagnosis is through manual detection and identification. This method requires high planting and observation experience of growers. New fruit farmers can only ask experts to come to their homes for guidance. The diagnosis is slow, inefficient, expensive, subjective, inaccurate and time-ineffective.

[0003] At present, the typical target detection model YOLO series is suitable for application in mobile terminals and embedded devices due to its fast detection speed and high accuracy.

[0004] However, the traditional YOLO pest and disease detection model may perform poorly in complex backgrounds, especially in natural environments. The diversity and unstructured features of the background will affect the detection accuracy. At the same time, the range of litchi pests and diseases will also affect the accuracy of detection.

[0005] Moreover, the computational complexity of the float32 YOLO model is still too large for the rv1126 chip, making it difficult to deploy the target detection model on resource-constrained devices.

[0006] Therefore, how to improve the accuracy of detecting litchi pests and diseases and the detection accuracy of multi-scale targets, and how to deploy target detection models on resource-constrained devices to facilitate more accurate and rapid detection of litchi pests and diseases and improve the level of intelligence in litchi orchard production are issues that technical personnel in this field urgently need to solve. Summary of the invention

[0007] In view of this, the present invention provides a litchi pest and disease detection method, detection platform and terminal based on improved YOLOv6 to solve some of the technical problems mentioned in the background technology.

[0008] In order to achieve the above object, the present invention adopts the following technical solution:

[0009] A litchi pest and disease detection method based on improved YOLOv6 comprises the following steps:

[0010] S1. Take and collect pest and disease pictures, annotate the pictures to build a litchi pest and disease dataset in a real orchard scene required for training, and use data enhancement technology to enhance the dataset;

[0011] S2. Use the processed data set to train the improved YOLOV6 model on the pytorch framework, and obtain the trained litchi pest and disease detection pt model by adjusting the parameters;

[0012] S3. Collect litchi plant pictures and input them into the trained litchi pest and disease detection pt model to obtain litchi pest and disease detection results.

[0013] Preferably, the specific details of the improved YOLOv6 model training process are as follows:

[0014] S21. Read litchi pest and disease images and corresponding labels, and preprocess the images and labels into 640*640*3 images through letterbox operation, and then input them into the improved YOLOv6 model;

[0015] S22. After the model receives the 640*640 RGB image input, it obtains many predicted detection frames through the improved YOLOv6 model, and filters out redundant detection frames through NMS;

[0016] S23. After obtaining the final predicted detection frame, the classification loss and regression loss are calculated respectively with the actual label category and annotation frame, and the model parameters are updated through the back propagation algorithm to finally obtain the trained litchi pest and disease detection pt model.

[0017] Preferably, the improved YOLOv6 model includes a backbone network backbone, a neck network neck and a detection head detect head;

[0018] The backbone network uses EfficientRep, which includes a RepVGGBlock layer and four ERBlocks. First, it passes through a RepVGGBlock layer for downsampling and expands the number of channels. Then it passes through four ERBlocks for four downsamplings. After each downsampling, the feature map is saved. Finally, the backbone network outputs four feature maps of different sizes as the input of the neck network. The four feature maps are x3, x2, x1, and x0 in descending order.

[0019] The neck network uses RepBiFPANNeck, which includes convolutional layers, upsampling modules, downsampling modules, bidirectional fusion layers, RepBlock, and HALF high- and low-order fusion modules. The neck network outputs three feature maps of different sizes to the detection head for parsing;

[0020] The detection head uses an efficient decoupled head, which consists of multiple convolutional layers and adopts a hybrid channel strategy. It predicts the final detection result based on the multi-level features of the neck input, and separates classification and positioning into two branches for decoupling.

[0021] Preferably, the first three ERBlocks of the backbone network include an improved downsampling module SPBlock and a RepBlock, and the last ERBlock includes an improved downsampling module SPBlock, a RepBlock and a CSPSPPF module;

[0022] SPBlock is used for downsampling, splitting the input features into two parts in the channel dimension. The representative part performs convolution to extract important information, and the uncertain part performs convolution to supplement the implicit detail information.

[0023] RepBlock contains multiple RepVGGBlocks to perform deep feature extraction;

[0024] The CSPSPPF module improves SPPF and achieves speed improvement while keeping the receptive field unchanged.

[0025] Preferably, the neck network outputs three feature maps of different sizes to the detection head for analysis, and the specific content is:

[0026] (1) Perform a 1x1 convolution on x0 to reduce the number of channels to 1 / 4 of the original number, denoted as fpn_out0, and then input it into the bidirectional fusion layer together with x1 and x2 for multi-scale feature fusion. After multiple RepBlocks, the fused features are extracted as low-order features, denoted as f_out0;

[0027] (2) Perform another 1x1 convolution on f_out0 to reduce the number of channels to 1 / 2 of the original number, denoted as fpn_out1, and input it into the bidirectional fusion layer together with x2 and x3 for multi-scale fusion again. After passing through multiple RepBlocks, the feature layer for detecting small targets is obtained as the first output feature map of the neck network, denoted as pan_out2;

[0028] (3) pan_out2 is downsampled and concatenated with fpn_out1 in the channel dimension. The fused features are extracted through multiple RepBlocks as mid-order features, recorded as pan_out1_tmp;

[0029] (4) Downsample the mid-order feature pan_out1_tmp and concatenate it with fpn_out0 in the channel dimension. After multiple RepBlocks, the fused features are extracted as the third output feature map of the neck network, denoted as pan_out0;

[0030] (5) The HALF high-low order fusion module fuses the mid-order feature pan_out1_tmp and the low-order feature f_out0 as the second output feature map of the neck network, denoted as pan_out1.

[0031] Preferably, in step S23, the classification loss uses VariFocal Loss, and by considering positive and negative samples of different importance, the back propagation learning from the two samples is balanced, specifically:

[0032]

[0033] Among them, is the IACS predicted by the model, is the target IoU score, α and γ are hyperparameters for large negative samples, α prevents over-suppression, and γ reduces the contribution of negative samples.

[0034] Preferably, in step S23, the regression loss uses GIoULoss, and an item is added after IoU to calculate the minimum bounding rectangle of the predicted box and the real box, which is used to characterize the distance between the two boxes, specifically:

[0035]

[0036] L GIoU =1-GIoU

[0037] Preferably, during the training process, the learning rate adopts a preheating and cosine annealing strategy, specifically:

[0038] Assuming that the warm-up phase lasts for T rounds, the initial warm-up learning rate is η_0, and the final initial learning rate is η_init, then in the tth round, the learning rate η_t is:

[0039] η_t=η_0+(η_init-η_0)×(t / T)

[0040] Set the current training round number to i, the end round to epoch, the final learning rate to η_end, and the learning rate is calculated as:

[0041] η=η_end+(η_init-η_end)*(1+cos(i / epoch*π)) / 2.

[0042] A litchi pest and disease detection platform based on improved YOLOv6, based on the litchi pest and disease detection method based on improved YOLOv6, comprising: a trained litchi pest and disease detection pt model, a model conversion module, a model quantization module and a model deployment module;

[0043] The trained litchi pest and disease detection pt model is obtained by using the litchi pest and disease detection method based on improved YOLOv6 as described in any one of claims 1 to 8;

[0044] The model conversion module is used to convert the trained pt model into a general onnx model, perform onnx model cropping, and then convert it into a rknn model;

[0045] The model quantization module is used to perform ptq quantization on the rknn model, quantizing the model from float32 type to int8 type;

[0046] The model deployment module is used to complete the writing of model pre-processing and post-processing code on embedded devices, call the model reasoning API interface, and deploy the model on the detection platform.

[0047] A processing terminal comprises a memory and a processor, wherein a computer program that can be run on the processor is stored in the memory, and when the processor executes the computer program, a litchi pest and disease detection method based on improved YOLOv6 is implemented.

[0048] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses a litchi pest and disease detection method, a detection platform and a terminal based on an improved YOLOv6, which solves the deficiencies of the current pest and disease detection method in terms of real-time performance, accuracy and platform deployment. The improved YOLOv6 model adopts advanced deep learning technology, and the network structure and algorithm parameters are optimized to significantly improve the detection speed and accuracy of the model. Compared with the current pest and disease detection method, the improved YOLOv6 model can achieve faster image processing and more accurate pest and disease identification, thereby providing litchi growers with an efficient and convenient pest and disease monitoring tool.

[0049] In addition, the improved YOLOv6 model also has good generalization ability and robustness, and can work stably under different environments and lighting conditions. By deploying on a high-performance and low-power detection platform such as RV112, the model can realize edge computing, that is, data processing and analysis near the data source, reducing data transmission delays and bandwidth requirements, and improving the response speed of the overall system;

[0050] In summary, the present invention proposes to improve the YOLOv6 litchi pest and disease detection model and implements its deployment on the rv1126 platform, thereby realizing real-time and accurate detection of litchi pests and diseases on the low-cost rv1126 platform, improving the accuracy of the model in detecting litchi pests and diseases and the detection accuracy of multi-scale targets, greatly improving the intelligent level of litchi orchard production, and providing strong technical support for the early detection and prevention of litchi pests and diseases, improving litchi yield and quality, and promoting the sustainable development of agriculture. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0052] Figure 1 A schematic diagram of a litchi pest and disease detection method based on improved YOLOv6 provided by the present invention;

[0053] Figure 2 A schematic diagram of the improved YOLOV6 model structure provided by the present invention;

[0054] Figure 3 A schematic diagram of the SPBlock module structure provided by the present invention;

[0055] Figure 4 A schematic diagram of the CSPSPPF module structure provided by the present invention;

[0056] Figure 5 A schematic diagram of the structure of the HALF high- and low-order fusion module provided by the present invention;

[0057] Figure 6 A schematic diagram of a method for deploying a litchi pest and disease detection platform based on improved YOLOv6 provided by the present invention. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0059] The embodiment of the present invention discloses a litchi pest and disease detection method based on improved YOLOv6, such as Figure 1 , including the following steps:

[0060] S1. Take and collect pest and disease pictures, annotate the pictures to build a litchi pest and disease dataset in a real orchard scene required for training, and use data enhancement technology to enhance the dataset;

[0061] S2. Use the processed data set to train the improved YOLOV6 model on the pytorch framework, and obtain the trained litchi pest and disease detection pt model by adjusting the parameters;

[0062] S3. Collect litchi plant pictures and input them into the trained litchi pest and disease detection pt model to obtain litchi pest and disease detection results.

[0063] In this embodiment, pest and disease pictures are taken and collected using a smartphone, and the labelme software is used to annotate the pictures with the types and locations of pests and diseases, and finally a litchi pest and disease dataset is constructed. The annotation file is a txt file with the same name as the picture. Each line of data in the annotation file represents a target in the picture with the same name, and the data annotation content is (class, x, y, h, w), where class is an integer representing the target type number, x and y represent the normalized pixel position of the center of the annotation box in the corresponding picture, and h and w represent the normalized width and height of the annotation box.

[0064] Furthermore, data enhancement technology is used to perform data enhancement operations on the dataset: the number of rare pests and diseases datasets is increased by rotating, flipping, adding noise, and adjusting brightness, contrast, and saturation for pests and diseases with a small number of images in proportion, so that the dataset tends to be balanced.

[0065] In order to further implement the above technical solution, the specific details of the improved YOLOv6 model training process are as follows:

[0066] S21. Read litchi pest and disease images and corresponding labels, and preprocess the images and labels into 640*640*3 images through letterbox operation, and then input them into the improved YOLOv6 model;

[0067] The letterbox operation is to adjust the size according to the height and width and fill it;

[0068] S22. After the model receives the 640*640 RGB image input, it obtains many predicted detection frames through the improved YOLOv6 model, and filters out redundant detection frames through NMS;

[0069] S23. After obtaining the final predicted detection frame, the classification loss and regression loss are calculated respectively with the actual label category and annotation frame, and the model parameters are updated through the back propagation algorithm to finally obtain the trained litchi pest and disease detection pt model.

[0070] In this embodiment, the letterbox operation preprocessing is specifically as follows: first, based on the length and width, the longer side is taken as the reference, scaled in proportion, and resized to 640. The shorter side is scaled according to the proportion, and if it is less than 640, pixels are added to both sides, and the added pixel value is (114, 114, 114).

[0071] In order to further implement the above technical solution, Figure 2 , the improved YOLOv6 model includes the backbone network backbone, the neck network neck and the detection head detect head;

[0072] The backbone network uses EfficientRep, which includes a RepVGGBlock layer (RepVGG block) and four ERBlocks (ER blocks) in sequence. The size of the input feature map is 640*640, and the number of channels is 3. First, it passes through a RepVGGBlock layer for downsampling, and the number of channels is expanded from 3 to 32. The height and width of the feature map become 320. Then it passes through four ERBlocks for four downsamplings in sequence. The feature map is saved after each downsampling. Finally, the backbone network outputs four feature maps of different sizes as the input of the neck network. The four feature maps are x3, x2, x1, and x0 in descending order.

[0073] The neck network uses RepBiFPANNeck, which includes convolutional layers, upsampling modules, downsampling modules, bidirectional fusion layers, RepBlock, and HALF high- and low-order fusion modules. The neck network outputs three feature maps of different sizes to the detection head for parsing;

[0074] The detection head uses an efficient decoupled head, which consists of multiple convolutional layers and adopts a hybrid channel strategy. It predicts the final detection result based on the multi-level features of the neck input, and separates classification and positioning into two branches for decoupling.

[0075] In order to further implement the above technical solution, the first three ERBlocks of the backbone network include improved downsampling modules SPBlock (SP block) and RepBlock (Rep block), and the last ERBlock includes improved downsampling modules SPBlock, RepBlock and a CSPSPPF module;

[0076] like Figure 3, SPBlock is used for downsampling, splitting the input features into two parts in the channel dimension. The Representative part performs convolution to extract important information. Specifically, the first part of the output features is obtained by adding the convolution results after Group wise convolution and Pointwise convolution. The Redundant part performs convolution to supplement the implicit detail information. Specifically, the second part of the output features is obtained after Point wise convolution. The two parts of the output features are used to perform GAP global average pooling operations and then stack operations. The corresponding weights are obtained through softmax to weight the two parts of the output features respectively, and finally added to obtain the output;

[0077] RepBlock contains multiple RepVGGBlocks to perform deep feature extraction;

[0078] The CSPSPPF module improves SPPF and increases speed while keeping the receptive field unchanged. Figure 4 ;

[0079] Specifically: First, the input features are passed through three convolutions, and then divided into two branches. One branch performs 1x1 convolution, and the other branch performs three Maxpool maximum poolings and splices them and then undergoes two convolutions. After that, they are spliced ​​with the result of the convolution of the first branch, and finally a 1x1 convolution is performed to obtain the final result.

[0080] In order to further implement the above technical solution, the neck network outputs three feature maps of different sizes to the detection head for analysis. The specific contents are:

[0081] (1) Perform a 1x1 convolution on x0 to reduce the number of channels to 1 / 4 of the original number, denoted as fpn_out0, and then input it into the bidirectional fusion layer together with x1 and x2 for multi-scale feature fusion. After multiple RepBlocks, the fused features are extracted as low-order features, denoted as f_out0;

[0082] (2) Perform another 1x1 convolution on f_out0 to reduce the number of channels to 1 / 2 of the original number, denoted as fpn_out1, and input it into the bidirectional fusion layer together with x2 and x3 for multi-scale fusion again. After passing through multiple RepBlocks, the feature layer for detecting small targets is obtained as the first output feature map of the neck network, denoted as pan_out2;

[0083] (3) pan_out2 is downsampled and concatenated with fpn_out1 in the channel dimension. The fused features are extracted through multiple RepBlocks as mid-order features, recorded as pan_out1_tmp;

[0084] (4) Downsample the mid-order feature pan_out1_tmp and concatenate it with fpn_out1 in the channel dimension. After multiple RepBlocks, the fused features are extracted as the third output feature map of the neck network, denoted as pan_out0;

[0085] (5) Figure 5 , the HALF high-low order fusion module fuses the mid-order feature pan_out1_tmp and the low-order feature f_out0 as the second output feature map of the neck network to enhance the utilization of the features, recorded as pan_out1; specifically: the two input pan_out1_tmp and f_out0 are concatenated and GAP global average pooling is performed, and then two PWConv point convolutions are performed, and then the weight correspondence is obtained by the activation function Sigmoid and multiplied by the original input to obtain two corresponding outputs. The two outputs are concatenated and then PWConv is performed in two ways, and GAP plus two PWConv processes and two PWConv processes are performed separately. The results are multiplied and activated using the Sigmoid function as the weight information, multiplied with the original two corresponding outputs, and then added to obtain the final output as the second output feature map pan_out1 of the neck network.

[0086] The label assignment method uses AnchorFree to determine the location of the target through an anchor-based paradigm. Its regression branch actually predicts the distance from the anchor to the four sides of the box. After obtaining the final predicted detection box, the loss is calculated with the actual label, and the model parameters are updated through the back-propagation algorithm to make the model prediction more accurate.

[0087] In order to further implement the above technical solution, in step S23, the classification loss uses VariFocal Loss, and the back propagation learning from the two samples is balanced by considering positive and negative samples of different importance, specifically:

[0088]

[0089] Among them, is the IACS predicted by the model, is the target IoU score, α and γ are hyperparameters for large negative samples, α prevents over-suppression, and γ reduces the contribution of negative samples.

[0090] In order to further implement the above technical solution, in step S23, the regression loss uses GIoULoss, and an item is added after IoU to calculate the minimum bounding rectangle of the predicted box and the real box, which is used to characterize the distance between the two boxes. Specifically:

[0091]

[0092] L GIoU=1-GIoU In order to further implement the above technical solution, during the training process, the learning rate adopts the preheating and cosine annealing strategy, specifically:

[0093] Assuming that the warm-up phase lasts for T rounds, the initial warm-up learning rate is η_0, and the final initial learning rate is η_init, then in the tth round, the learning rate η_t is:

[0094] η_t=η_0+(η_init-η_0)×(t / T)

[0095] Set the current training round number to i, the end round to epoch, the final learning rate to η_end, and the learning rate is calculated as:

[0096] η=η_end+(η_init-η_end)*(1+cos(i / epoch*π)) / 2.

[0097] After the training, the best pt model is saved and compared with the original model. The verification results are shown in Table 1 below:

[0098] Table 1 is a comparison of the results before and after the model improvement:

[0099] mAP@0.5 / % mAP@.5:0.95 / % YOLOv6 81.7 57.4 Improved YOLOv6 83.3 58.7

[0100] A litchi pest and disease detection platform based on improved YOLOv6, such as Figure 6 , a litchi pest and disease detection method based on improved YOLOv6, including: a trained litchi pest and disease detection pt model, a model conversion module, a model quantization module and a model deployment module;

[0101] The trained litchi pest and disease detection pt model is obtained using a litchi pest and disease detection method based on improved YOLOv6;

[0102] The model conversion module is used to convert the trained pt model into a general onnx model, perform onnx model cropping, and then convert it into a rknn model;

[0103] The model quantization module is used to perform ptq quantization on the rknn model, quantizing the model from float32 type to int8 type;

[0104] The model deployment module is used to complete the writing of model pre-processing and post-processing code on embedded devices, call the model reasoning API interface, and deploy the model on the detection platform.

[0105] In this embodiment, the detection platform is taken as rv1126 platform as an example:

[0106] Use the appropriate version of the onnx library to convert the pt model into an onnx model. In order to adapt to the rv1126 platform, onnx needs to be trimmed to retain the six decoupling heads required for classification and regression, and the nodes in the latter part need to be deleted;

[0107] Configure the environment for converting to the RKNN model, install the RKNN-toolkit tool, put about 50 pre-processed image paths in dataset.txt as the calibration dataset, and convert the ONNX model to the RKNN model; PTQ quantization uses the minimum and maximum scaling, the specific formula is as follows:

[0108] scale=(int_max-int_min) / (fp_max-fp_min)

[0109] zero_point=round(-fp_min*scale+int_min)

[0110] quantized_valu=round((float_value-fp_min)*scale)+zero_point

[0111] Among them, quantized_value is the quantized fixed-point number, which is of int8 type, float_value is the floating-point number to be quantized, fp_min and fp_max are the minimum and maximum values ​​of the float32 range, int_max and int_min are the minimum and maximum values ​​of the int8 type, scale is the quantization scale factor, which is used to scale the range of floating-point numbers to the range of fixed-point numbers, and zero_point is the zero point value, which is used to determine the position of the zero point after quantization;

[0112] Use C++ to complete the writing of model pre-processing and post-processing code on embedded devices, call the model reasoning API interface, and finally deploy the model on the rv1126 platform.

[0113] The converted rknn model only accepts 640*640*3 inputs, so the collected images need to be processed into 640*640 size by letterbox written in C++ code before they can be input into the rknn model. After reasoning, the model outputs six decoupling heads, which are post-processed to obtain the final prediction results, completing the deployment of the litchi pest and disease model on the rv1126 platform.

[0114] A processing terminal comprises a memory and a processor. The memory stores a computer program that can be run on the processor. When the processor executes the computer program, a litchi pest and disease detection method based on improved YOLOv6 is implemented.

[0115] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0116] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one 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 present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A litchi pest and disease detection method based on improved YOLOv6, characterized in that: The following steps are involved: S1. Take and collect pest and disease pictures, annotate the pictures to build a litchi pest and disease dataset in a real orchard scene required for training, and use data enhancement technology to enhance the dataset; S2. Use the processed data set to train the improved YOLOV6 model on the pytorch framework, and obtain the trained litchi pest and disease detection pt model by adjusting the parameters; S3. Collect litchi plant pictures and input them into the trained litchi pest and disease detection pt model to obtain litchi pest and disease detection results.

2. A litchi pest and disease detection method based on improved YOLOv6 according to claim 1, characterized in that: The specific details of the improved YOLOv6 model training process are as follows: S21. Read litchi pest and disease images and corresponding labels, and pre-process the images and labels into 640*640*3 images through letterbox operation, and then input them into the improved YOLOv6 model; S22. After the model receives the 640*640 RGB image input, it obtains many predicted detection frames through the improved YOLOv6 model, and filters out redundant detection frames through NMS; S23. After obtaining the final predicted detection frame, the classification loss and regression loss are calculated respectively with the actual label category and annotation frame, and the model parameters are updated through the back propagation algorithm to finally obtain the trained litchi pest and disease detection pt model.

3. A litchi pest and disease detection method based on improved YOLOv6 according to claim 1, characterized in that, The improved YOLOv6 model includes a backbone network, a neck network, and a detection head. The backbone network uses EfficientRep, which includes a RepVGGBlock layer and four ERBlocks. First, it passes through a RepVGGBlock layer for downsampling and expands the number of channels. Then it passes through four ERBlocks for four downsamplings. After each downsampling, the feature map is saved. Finally, the backbone network outputs four feature maps of different sizes as the input of the neck network. The four feature maps are x3, x2, x1, and x0 in descending order. The neck network uses RepBiFPANNeck, which includes convolutional layers, upsampling modules, downsampling modules, bidirectional fusion layers, RepBlock, and HALF high- and low-order fusion modules. The neck network outputs three feature maps of different sizes to the detection head for parsing; The detection head uses an efficient decoupled head, which consists of multiple convolutional layers and adopts a hybrid channel strategy. It predicts the final detection result based on the multi-level features of the neck input, and separates classification and positioning into two branches for decoupling.

4. A litchi pest and disease detection method based on improved YOLOv6 according to claim 3, characterized in that: The first three ERBlocks of the backbone network include an improved downsampling module SPBlock and RepBlock, and the last ERBlock includes an improved downsampling module SPBlock, RepBlock and a CSPSPPF module; SPBlock is used for downsampling, splitting the input features into two parts in the channel dimension. The representative part performs convolution to extract important information, and the uncertain part performs convolution to supplement the implicit detail information. RepBlock contains multiple RepVGGBlocks to perform deep feature extraction; The CSPSPPF module improves SPPF and achieves speed improvement while keeping the receptive field unchanged.

5. A litchi pest and disease detection method based on improved YOLOv6 according to claim 3, characterized in that: The neck network outputs three feature maps of different sizes to the detection head for analysis: (1) Perform a 1x1 convolution on x0 to reduce the number of channels to 1 / 4 of the original number, denoted as fpn_out0, and then input it into the bidirectional fusion layer together with x1 and x2 for multi-scale feature fusion. After multiple RepBlocks, the fused features are extracted as low-order features, denoted as f_out0; (2) Perform another 1x1 convolution on f_out0 to reduce the number of channels to 1 / 2 of the original number, denoted as fpn_out1, and input it into the bidirectional fusion layer together with x2 and x3 for multi-scale fusion again. After passing through multiple RepBlocks, the feature layer for detecting small targets is obtained as the first output feature map of the neck network, denoted as pan_out2; (3) pan_out2 is downsampled and concatenated with fpn_out1 in the channel dimension. The fused features are extracted through multiple RepBlocks as mid-order features, recorded as pan_out1_tmp; (4) Downsample the mid-order feature pan_out1_tmp and concatenate it with fpn_out0 in the channel dimension. After multiple RepBlocks, the fused features are extracted as the third output feature map of the neck network, denoted as pan_out0; (5) The HALF high-low order fusion module fuses the mid-order feature pan_out1_tmp and the low-order feature f_out0 as the second output feature map of the neck network, denoted as pan_out1.

6. A litchi pest and disease detection method based on improved YOLOv6 according to claim 2, characterized in that: In step S23, the classification loss uses VariFocal Loss, which balances the back propagation learning from the two samples by considering positive and negative samples of different importance, specifically: Among them, is the IACS predicted by the model, is the target IoU score, α and γ are hyperparameters for large negative samples, α prevents over-suppression, and γ reduces the contribution of negative samples.

7. A litchi pest and disease detection method based on improved YOLOv6 according to claim 2, characterized in that: In step S23, the regression loss uses GIoULoss, and an item is added after IoU to calculate the minimum bounding rectangle of the predicted box and the real box, which is used to characterize the distance between the two boxes. Specifically: L GIoU = 1-GIoU.

8. A litchi pest and disease detection method based on improved YOLOv6 according to claim 2, characterized in that: During the training process, the learning rate adopts the warm-up and cosine annealing strategy, specifically: Assuming that the warm-up phase lasts for T rounds, the initial warm-up learning rate is η_0, and the final initial learning rate is η_inti, then in the tth round, the learning rate η_t is: η_t=η_0+(η_init-η_0)×(t / T) Set the current training round number to i, the end round to epoch, the final learning rate to η_end, and the learning rate is calculated as: η=η_end+(η_init-η_end)*(1+cos(i / epoch*π)) / 2.

9. A litchi pest and disease detection platform based on improved YOLOv6, characterized in that: A litchi pest and disease detection method based on improved YOLOv6 according to any one of claims 1 to 8, comprising: a trained litchi pest and disease detection pt model, a model conversion module, a model quantization module and a model deployment module; The trained litchi pest and disease detection pt model is obtained by using the litchi pest and disease detection method based on improved YOLOv6 as described in any one of claims 1 to 8; The model conversion module is used to convert the trained pt model into a general onnx model, perform onnx model cropping, and then convert it into a rknn model; The model quantization module is used to perform ptq quantization on the rknn model, quantizing the model from float32 type to int8 type; The model deployment module is used to complete the writing of model pre-processing and post-processing code on embedded devices, call the model reasoning API interface, and deploy the model on the detection platform.

10. A processing terminal, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the method for detecting litchi pests and diseases based on improved YOLOv6 as described in any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Litchi disease and insect pest detection method based on improved EfficentDet

    CN114898359A

  • Examination room abnormal behavior detection method based on improved YOLOv7 model

    CN116778581A

  • Litchi disease real-time detection system and method based on edge calculation and yolov7-tiny

    CN116824369A