Citrus disease identification method based on improved YOLOv8

By improving the YOLOv8 network model, introducing the PSA attention mechanism, CCFF module and DyHead detection head, and combining data enhancement methods, the problems of poor small target detection and weak robustness to environmental changes in citrus disease identification were solved, and fast and accurate disease identification and large-scale application were achieved.

CN120808100APending Publication Date: 2025-10-17YUNNAN AGRICULTURAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510769314.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Traditional citrus disease identification relies on manual experience, which is time-consuming and labor-intensive. In addition, the existing YOLO algorithm is not effective in detecting small and dense targets, and has weak robustness to environmental changes, making it difficult to achieve efficient and accurate identification.

Method used

An improved YOLOv8 network model is adopted, with the introduction of the PSA attention mechanism, CCFF module and DyHead detection head. Combined with multiple data enhancement methods, feature extraction and loss function are optimized to improve detection accuracy and real-time performance.

Benefits of technology

It achieves rapid and accurate identification of citrus diseases, adapts to different lighting and complex environments, improves the detection accuracy of small targets and dense targets, and is suitable for large-scale applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120808100A_ABST
    Figure CN120808100A_ABST
Patent Text Reader

Abstract

The invention discloses a citrus disease identification method based on improved YOLOv8, and belongs to the field of disease and pest identification and image identification. The method comprises the following steps: acquiring citrus disease images and executing preprocessing operation, and constructing a multi-source citrus disease data set through the preprocessed images; an improved YOLOv8 network model is constructed; the improved mode comprises the following steps: embedding a PSA attention mechanism behind an SPPF layer in a backbone network; a CCFF module is introduced into the neck network; the method comprises the following steps of: replacing an original Decouled Head detection head with DyHead; the method comprises the following steps: designing a novel loss function fusing Inner-IoU and Focal-EIoU; and inputting the multi-source citrus disease data set into the improved YOLOv8 network model for training to obtain a detection result. According to the method, the expressive force of the model is improved, so that the model can achieve higher precision and real-time performance when identifying citrus diseases in various complex environments. According to the method, multiple data enhancement methods are adopted in image preprocessing, and the method is suitable for images with different illumination, colors and angles, so that the generalization ability of the model is higher, and the application range is wide.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of pest and disease identification and image recognition, and particularly relates to a citrus disease identification method based on improved YOLOv8. BACKGROUND With the rapid development of agricultural technology, as a crucial fruit crop, the rapid and accurate identification and treatment of various diseases of citrus are of great significance to improving yield and quality. Traditional citrus disease identification mainly relies on observation and judgment by professional plant protection personnel. In recent years, computer vision and deep learning technologies have achieved remarkable results in the field of image recognition. Among them, the YOLO (You Only Look Once) series algorithm based on deep convolutional neural network (DCNN) has been widely used in target recognition tasks due to its real-time and robustness. YOLO converts the target recognition task into a regression task, which can predict the classification and positioning of objects in an image at one time, and has the advantages of fast speed and high accuracy.

[0002] However, traditional observation and judgment by professional plant protection personnel not only consumes a lot of time and manpower, but also the accuracy of identification is largely limited by the experience and skills of personnel, which is difficult to meet the needs of large-scale, efficient and accurate disease identification. In the face of crop disease identification tasks in various complex environments, the traditional YOLO algorithm has certain deficiencies, such as poor detection effect on small targets and dense targets, insufficient suppression ability on background noise, and weak robustness in dealing with environmental changes such as color and light, which may reduce the detection accuracy. Therefore, there is an urgent need for an algorithm for detecting small targets and dense targets. SUMMARY

[0003] In order to solve the above technical problems, the application provides a citrus disease identification method based on improved YOLOv8.

[0004] In order to realize the application, the steps are as follows: S1, collect citrus disease images, and perform a pretreatment operation on the collected images, and construct a multi-source citrus disease dataset through the pretreated images; The collection method is to obtain citrus disease images through actual shooting and public datasets; The multi-source citrus disease dataset includes the following citrus images: Huanglongbing leaf sample pictures, black spot fruit sample pictures, bacterial wilt leaf and fruit sample pictures, and anthracnose leaf and healthy leaf sample pictures. The preprocessing operation includes: normalization processing, data enhancement processing and labeling processing; that is, using OpenCV to perform batch processing on the image size collected, adjusting the image to a preset size; performing image enhancement processing on the image after adjusting the size, and manually labeling the disease area using the labelimg tool to obtain a multi-source citrus disease dataset; In the preprocessing operation, the image enhancement processing mode is: using random rotation, mirroring, saturation adjustment, color transformation, noise addition, color jitter, image sharpening and Gaussian blur on the image after adjusting the size to enhance the data; In the preprocessing operation, the labelimg tool is used to label the disease area in the preprocessed citrus disease image, and different labels are set for different disease types, such as Huanglongbing leaf, black spot fruit, leaf and fruit of bacterial wilt, leaf and fruit of anthracnose, and healthy leaf. After labeling, the labeled data is sorted and saved, for example: the labeled citrus disease image and its label information are saved in a specified folder or database according to a preset format, and the label information is usually saved in a TXT file format.

[0005] S2, construct an improved YOLOv8 network model; The construction steps include: S2.1, image input backbone network, embedding PSA attention mechanism after YOLOv8 network model SPPF layer, used for performing channel separation operation and channel feature extraction operation on the image output by the backbone network, to obtain shallow feature map and deep feature map; The YOLOv8 network model backbone network includes 5 convolution layers and an SPPF layer. The picture goes through the first convolution layer, the second convolution layer, the third convolution layer, the fourth convolution layer, the fifth convolution layer and the SPPF layer in turn. Among them, the second layer and the third layer, the third layer and the fourth layer, the fourth layer and the fifth layer, and the fifth layer and the SPPF layer are connected through the cross-stage feature fusion (c2f) module, and the SPPF layer output is a deep feature map. The part of the third layer and the fourth layer, the fourth layer and the fifth layer of the YOLOv8 network model connected through the cross-stage feature fusion (c2f) module input into the neck network is a shallow feature map; The working mode of the PSA attention mechanism is: dividing the input deep feature map into a preset number of subgraph groups in the channel dimension, which is used to separate different semantic features and realize channel separation; for each channel subgraph, dividing it into large-scale and small-scale regions in the spatial dimension (i.e. the width x height of the image) through the spatial pyramid attention mechanism, which is used to perform channel feature extraction operation; the regions after division calculate attention weights independently through convolution operation and activation function, which is used to highlight key features and suppress background noise; In the working mode of the above PSA attention mechanism, the preset number is set to 3, respectively corresponding to the color channel, texture channel and shape channel in the input feature map channel; the small-scale region focuses on the fine texture and color change details of the lesion spot, and the large-scale region captures the spatial distribution characteristics of the lesion spot on the citrus tissue; the small region is defined as a 2x2 pixel point matrix, and the large scale is defined as a 4x4 pixel point matrix; The divided region independently calculates the expression of the attention weight through convolution operation and activation function as follows: In the formula, σ represents an activation function; represents a convolution operation; represents the region division result in the spatial dimension, including the large-scale region and the small-scale region; S2.2, introducing a CCFF module in the neck network, the CCFF module receiving shallow feature maps and deep feature maps output by the backbone network, and performing optimization operation on the shallow feature maps and the deep feature maps; The way of performing optimization operation on the shallow feature maps and the deep feature maps is: adjusting the channel dimension through two 1x1 convolutions, aligning the channel number of the shallow feature maps (high resolution, retaining lesion details such as edges and textures) and the deep feature maps (low resolution, containing disease semantic information such as class and distribution), eliminating the scale difference, realizing the complementary fusion of detail features (such as black spot fruit and bacterial wilt fruit) and semantic features (such as bacterial wilt leaf and bacterial wilt leaf), and improving the multi-scale detection capability; input the aligned feature maps into a RepVggBlock sequence (composed of 4 RepVggBlock), each RepVggBlock containing a 3x3 convolution layer and a 1x1 convolution layer during training, and merging into a single 3x3 convolution layer during deployment, which reduces the model calculation complexity while improving the inference efficiency, wherein the deployment operation expression is as follows: In the formula, represents RepVggBlock during training, containing a 3x3 convolution layer and a 1x1 convolution layer; The CCFF module significantly improves the detection accuracy of citrus diseases (especially small targets such as lesion spots and complex backgrounds such as leaves) while maintaining the real-time performance of YOLOv8 through the lightweight cross-level optimization design.

[0006] S2.3, DyHead detection head is used to replace the original Decoupled Head detection head, and the optimized feature maps output by the CCFF module are input into the DyHead detection head, and the DyHead detection head obtains the detection results by fusing the loss functions of Inner-IoU and Focal-EIoU, including the following steps: S2.3.1. After the feature map optimized by CCFF module is input into DyHead detection head, the fused feature map is obtained through dynamic feature fusion mechanism; The DyHead detection head uses a dynamic feature fusion mechanism on the optimized feature map output by the CCFF module. Based on the spatial and semantic characteristics of the input feature map, it adaptively adjusts the fusion weights of features at different scales, achieving an organic integration of shallow detail features and deep semantic features, effectively meeting the needs of detecting lesions of varying sizes on citrus leaves. S2.3.2, the DyHead detection head performs classification branch operations and regression branch operations on the fused feature map in sequence; The classification branch uses the Softmax function to calculate the probability of disease categories; The regression branch uses a bounding box regression algorithm to optimize the coordinates and size of the detection bounding box. To address the unstable bounding box regression caused by occlusion of diseased targets in real scenes, a loss function that combines Inner-IoU and Focal-EIoU is introduced to improve the convergence stability of the training process. The expression of the loss function that integrates Inner-IoU and Focal-EIoU is as follows: Where, represents the adaptive weighting function; Indicates the training phase; Among them, to address the defect of traditional IoU in measuring inaccuracy when the target boundary is blurred, Inner-IoU is improved by scaling factor β , and the ground truth box ( Bgt ) calculates the inner real box (Binner) and uses the predicted box ( Bpred ) with the indented ground truth box as a metric to achieve accurate evaluation of bounding box overlap; The expression for calculating the indented real box is as follows: Where, Indicates the calculation operation inside the shrinking real box; Take the prediction box ( Bpred The intersection-over-union (IoU) of the bounding box and the indented ground truth box is used as the metric to accurately evaluate the overlap of the bounding boxes: Where, Represents the intersection-over-union loss function calculation operation; Focal-EIoU introduces the Focal factor based on EIoU. To address the imbalance of disease categories in citrus disease detection, it dynamically adjusts the weight parameter η to achieve differentiated training for difficult and easy samples. The expression is as follows: Where, Indicates the calculation operation of introducing the Focal factor; The expression for dynamically adjusting the weight parameter η is as follows: Where, express The weight term, weight term and Inversely proportional relationship, that is The smaller it is, the larger the weight term is and the greater the loss contribution is; In the early stages of training, more emphasis is placed on Inner-IoU to quickly optimize target positioning. Inner-IoU has a larger weight; in the later stages of training, as the model's ability to identify various diseases improves, the role of Focal-EIoU will be strengthened to further address the problem of class imbalance. Through auxiliary bounding boxes and dynamic focusing mechanisms, this loss function significantly improves bounding box regression accuracy and model training efficiency, providing optimized guarantees for accurate citrus disease detection. S2.3.3. Finally, the overlapping detection frames are eliminated through the non-maximum suppression algorithm, and the detection results including disease category, location coordinates and confidence level are output.

[0007] S3. Input the multi-source citrus disease dataset into the improved YOLOv8 network model for training, and finally obtain the citrus disease detection results. The steps are as follows: S3.1. Choose PyTorch as the deep learning framework. PyTorch is an open source deep learning platform based on Python. S3.2. Divide the multi-source citrus disease dataset into a training set and a validation set according to a preset ratio; S3.3. Set the training parameters according to the preset values, including the initial learning rate, batch size, and subprocess add-ons. At the same time, turn off data augmentation. S3.4. Use the training set as input to the improved YOLOv8 network model. The model relies on algorithms such as backpropagation and gradient descent for training. Forward propagation generates predictions that are compared with the actual results to obtain the error. Backpropagation updates the parameters based on the error. S3.5. Output the detection results after reaching the maximum number of iterations (epoch).

[0008] Beneficial effects of the present invention: The original YOLOV8 network model is optimized in multiple aspects, such as introducing a CCFF module, replacing a detection head, embedding a PSA attention module, and designing a new loss function, so that the expressiveness of the model is improved, and the model can achieve higher precision and real-time performance when identifying citrus diseases in various complex environments.

[0009] The image processing is adaptable: in the application, the image preprocessing adopts multiple data enhancement methods, which can adapt to images of different illumination, color and angle, so that the generalization ability of the model is stronger and the application range is wider.

[0010] The application is convenient for large-scale application: compared with the traditional identification method relying on artificial experience, the application can realize fast and accurate disease identification, and is convenient for large-scale application. BRIEF DESCRIPTION OF DRAWINGS

[0011] Figure 1 The step flowchart of the application is shown in the figure; Figure 2 The deployment flowchart of the application is shown in the figure. DETAILED DESCRIPTION

[0012] The application will be further described in detail below in combination with specific embodiments.

[0013] A citrus disease identification method based on an improved YOLOv8 includes the following steps: S1, collect citrus disease images, and perform preprocessing operations on the collected images, and construct a multi-source citrus disease dataset through the preprocessed images; The collection method is: through actual shooting and public dataset, the citrus disease images are obtained; The multi-source citrus disease dataset includes the following: Huanglongbing leaf sample pictures, black spot fruit sample pictures, bacterial wilt leaf and fruit sample pictures, and anthracnose leaf and healthy leaf sample pictures. The preprocessing operation includes: uniform processing, data enhancement processing and labeling processing; that is, using OpenCV to batch process the size of the collected images, adjusting the image size to 640*640; performing image enhancement processing on the image with adjusted size, and manually labeling the pixel-level semantics of the disease area using the labelimg tool, to obtain the multi-source citrus disease dataset; In the preprocessing operation, the image enhancement processing method is: using random rotation, mirror, saturation adjustment, color transformation, noise addition, color jitter, image sharpening and Gaussian blur to enhance the data, in this embodiment, the collected citrus disease images are 2509, and the image enhancement processing expands to 8287. During the preprocessing operation, the labelimg tool is used to label the diseased areas in the preprocessed citrus disease images, and different labels are set for different disease types, such as Huanglongbing leaves, black spot fruit, canker leaves and fruit, anthracnose leaves, and healthy leaves; after labeling, the labeled data is sorted and saved, for example: the labeled citrus disease images and their label information are saved in a designated folder or database according to the preset format, and the label information is often saved in TXT file format.

[0014] S2. Build an improved YOLOv8 network model; The steps of the build include: S2.1. The image is input into the backbone network. The PSA attention mechanism is embedded after the SPPF layer of the YOLOv8 network model to perform channel separation and channel feature extraction on the image output by the backbone network to obtain shallow feature maps and deep feature maps. The backbone network of the YOLOv8 network model includes 5 convolutional layers and one SPPF layer. The image is sequentially passed from the first convolutional layer to the fifth convolutional layer, and finally through the SPPF layer. Among them, the second and third layers, the third and fourth layers, the fourth and fifth layers, and the fifth layer and the SPPF layer are connected through the cross-stage feature fusion (c2f) module. The output of the SPPF layer is a deep feature map. The third and fourth layers, and the fourth and fifth layers in the YOLOv8 network model are connected through the cross-stage feature fusion (c2f) module. The part input to the neck network is a shallow feature map. The PSA attention mechanism works as follows: The input deep feature map is divided into a preset number of sub-map groups in the channel dimension to separate different semantic features and achieve channel separation. Each channel sub-map is divided into large-scale and small-scale regions in the spatial dimension (i.e., image width × height) using a spatial pyramid attention mechanism to perform channel feature extraction. The divided regions are independently weighted using convolution operations and activation functions to highlight key disease features and suppress background noise. In the working mode of the PSA attention mechanism described above, the preset number is set to 3, corresponding to the color channel, texture channel, and shape channel in the input feature map channel respectively; the small-scale area focuses on the detailed features such as the subtle texture and color changes of the lesions, while the large-scale area captures the spatial distribution characteristics of the lesions on the citrus tissue; the small area is defined as a 2×2 pixel matrix, and the large-scale is defined as a 4×4 pixel matrix; The expression of attention weight is calculated independently by convolution operation and activation function in the divided area as follows: Where, σ represents the activation function; denotes a convolution operation; denotes a region division result in the spatial dimension, including a large-scale region and a small-scale region; S2.2, introducing a CCFF module into the neck network, the CCFF module receiving shallow feature maps and deep feature maps output by the backbone network and performing optimization operations on the shallow feature maps and the deep feature maps; The manner of performing optimization operations on the shallow feature maps and the deep feature maps is: adjusting the channel dimension through two 1x1 convolutions, aligning the channel numbers of the shallow feature maps (high resolution, retaining lesion details such as edges and textures) and the deep feature maps (low resolution, containing lesion semantic information such as categories and distribution), eliminating the scale difference, realizing complementary fusion of detail features (such as black spot fruit and canker fruit) and semantic features (such as canker leaf and canker leaf), and improving multi-scale detection capability; inputting the aligned feature maps into a RepVggBlock sequence (composed of 4 RepVggBlocks), each RepVggBlock containing a 3x3 convolution layer and a 1x1 convolution layer during training, and being merged into a single 3x3 convolution layer during deployment, which reduces the computational complexity of the model while improving the inference efficiency, wherein the deployment operation expression is as follows: In the formula, denotes a RepVggBlock during training, containing a 3x3 convolution layer and a 1x1 convolution layer; The CCFF module, through the lightweight cross-level optimization design, significantly improves the detection accuracy of citrus diseases (especially small targets such as lesion spots and complex backgrounds such as leaves) while maintaining the real-time performance of YOLOv8.

[0015] S2.3, replacing the original Decoupled Head detection head with a DyHead detection head, inputting the optimized feature maps output by the CCFF module into the DyHead detection head, and obtaining the detection results through the fusion of the Inner-IoU and Focal-EIoU loss functions, including the following steps: S2.3.1, after the CCFF module optimized feature maps are input into the DyHead detection head, the fusion feature maps are obtained through a dynamic feature fusion mechanism; The DyHead detection head, through the dynamic feature fusion mechanism, adjusts the fusion weights of different scale features according to the spatial and semantic characteristics of the input feature maps, realizes the organic integration of shallow detail features and deep semantic features, and effectively meets the detection needs of lesions of different sizes on citrus leaves; S2.3.2, the DyHead detection head performs classification branch operation and regression branch operation on the fusion feature maps in turn; The classification branch uses the Softmax function to calculate the probability of disease categories; The regression branch uses a bounding box regression algorithm to optimize the coordinates and size of the detection bounding box. To address the unstable bounding box regression caused by occlusion of diseased targets in real scenes, a loss function that combines Inner-IoU and Focal-EIoU is introduced to improve the convergence stability of the training process. The expression of the loss function that integrates Inner-IoU and Focal-EIoU is as follows: Where, represents the adaptive weighting function; Indicates the training phase; Among them, to address the defect of traditional IoU in measuring inaccuracy when the target boundary is blurred, Inner-IoU is improved by scaling factor β , and the ground truth box ( Bgt ) calculates the inner real box (Binner) and uses the predicted box ( Bpred ) with the indented ground truth box as a metric to achieve accurate evaluation of bounding box overlap; The expression for calculating the indented real box is as follows: Where, Indicates the calculation operation inside the shrinking real box; Take the prediction box ( Bpred The intersection-over-union (IoU) of the bounding box and the indented ground truth box is used as the metric to accurately evaluate the overlap of the bounding boxes: Where, Represents the calculation operation of the intersection-over-union loss function; Focal-EIoU introduces the Focal factor based on EIoU. To address the imbalance of disease categories in citrus disease detection, it dynamically adjusts the weight parameter η to achieve differentiated training for difficult and easy samples. The expression is as follows: Where, Indicates the calculation operation of introducing the Focal factor; The expression for dynamically adjusting the weight parameter η is as follows: Where, express The weight term, weight term and Inversely proportional relationship, that is The smaller it is, the larger the weight term is and the greater the loss contribution is; In the early stage of training, more attention is paid to Inner-IoU to quickly optimize target positioning, at this time The weight of Inner-IoU is relatively large; in the later stage of training, as the recognition ability of the model for various diseases improves, the role of Focal-EIoU will be enhanced to further solve the class imbalance problem, and through the auxiliary bounding box and dynamic focusing mechanism, the loss function significantly improves the bounding box regression accuracy and model training efficiency, providing optimization guarantee for citrus disease precision detection; S2.3.3, finally eliminate overlapping detection boxes through a non-maximum suppression algorithm, and output detection results containing disease categories, position coordinates and confidence.

[0016] S3, input the improved YOLOv8 network model into the multi-source citrus disease data set for training, and finally obtain the citrus disease detection result, the steps are as follows: S3.1, select PyTorch as the deep learning framework, PyTorch is an open source deep learning platform based on Python; S3.2, divide the multi-source citrus disease data set into training set and validation set according to the preset proportion; the proportion of 8:2 is selected in this embodiment; S3.3, set the training parameters, the initial learning rate is set to 0.001, the batch size is 32, the data enhancement (mosaic) is closed (that is, close_mosaic is set to 0), and the sub-process loading item (workers) is set to 8; S3.4, input the improved YOLOv8 network model using the training set, the model is trained by relying on algorithms such as back propagation and gradient descent, the forward propagation generates a prediction result, and the error is obtained by comparing the prediction result with the true result; the parameters are updated according to the error by back propagation; Common gradient descent methods include batch gradient descent (BGD), stochastic gradient descent (SGD) and mini-batch gradient descent (MBGD), and batch gradient descent (BGD) is selected in this embodiment; S3.5, output the detection result after reaching the maximum iteration number (epoch); Too little may lead to underfitting, and too much may lead to overfitting, and 150 iterations are selected in this embodiment.

[0017] In order to verify the present application, the model is verified using the validation set, which is a part of the original data set that is not used for training and is new data for the model; The model performance is evaluated by using the mean average precision (mAP) and the precision evaluation index, wherein the mean average precision (mAP) is the average value of the prediction accuracy of different categories, and is used for evaluating the multi-target detection problem; the accuracy is an important index for evaluating the prediction quality of the model, and focuses on the reliability of the model when making positive example prediction; The precision expression is as follows: In the formula, represents the true value, that is, the case that the actual citrus disease is consistent with the model predicted citrus disease; represents the false value, that is, the case that the actual citrus disease is inconsistent with the model predicted citrus disease; The mean average precision (mAP) expression is as follows: In the formula, represents the number of categories; represents the total number of citrus disease categories; represents the average precision of a single disease category (such as Huanglongbing); wherein, The intersection over union threshold is 50%, which is suitable for the case that the disease spot boundary is blurred in the agricultural scene; The test results show that the recognition accuracy and mAP50 of the citrus disease reach 86.3% and 83.6% respectively, indicating that the model of the present application can achieve higher accuracy and real-time performance in identifying citrus diseases in various complex environments.

[0018] Preferably, the present application realizes the following functions by constructing a Web-side intelligent service system: (1) Support multi-modal input of image uploading, video analysis and real-time camera acquisition; adopt a hierarchical caching mechanism to process video stream data, the key frame extraction interval can be dynamically adjusted, the camera access supports RTSP and ONVIF protocols, and multi-path video source concurrent processing can be realized; (2) Integrate Deepseek and Qwen large models to provide multi-dimensional popular science interpretation of disease diagnosis results, and the popular science interpretation content includes disease biological characteristic analysis, occurrence regularity and environmental relationship analysis, organic control scheme recommendation, chemical pesticide use guide, and similar symptom differential diagnosis; (3) Generate a visual report containing disease characteristics, control suggestions and similar cases; (4) Provide a function of querying the history of recognition results according to the recognition time and recognition results; (5) The Web-side realizes adaptive layout, supports multi-terminal access such as PC, tablet and mobile phone, and provides historical record query and statistical analysis functions.

[0019] Preferably, the present application ensures real-time performance by deploying a cloud reasoning service and using TensorRT acceleration, and supports multi-terminal access. When deployed, the model quantization technology is used to convert the FP32 model to the INT8 format, and the inference speed is improved by 2.3 times.

[0020] It should be understood that the above detailed description of the technical solutions of the present application by means of preferred embodiments is illustrative rather than limiting. Those of ordinary skill in the art can modify the technical solutions recorded in each embodiment or make equivalent substitutions for part of the technical features on the basis of the description of the present application; and these modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of the present application.

Claims

1. A citrus disease identification method based on improved YOLOv8, characterized in that: The following steps are involved: S1. Collect citrus disease images, perform preprocessing on the collected images, and construct a multi-source citrus disease dataset based on the preprocessed images; The multi-source citrus disease dataset includes: Huanglongbing leaf sample images, black spot fruit sample images, canker leaf and fruit sample images, anthracnose leaf and healthy leaf sample images; S2. Build an improved YOLOv8 network model; The improved methods include: The PSA attention mechanism is embedded after the SPPF layer in the backbone network; Introducing CCFF module into the neck network; Use DyHead to replace the original Decoupled Head detection head; Design a new loss function that combines Inner-IoU and Focal-EIoU; S3. Input the multi-source citrus disease dataset into the improved YOLOv8 network model for training, and finally obtain the citrus disease detection results.

2. The citrus disease identification method based on improved YOLOv8 according to claim 1, characterized in that: The method collects citrus disease images and performs preprocessing operations on the collected images, and constructs a multi-source citrus disease dataset through the preprocessed images. The preprocessing operations include: using OpenCV to batch process the collected image sizes and adjust the images to a preset size; performing image enhancement processing on the resized images, and using the labelimg tool to perform pixel-level semantic annotation on the diseased areas.

3. The citrus disease identification method based on improved YOLOv8 according to claim 1, characterized in that: The steps for constructing the improved YOLOv8 network model are as follows: S2.

1. The image is input into the backbone network. The PSA attention mechanism is embedded after the SPPF layer of the YOLOv8 network model to perform channel separation and channel feature extraction on the image output by the backbone network to obtain shallow feature maps and deep feature maps. S2.

2. Introduce the CCFF module into the neck network. The CCFF module receives the shallow feature map and deep feature map output by the backbone network and performs optimization operations on the shallow feature map and the deep feature map; S2.

3. Use the DyHead detection head to replace the original Decoupled Head detection head. Input the optimized feature map output by the CCFF module into the DyHead detection head. The DyHead detection head obtains the detection result by fusing the Inner-IoU and Focal-EIoU loss functions.

4. The citrus disease identification method based on improved YOLOv8 according to claim 1, characterized in that: The steps of inputting the multi-source citrus disease dataset into the improved YOLOv8 network model for training and finally obtaining the citrus disease detection results are as follows: S3.

1. Choose PyTorch as the deep learning framework. S3.

2. Divide the multi-source citrus disease dataset into a training set and a validation set according to a preset ratio; S3.

3. Set the training parameters according to the preset values, including the initial learning rate, batch size, and subprocess add-ons. At the same time, turn off data augmentation. S3.

4. Use the training set to input the improved YOLOv8 network model. The model is trained using algorithms such as backpropagation and gradient descent. S3.

5. Output the detection result after reaching the maximum number of iterations.

5. The citrus disease identification method based on improved YOLOv8 according to claim 3, characterized in that: The image is input into the backbone network, and the PSA attention mechanism is embedded after the SPPF layer of the YOLOv8 network model to perform channel separation operations and channel feature extraction operations on the image output by the backbone network to obtain shallow feature maps and deep feature maps. The YOLOv8 network model backbone network includes 5 convolutional layers and one SPPF layer. The image goes from the first convolutional layer to the fifth convolutional layer, and finally passes through the SPPF layer; wherein the second and third layers, the third and fourth layers, the fourth and fifth layers, and the fifth layer and the SPPF layer are connected through a cross-stage feature fusion module; The shallow feature map is: the third and fourth layers in the YOLOv8 network model, and the part of the fourth and fifth layers connected through the cross-stage feature fusion module and input into the neck network; The deep feature map is the output of the SPPF layer. The PSA attention mechanism works as follows: the input deep feature map is divided into a preset number of sub-map groups in the channel dimension; for each channel sub-map, the spatial dimension is divided into large-scale and small-scale areas through the spatial pyramid attention mechanism; the divided areas are independently calculated with attention weights through convolution operations and activation functions.

6. The citrus disease identification method based on improved YOLOv8 according to claim 3, characterized in that: The CCFF module is introduced into the neck network. The CCFF module receives the shallow feature map and the deep feature map output by the backbone network, and performs optimization operations on the shallow feature map and the deep feature map. The optimization operation is performed in the following manner: adjusting the channel dimension through two convolutions, aligning the number of channels of the shallow feature map and the deep feature map; and inputting the aligned feature map into the RepVggBlock sequence to perform inference calculation operations.

7. The citrus disease identification method based on improved YOLOv8 according to claim 3, characterized in that: The DyHead detection head is used to replace the original Decoupled Head detection head, and the optimized feature map output by the CCFF module is input into the DyHead detection head. The DyHead detection head obtains the detection result by fusing the Inner-IoU and Focal-EIoU loss functions as follows: S2.3.

1. After the feature map optimized by CCFF module is input into DyHead detection head, the fused feature map is obtained through dynamic feature fusion mechanism; S2.3.2, the DyHead detection head performs classification branch operations and regression branch operations on the fused feature map in sequence; The classification branch uses the Softmax function to calculate the probability of disease categories; The regression branch uses the bounding box regression algorithm to optimize the coordinates and size of the detection bounding box, introducing a loss function that integrates Inner-IoU and Focal-EIoU; The Inner-IoU loss function calculates the indented true box through the scaling factor and the true box, and uses the intersection-over-union ratio of the predicted box and the indented true box as a metric to evaluate the bounding box overlap; The Focal-EIoU loss function introduces the Focal factor based on EIoU and dynamically adjusts the weight parameters to perform differentiated training on samples. S2.3.

3. Finally, the overlapping detection frames are eliminated through the non-maximum suppression algorithm, and the detection results including disease category, location coordinates and confidence level are output.