Low-altitude citrus pest and disease identification method and device based on improved yolov8 and medium

By improving the YOLOv8 model, adding the EMA attention module and a lightweight design, the problems of accuracy and small target detection in complex environments for citrus pest and disease identification were solved, achieving efficient and accurate multi-scale target identification.

CN121545151BActive Publication Date: 2026-03-31EAST CHINA JIAOTONG UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-22
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing methods for identifying citrus pests and diseases have low accuracy in complex environments, require a large number of model parameters, and miss small targets, making it difficult to efficiently identify multi-scale targets on UAV platforms.

Method used

The YOLOv8 model was improved by adding an EMA attention module before the detection head, using the ADown downsampling module, GSConv module, and GSC2FLighter module, and adding a 160×160 high-resolution small target detection head to build a lightweight and efficient recognition model.

Benefits of technology

It improves the accuracy and adaptability of pest and disease identification, reduces the number of model parameters, enhances the detection performance of small-scale targets, and is suitable for complex orchard environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121545151B_ABST
    Figure CN121545151B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of target detection, and discloses a low-altitude citrus disease and pest identification method, equipment and medium based on improved YOLOv8, which comprises the following steps: acquiring a citrus image to be identified; adopting a deep improved citrus disease and pest identification model to process the image and output an identification result; the key improvement of the model is that in the backbone feature extraction network, an ADown downsampling module is adopted to replace the last three conventional downsampling modules to realize efficient and information-rich feature dimension reduction; in the neck feature fusion network, a light-weight GSC2FLighter module and a GSConv module are adopted to replace the original C2F module and the conventional convolution to greatly reduce the model parameter quantity; in the detection head prediction network, a small target detection head with a size of 160*160 is additionally arranged to improve the small target detection rate, and an EMA attention module is introduced in front of all the detection heads to focus on key features. The method effectively improves the identification accuracy of multi-scale, especially small-scale citrus diseases and pests in a complex orchard environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of target detection technology, and in particular to a method, device and medium for identifying low-altitude citrus pests and diseases based on an improved YOLOv8. Background Technology

[0002] Citrus, as one of the world's most important economic crops, is widely planted in my country, and its yield and quality directly affect the economic benefits of fruit farmers and the supply of fruit in the market. However, citrus is susceptible to various diseases and pests during its growth cycle, such as Huanglongbing (HLB), canker, and anthracnose. Failure to identify and control these diseases in a timely and accurate manner can lead to severe yield reduction or even crop failure. Traditional disease and pest identification mainly relies on manual experience, that is, fruit farmers or agricultural technicians make judgments by observing the morphology, color changes, and insect characteristics of lesions on leaves, fruits, or branches. However, this method has significant limitations: firstly, it is highly dependent on the experience of professionals, is subjective, and has a high rate of misjudgment; secondly, manual inspection is inefficient and difficult to fully cover large-area orchards, especially those in hilly and mountainous areas with complex terrain; thirdly, early symptoms of diseases and pests, such as tiny lesions and newly hatched larvae, are difficult to identify with the naked eye, making it easy to miss the optimal window for prevention and control.

[0003] With the rapid development of computer vision and agricultural intelligence, image-based automatic pest and disease identification technology has become a research hotspot. Among them, deep learning models, represented by convolutional neural networks (CNNs), have demonstrated high accuracy in crop pest and disease identification tasks due to their powerful feature extraction capabilities. YOLOv8, as one of the representative models in the field of object detection, has improved the detection accuracy of small targets while maintaining real-time detection speed by optimizing the network structure, such as improving the backbone network, feature fusion module, and detection head design, and has been gradually applied to agricultural scenarios.

[0004] However, existing deep learning-based methods for identifying citrus diseases and pests still face many challenges in practical applications. First, real orchard environments are complex, with variations in lighting, foliage obstruction, and cluttered backgrounds, all of which severely interfere with image recognition. Second, models deployed on mobile devices or drone platforms need to be lightweight, but this often comes at the cost of reduced detection accuracy; striking a balance between the two is a difficult problem. Finally, the size of citrus disease and pest targets varies greatly, especially the effective detection of small targets such as early lesions, which places higher demands on the model's multi-scale feature perception capabilities. Therefore, there is an urgent need for a citrus disease and pest identification method that can adapt to complex orchard environments, balance lightweight design with high accuracy, and effectively detect multi-scale, especially small-scale, targets. Summary of the Invention

[0005] The present invention aims to provide a method, device and medium for identifying low-altitude citrus pests and diseases based on an improved YOLOv8, in order to solve the problems of low identification accuracy, large number of model parameters and missed detection of small targets in the existing technology under complex environments.

[0006] In a first aspect, the present invention provides a method for identifying low-altitude citrus pests and diseases based on an improved YOLOv8, comprising the following steps:

[0007] Obtain the image of the citrus fruit to be identified;

[0008] The citrus images were processed using a citrus disease and pest identification model to obtain disease and pest identification results;

[0009] The citrus pest and disease identification model includes a backbone feature extraction network, a neck feature fusion network, and a detection head prediction network connected in sequence.

[0010] The backbone feature extraction network is used to extract features from the input citrus image. It includes at least one downsampling module and replaces the last three downsampling modules in the original YOLOv8 model backbone network with ADown downsampling modules.

[0011] The neck feature fusion network is used to fuse the multi-scale features output by the backbone feature extraction network. It replaces the C2F module in the original YOLOv8 model neck network with the GSC2FLighter module and replaces the regular convolution module with the GSConv module.

[0012] The detection head prediction network is used to generate recognition results based on the features output by the neck feature fusion network. It adds a small target detection head to the original three-scale detection head of the YOLOv8 model to form a four-scale detection head, and adds an EMA attention module in front of the input end of each detection head.

[0013] As an optional implementation of the first aspect of this application, the step of acquiring the citrus image to be identified specifically includes: using a drone device, setting a flight altitude of 1.5 meters to 3 meters and a flight speed of 2 meters per second, to take low-altitude photos over the citrus orchard; planning the flight path of the drone device to be perpendicular to the row direction of the citrus trees, setting a flight path spacing of 1.5 meters to 2 meters to ensure that the lateral overlap rate reaches 70%, and controlling the capture of one image every 1 to 2 seconds to achieve a flight overlap rate of not less than 80%; using a three-axis mechanical gimbal-stabilized camera, under different lighting conditions such as sunny and cloudy days, to collect citrus images including citrus sunburn, Huanglongbing, anthracnose, and canker; screening the collected citrus images, removing images with high repetition and blurry images, and constructing a citrus disease and pest image dataset.

[0014] As an optional implementation of the first aspect of this application, the method further includes a preprocessing step for the citrus pest and disease image dataset before processing it using the citrus pest and disease identification model. Specifically, this involves: labeling the pest and disease targets in the citrus pest and disease image dataset using annotation software to generate labeled image data; randomly dividing the labeled image data into a training set, a validation set, and a test set in a 7:1:2 ratio; and performing data augmentation processing on the training set, including random brightness changes, random angle flipping, mirroring, and mosaic enhancement, to expand the number of training set samples.

[0015] As an optional implementation of the first aspect of this application, the internal processing flow of the ADown downsampling module includes: receiving an input feature map; firstly, compressing the spatial information of the input feature map through an average pooling layer; splitting the feature map after average pooling compression into a first branch and a second branch; in the first branch, performing downsampling processing through a 3×3 conventional convolutional module with a stride of 2; in the second branch, first extracting salient features through a max pooling layer, and then performing channel number adjustment and information fusion through a 1×1 conventional convolutional module with a stride of 1; and concatenating the processing results of the first branch and the second branch in the channel dimension to obtain the output features of the ADown downsampling module.

[0016] As an optional implementation of the first aspect of this application, the internal processing flow of the GSC2FLighter module includes: receiving input features; dividing the input features into a main branch and a residual branch through a channel partitioning operation; the residual branch directly leads to the concatenation operation at the end; the features of the main branch enter the GSLighterBottleneck module for feature extraction and fusion; the GSLighterBottleneck module contains two parallel branches, one of which passes through a PConv module and a GSLighterConv module successively, and the other branch is a residual connection; then the outputs of the two parallel branches are summed; wherein, the PConv module only performs convolutional feature extraction on one-quarter of the input channels, and concatenates the remaining three-quarters of the channels with the convolutional channels through an identity mapping; the GSLighterConv module first passes the input features through a 1×1 regular convolution module to adjust the number of channels, then concatenates the adjusted features with the features processed by depthwise separable convolution, and finally outputs the fused information through a random permutation operation.

[0017] As an optional implementation of the first aspect of this application, the construction and data stream processing of the detection head prediction network are as follows: the neck feature fusion network generates an additional 160×160 feature map based on the feature map generated for the original three-scale detection head; the additional 160×160 feature map is processed by adding two GSC2FLighter modules, one GSConv module, two splicing operations, and one upsampling operation to adapt to the newly added 160×160 small target detection head; the 20×20, 40×40, 80×80, and 160×160 feature maps output by the neck feature fusion network are respectively sent to their respective EMA attention modules for feature focusing; the four feature maps processed by the EMA attention modules are respectively sent to the corresponding detection heads, and each detection head outputs the final pest / disease category, confidence level, and location coordinates through regression and classification branches.

[0018] As an optional implementation of the first aspect of this application, the internal processing flow of the EMA attention module includes: receiving input features, grouping them into channels, and then sending them in parallel to three branches: a horizontal average pooling branch, a vertical average pooling branch, and a 3×3 convolution branch; concatenating the outputs of the horizontal and vertical average pooling branches, and generating local feature weights through 1×1 convolution dimensionality reduction and a Sigmoid activation function; using the local feature weights to perform a first reweighting operation on the features after the initial grouping; and then combining the first reweighted features with the 3×3 convolution branch... The weights generated by average pooling and the Softmax function are multiplied by a matrix. Simultaneously, the weights generated by grouping normalization, average pooling, and the Softmax function after the first reweighting are multiplied by the output features of the 3×3 convolution branch. The results of the two matrix multiplications are weighted and summed to obtain the attention output. The attention output is then applied to the sigmoid activation function to generate new weight coefficients, and a second reweighting operation is performed. The output of the second reweighting operation is summed by residual connection with the original input features of the EMA attention module to obtain the final enhanced key target features.

[0019] As an optional implementation of the first aspect of this application, the method further includes the steps of model training and validation, specifically: inputting the data-enhanced training set into the citrus disease and pest identification model for iterative training, with the training rounds set to 200 rounds; during the training process, using the validation set to evaluate the performance of the model after each round of training, and adjusting hyperparameters including the learning rate, batch size, and weight decay coefficient according to the change in the loss function value; when the loss curve of the citrus disease and pest identification model on the validation set converges and tends to smooth, saving the current model weights as the optimal model weights for subsequent disease and pest identification.

[0020] In a second aspect, embodiments of this application provide an electronic device, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the steps of the method described in the first aspect.

[0021] Thirdly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0022] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0023] 1. The improved network structure proposed in this invention, by adding an EMA attention module before the detection head, enables the model to more effectively focus on the features of the target area of ​​pests and diseases, enhances the ability to distinguish between the target and the background, and thus improves the recognition accuracy.

[0024] 2. The ADown downsampling module, GSConv module, and GSC2FLighter module used in this invention are all lightweight designs, which effectively reduce the number of model parameters and computational complexity, making the model easier to deploy on edge computing devices such as drones. At the same time, the multi-branch and feature fusion design of these modules also enhances the model's adaptability to targets of different scales.

[0025] 3. By adding a 160×160 high-resolution small target detection head, this invention significantly improves the model's detection performance for small-scale targets such as tiny lesions, effectively alleviating the phenomenon of missed detection that is prone to occur in practical applications.

[0026] 4. This invention systematically improves the backbone network, neck network, and detection head network of the YOLOv8 model, constructing a lightweight, efficient, and robust recognition model. Test results on citrus pest and disease samples show that this model can accurately identify various citrus pests and diseases in complex orchard environments, significantly reducing model size and improving detection speed, thus providing strong technical support for intelligent pest and disease control in agriculture. Attached Figure Description

[0027] Figure 1 This is a flowchart of a method according to an embodiment of the present invention;

[0028] Figure 2 This is a schematic diagram of flight path planning for images acquired by a drone in an embodiment of the present invention;

[0029] Figure 3 These are sample images of citrus diseases and pests collected in this embodiment of the invention;

[0030] Figure 4 This is a schematic diagram of the structure of the citrus disease and pest identification network based on the improved YOLOv8 proposed in this invention;

[0031] Figure 5 This is a schematic diagram of the ADown downsampling module used in this invention;

[0032] Figure 6 This is a schematic diagram of the GSC2FLighter module structure used in this invention;

[0033] Figure 7 This is a schematic diagram of the GSConv module structure used in this invention;

[0034] Figure 8 This is a schematic diagram of the EMA attention module structure proposed in this invention;

[0035] Figure 9 The image shows the recognition effect of the improved YOLOv8 model of this invention. Detailed Implementation

[0036] 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.

[0037] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0038] Example 1

[0039] Please see Figure 1 This is a flowchart illustrating a method for identifying low-altitude citrus pests and diseases based on an improved YOLOv8, provided by an embodiment of the present invention. The method may include the following steps:

[0040] S1. Use drones to capture images and construct a dataset of citrus diseases and pests.

[0041] Use drones to capture images of citrus pests and diseases at medium to long distances. During low-altitude flights, maintain a flight altitude of 1.5–3 meters and a speed of approximately 2 m / s to minimize blur and vibration. Plan flight paths perpendicular to the rows of citrus trees. Figure 2 As shown, this image is only for demonstrating the drone's flight path. The actual number of citrus trees planted in the orchard is much greater than the number shown in the image. The flight path spacing is 1.5-2 meters to ensure a lateral overlap rate of 70%, and a flight overlap rate of ≥80% is achieved by taking one image every 1-2 seconds. A three-axis mechanical gimbal is used for stable shooting, and a high-resolution RGB camera is selected to ensure low-altitude flight safety and clear image details. Images were taken on sunny and cloudy days at different distances and under different lighting conditions, collecting diverse citrus disease and pest samples of different colors, textures, and shapes, totaling 6000 images. These samples were then screened, removing duplicate and overly blurry images, resulting in 5200 images, including 3000 images of Huanglongbing (HLB), 800 images of anthracnose, 600 images of canker, and 800 images of sunscald. The image samples are as follows: Figure 3 As shown.

[0042] S2. Perform data annotation, proportional division, and enhancement for each citrus target in the citrus pest and disease dataset.

[0043] Labelimg software was used for target annotation. The entire citrus target was outlined during annotation, and occluded parts were predicted and annotated based on actual conditions and experience, resulting in labeled image data. The labeled images were then divided into training, validation, and test sets in a 7:1:2 ratio, resulting in 3640 training images, 520 validation images, and 1040 test images. The entire partitioning process was random. To further enhance the diversity of the dataset and the model's generalization ability, a series of data augmentations were applied to the 3640 training images, such as random brightness variations, random angle flips, mirroring, and mosaic enhancement. The mosaic enhancement parameters were the default parameters of the Ultralytics YOLO framework, ultimately increasing the number of training images to 7280.

[0044] S3. Construct a citrus disease and pest identification network based on the improved YOLOv8 model.

[0045] like Figure 4 As shown, the network comprises a backbone feature extraction network, a neck feature fusion network, and a detection head prediction network. The backbone feature extraction network includes two conventional convolutional modules (CBS), four feature extraction modules (C2F), three novel downsampling modules (ADown), and one spatial pyramid pooling module (SPPF). The neck feature fusion network includes six GSC2FLighter modules, three GSConv modules, and several Concat and upsampling operations. The detection head prediction network includes four detection heads of different scales and four EMA attention modules.

[0046] The specific implementation process is as follows: The C2F module is a module with rich gradient flow, which plays a major role in feature extraction in the backbone feature extraction network; the lightweight downsampling module ADown is used to replace the last three downsampling modules in the backbone feature extraction network; the neck feature fusion network replaces the original C2F module with the GSC2FLighter module and replaces the conventional convolution module with the GSConv module; a small target detection head is added to the detection head network, and two GSC2FLighter modules, one GSConv module, two Concat operations and one Upsample operation are added to the neck feature fusion network for input feature processing of the new detection head (P2). Before the features are input to the detection head, they are further focused by the EMA attention mechanism, and finally a lightweight citrus target detection and yield prediction model is obtained.

[0047] The specific network data flow of the improved YOLOv8 model is as follows: The input feature vector (640, 640, 3) first undergoes preliminary downsampling through two 3×3 regular convolutional modules with a stride of 2, resulting in a feature vector (160, 160, 128) after preliminary feature extraction; then this vector enters the first C2F module, where features are extracted to obtain the output feature vector B1 (160, 160, 128); B1 is then input into the ADown module for multi-scale feature fusion, downsampling, and channel number adjustment, resulting in the output feature vector (80, 80, 256); The downsampled feature vector then enters the second C2F module for the same feature extraction, resulting in the output feature vector B2(80,80,256). B2 then passes through the second ADown module to convert spatial information to channel information, resulting in the output feature vector (40,40,512). This feature vector then enters the third C2F module for further feature extraction, resulting in the output feature vector B3(40,40,512). B3 then enters the third ADown module for the final downsampling of the backbone network, resulting in the output feature vector (20,20,1024). The feature vector then enters the fourth C2F module for the final feature extraction of the backbone network, resulting in the output vector B4(20,20,1024). B4 then enters the neck feature fusion network, first undergoing SPPF spatial pyramid pooling to extract multi-scale features, outputting feature vector N1(20,20,1024). N1 is upsampled to obtain feature vector U1(40,40,1024). U1 is then concatenated with B3 along the channel dimension, resulting in the concatenated feature vector (40,40,1536). This feature vector enters the first GSC2FLighter module of the neck feature fusion network, where partial convolution and the GSConv module reduce the number of parameters. The multi-branch structure helps improve the efficiency of multi-scale feature fusion and enhances the model's adaptability to complex scenes, outputting feature vector V1(40,40,1024). V1 is then upsampled to obtain feature vector U2(80,80,512); U2 is concatenated with B2, resulting in a feature vector of (80,80,768); this feature vector then enters the second GSC2FLighter module, which performs feature fusion and outputs feature vector V2(80,80,256); V2 is then upsampled to obtain feature vector U3(160,160,256); U3 is concatenated with B1, resulting in a feature vector of (160,160,384); this feature vector enters the third GSC2FLighter module, which outputs feature vector V3(160,160,128); V3 will go to two different branches, one of which serves as the input to the EMA attention module before the 160×160 detector head;Another feature vector is used as input to the first GSConv module. The GSConv module combines the characteristics of regular convolution with depthwise separable convolution to reduce computational complexity while maintaining detection accuracy. After V3 is downsampled by the GSConv module, it outputs feature vector G1 (80, 80, 128). G1 is concatenated with V2, resulting in a concatenated feature vector of (80, 80, 384). This vector then passes through the fourth GSC2FLighter module, outputting feature vector V4 (80, 80, 256). V4 branches into two different paths: one serves as input to the EMA attention module before the 80×80 detector; the other serves as input to the second GSConv module, which downsamples it to obtain feature vector G2 (40, 40, 256). G2 is then concatenated with V1, resulting in a concatenated feature vector of (80, 80, 384). The feature vector (40, 40, 768) is passed through the fifth GSC2FLighter module, outputting feature vector V5 (40, 40, 512). V5 branches into two different branches: one serves as input to the EMA attention module before the 40×40 detector head; the other serves as input to the third GSConv module, which downsamples the result to obtain feature vector G3 (20, 20, 512). G3 is concatenated with N1, resulting in a concatenated feature vector of (20, 20, 1536). This feature vector then passes through the sixth GSC2FLighter module, outputting feature vector V6 (20, 20, 1024). V6 serves only as input to the EMA attention module before the 20×20 detector head. The outputs of each EMA attention module are fed into their respective detector heads, and the final recognition result is output through regression and classification branches.

[0048] The following sections will introduce the ADown downsampling module, GSC2FLighter module, GSConv module, and EMA attention module in the improved YOLOv8 model:

[0049] (1) ADown downsampling module, such as Figure 5As shown, the network consists of an average pooling layer (AvgPool), a max pooling layer (MaxPool), and two regular convolutional modules (CBS). First, the network input passes through an average pooling layer to compress the spatial information of the input feature map, reducing computation while preserving some global information. The compressed feature map is then split into two branches. The left branch undergoes further downsampling through a 3×3 regular convolutional module with a stride of 2 to capture image details. The right branch first passes through a max pooling layer to highlight local salient features, and then through a 1×1 regular convolutional module with a stride of 1 to adjust the number of channels and fuse information between channels. Finally, the outputs of the left and right branches are concatenated along the channel dimension to obtain the output of the ADown module, which contains both local detailed features and global information.

[0050] (2) GSC2FLighter module, such as Figure 6 As shown, it includes two regular convolutional modules, two GSLighterBottleneck modules, and three residual connections that connect to the last regular convolutional module after the channel splitting operation and the GSLighterBottleneck operation, respectively. After the input features are split, they enter two branches. One branch quickly leads to the Concat operation via the residual connection, while the other branch directly enters the GSLighterBottleneck module for feature extraction and fusion. The GSLighterBottleneck module has two branches. One branch passes through the 3×3 PConv module and the 3×3 GSConv module, while the other branch leads to the residual connection. The outputs of the two branches are then summed to obtain the extracted target features. The PConv module differs from the regular convolutional module in that it only uses a portion (usually 1 / 4) of the channels for feature extraction, while the remaining channels are directly concatenated with the convolutional channels by an identity mapping.

[0051] (3) GSConv module, such as Figure 7 As shown, it includes a regular convolutional module, a deep convolutional block (DWConv), and concatenation and random permutation operations. The input features are first adjusted in terms of the number of channels by a 1×1 regular convolutional module. Then, the adjusted output features and the features processed by the deep convolutional block (DWConv) are concatted in terms of channel dimension. The concatenated output is then shuffled to exchange local feature information on different channels, permeating the information generated by the regular convolutional module into each part of the information generated by the deep convolution, and finally obtaining the output of the GSConv module.

[0052] (4) EMA attention module, such as Figure 8As shown, this module is an efficient multi-scale attention module implemented through cross-dimensional interaction. After the input features enter the module, they are first grouped by channel and then processed in parallel to reduce the number of parameters and computational cost. The grouped features are then subjected to average pooling (Avg pooling) in the horizontal and vertical directions, and then to a 3×3 parallel convolution branch. The compressed features after average pooling are concatenated and dimensionality reduced using Concat and 1×1 convolutions, and then local features are captured using the Sigmoid activation function. Subsequently, a re-weighting operation is performed to readjust the input features using the obtained weight coefficients, emphasizing key features while suppressing unimportant ones. Then, a matrix multiplication operation is performed, where the features after re-weighting are multiplied by the weights output from the 3×3 convolution branch after average pooling and Softmax operations, and the re-weighted features are then normalized after grouping. (GropNorm) stabilizes the data distribution, extracts more representative features using average pooling and reduces feature dimensionality, and multiplies the weights obtained after applying the Softmax function with the output features of the 3×3 convolution branch. The outputs of the above two parts are then weighted and summed to obtain the output of the attention mechanism. The sigmoid activation function is applied to the above output features again to obtain new weight coefficients. Then, through the re-weight operation, the weight coefficients are recalibrated to further optimize the feature representation. Its output is then summed with the original input through residual connection to fuse multi-scale features, and finally, the key target features extracted by the module enhanced by the attention mechanism are obtained.

[0053] S4. Apply the citrus dataset obtained in S2 to the lightweight detection network based on the improved YOLOv8 model established in S3 for training and validation. That is, input the labeled citrus image data into the model, take the predicted label as the output, train the detection model, set the training rounds to 200 rounds, do not use pre-trained weights during training, and continuously adjust the training parameters, such as learning rate, batch size, weight decay coefficient, etc., according to the model's performance on the validation set through repeated iterative training. When the loss curve tends to be smooth, that is, convergence, the best trained model weights are obtained.

[0054] S5. Use the optimal model weights obtained in S4 for test samples to evaluate model performance.

[0055] This invention comprehensively evaluates the performance and lightweight nature of the model using four metrics: precision, recall, mean average precision, and number of parameters.

[0056] The calculation formulas for each indicator are as follows:

[0057]

[0058]

[0059]

[0060]

[0061]

[0062] Where TP represents the number of correctly detected citrus pests or healthy citrus fruits in the test image, FP represents the number of incorrectly detected citrus pests or healthy citrus fruits, and FN represents the number of missed citrus pests or healthy citrus fruits. Mean Average Precision is calculated from the area under the curve of precision versus recall. H×W represents the width and height of the output feature map, and K represents the size of the convolution kernel. Indicates the number of input channels. Indicates the number of output channels.

[0063] Table 1 shows the comparison results of the model constructed in this invention with other lightweight models.

[0064]

[0065] The experimental results of the lightweight citrus pest and disease detection model based on the improved YOLOv8 model proposed in this invention are shown in Table 1. It can be seen that the model proposed in this invention achieved an accuracy of 92.5%, a recall of 84.4%, and a mean precision of 93.5%, while reducing the number of parameters to 2.23M, where M represents the counting unit (Million). The detection effect is shown in the figure below. Figure 9 As shown. It is worth mentioning that the model proposed in this invention was tested on numerous difficult samples, and the average accuracy of 93.5% indicates that the model has excellent detection performance, high adaptability and robustness in complex environments, and provides a rich theoretical foundation for lightweight modeling in the field of target detection.

[0066] Optionally, this application embodiment also provides an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the various processes of the above-described embodiment of a low-altitude citrus pest and disease identification method based on improved YOLOv8, and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0067] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described embodiment of a low-altitude citrus pest and disease identification method based on improved YOLOv8, and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0068] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0069] It should be noted that, in this document, 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 that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0070] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0071] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. An improved YOLOv8-based low-altitude citrus pest and disease identification method, characterized by, The method comprises the following steps: obtaining a citrus image to be identified; processing the citrus image using a citrus disease and pest identification model to obtain a disease and pest identification result; The citrus disease and pest identification model comprises a backbone feature extraction network, a neck feature fusion network and a detection head prediction network connected in sequence; The backbone feature extraction network is used for feature extraction of the input citrus image, and comprises at least one down-sampling module, and the last three down-sampling modules in the original YOLOv8 model backbone network are replaced by ADown down-sampling modules; The neck feature fusion network is used for fusing multi-scale features output by the backbone feature extraction network, and replaces the C2F module in the original YOLOv8 model neck network with a GSC2FLighter module, and replaces the regular convolution module with a GSConv module; the internal processing flow of the GSC2FLighter module comprises: receiving input features, dividing the input features into a main branch and a residual branch through a channel division operation, and the residual branch directly leads to a splicing operation at the end; the features of the main branch enter a GSLighterBottleneck module for feature extraction and fusion, the GSLighterBottleneck module internally includes two parallel branches, one branch passes through a PConv module and a GSConv module in sequence, and the other branch is a residual connection, and then the outputs of the two parallel branches are summed; wherein the PConv module only performs convolution feature extraction on one fourth of the input channels, and the remaining three fourths of the channels are spliced with the convolution channels through an identity mapping; the GSConv module first adjusts the channel number of the input features through a 1×1 regular convolution module, then splices the adjusted features with the features processed by a depth separable convolution, and finally outputs the fused information through a random permutation operation; The detection head prediction network is used for generating an identification result according to the features output by the neck feature fusion network, and an EMA attention module is added in front of the input end of each detection head based on the three-scale detection head of the original YOLOv8 model, forming a four-scale detection head; four feature maps processed by the EMA attention module are sent into the corresponding detection head respectively, and each detection head outputs the final disease and pest category, confidence and position coordinates through the regression branch and the classification branch.

2. The method of claim 1, wherein, The step of obtaining the citrus image to be identified specifically comprises: using a drone device to set a flight height of 1.5 meters to 3 meters and a flight speed of 2 meters / second, and performing low-altitude shooting above a citrus orchard; planning the flight route of the drone device to be perpendicular to the row direction of the citrus plants, setting a flight route spacing of 1.5 meters to 2 meters to ensure that the lateral overlap rate reaches 70%, and controlling the device to take a picture every 1 second to 2 seconds to realize that the heading overlap rate is not less than 80%; Adopting a three-axis mechanical gimbal to stabilize the camera, images of citrus containing citrus sunburn, Huanglongbing, anthracnose and canker were collected under different light conditions of sunny and cloudy days; The collected citrus images were screened to remove images with high repetition and blurring, and a citrus disease and pest image dataset was constructed.

3. The method of claim 2, wherein, The method further comprises a step of preprocessing the citrus disease and pest image dataset before processing using a citrus disease and pest recognition model, specifically: Using a labeling software to label the disease and pest targets in the citrus disease and pest image dataset to generate labeled image data; The labeled image data is randomly divided into a training set, a validation set and a test set according to a ratio of 7:1:2; The training set is subjected to data enhancement processing, which includes random brightness variation, random angle flipping, mirroring and mosaic enhancement to expand the number of training set samples.

4. The method of claim 1, wherein, The internal processing flow of the ADown downsampling module includes: Receiving an input feature map, first compressing the spatial information of the input feature map through an average pooling layer; Splitting the feature map compressed by the average pooling into a first branch and a second branch; In the first branch, a 3x3 regular convolution module with a step of 2 is used for downsampling processing; In the second branch, first extract significant features through a max pooling layer, and then adjust the channel number and fuse information through a 1x1 regular convolution module with a step of 1; The processing results of the first branch and the second branch are spliced in the channel dimension to obtain the output feature of the ADown downsampling module.

5. The method of claim 1, wherein, The construction and data flow processing process of the detection head prediction network are specifically: The neck feature fusion network additionally generates a 160x160 feature map based on the feature map generated for the original three-scale detection head; The additional 160x160 feature map is processed through two GSC2FLighter modules, one GSConv module, two splicing operations and one upsampling operation to adapt to the newly added 160x160 small target detection head; The 20x20, 40x40, 80x80 and 160x160 feature maps output by the neck feature fusion network are respectively sent to the corresponding EMA attention module for feature focusing.

6. The method of claim 5, wherein, The internal processing flow of the EMA attention module includes: Receiving an input feature, grouping the channels and sending them to three branches in parallel, which are horizontal direction average pooling branch, vertical direction average pooling branch and a 3x3 convolution branch; The outputs of the horizontal direction average pooling branch and the vertical direction average pooling branch are spliced, and the local feature weight is generated through 1x1 convolution dimension reduction and Sigmoid activation function; The local feature weight is used to perform a first reweighting operation on the features after the initial grouping; The first re-weighted feature is multiplied by the weight generated by the average pooling and the Softmax function of the 3*3 convolution branch; at the same time, the weight generated by the group normalization, the average pooling and the Softmax function of the first re-weighted feature is multiplied by the output feature of the 3*3 convolution branch; the results of the two matrix multiplications are weighted and summed to obtain the attention output; The Sigmoid activation function is applied to the attention output again to generate new weight coefficients, and a second re-weighting operation is performed; the output of the second re-weighting operation is summed with the original input feature of the EMA attention module through residual connection to obtain the final enhanced key target feature.

7. The method of claim 3, wherein, The method further comprises the steps of model training and verification, specifically: The data enhanced training set is input into the citrus disease and pest identification model for iterative training, and the training rounds are set to 200 rounds; During the training process, the performance of the model after each round of training is evaluated using the validation set, and the learning rate, batch size and weight decay coefficient are adjusted according to the change of the loss function value. When the loss curve of the citrus disease and pest identification model on the validation set converges and tends to be smooth, the weight of the current model is saved as the optimal model weight for subsequent disease and pest identification.

8. An electronic device, comprising: The processor, the memory and the program or instructions stored on the memory and executable on the processor are included, and the processor executes the program or instructions to realize the steps of the low-altitude citrus disease and pest identification method based on the improved YOLOv8 according to any one of claims 1-7.

9. A readable storage medium, characterized by, The program or instructions are stored on the readable storage medium, and the processor executes the program or instructions to realize the steps of the low-altitude citrus disease and pest identification method based on the improved YOLOv8 according to any one of claims 1-7.

Citation Information

Patent Citations

  • Lightweight vehicle detection method based on improved YOLOv8n model

    CN117593623A

  • Small target detection method based on CAFM-ADown-EMA fusion

    CN120070848A