Intelligent apple disease detection and identification method based on multi-target identification technology
By applying multi-objective recognition technology and improved methods of YOLOv8 model on the Apple disease dataset, the problem of degradation of target detection accuracy of apple leaf disease in natural environment is solved, and higher detection accuracy and model robustness are achieved.
Patent Information
- Application Number
- CN202411799820.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-07
AI Technical Summary
The existing apple disease data set has reduced the accuracy of disease target detection of apple leaves in natural environments and is unclear in labeling, resulting in poor generalization ability of the model.
The intelligent detection and recognition method of Apple disease based on multi-objective recognition technology is adopted. By collecting apple tree leaf disease images in natural environments, manually annotating, data preprocessing and data set division, the YOLOv8 model is built using the PyTorch framework, and an attention mechanism is added to the model's BackBone to improve the loss function to improve the detection accuracy of the model.
Through data enhancement and model improvement, the accuracy of Apple's disease detection is significantly improved, the generalization ability and robustness of the model are improved, and the missed and missed detection is reduced.
Smart Images

Figure CN119580010A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent detection of agricultural diseases, and in particular to an intelligent detection and recognition method for apple diseases based on multi-target recognition technology. Background Art
[0002] The YOLOv8 model in deep learning technology under existing technologies faces many problems and challenges in the detection of apple leaf diseases, and there are still some key problems to be solved. For example, the existing apple disease image dataset lacks complexity and cannot fully reflect the various forms and states of apple leaf disease targets, resulting in poor generalization ability of the model. There are problems such as decreased accuracy of apple leaf disease target detection and unclear labeling in the apple disease dataset in the natural environment.
[0003] In order to optimize the model's detection of apple disease datasets, the improved YOLOv8n model is used to optimize and detect the apple leaf disease dataset. YOLOv8 is an object detection model with excellent performance and has been widely used. The YOLOv8 model has the characteristics of fast speed, high accuracy, and strong robustness, and is very suitable for plant disease detection tasks in agriculture.
[0004] Therefore, an intelligent detection and recognition method for apple diseases based on multi-target recognition technology is proposed, which provides theoretical guidance and solutions for the optimization and detection of apple disease datasets using the deep learning YOLOv8 model. The purpose of this invention is to solve the problems of decreased accuracy and unclear labeling of disease targets of apple leaves in natural environments in apple disease datasets. Summary of the invention
[0005] In order to solve the problems of decreased accuracy and unclear labeling of disease targets on apple leaves in natural environments under the existing technology of apple disease dataset.
[0006] The technical solution of the present invention is: an intelligent detection and identification method for apple diseases based on multi-target recognition technology, comprising the following steps:
[0007] S1: Collect disease images of apple tree leaves in natural environments and build an apple disease dataset;
[0008] S2: Manual labeling of disease targets, data preprocessing and data set division of the collected image data;
[0009] S3: Use the PyCharm platform and PyTorch as the framework to build the YOLOv8 basic model and use the built data set for training;
[0010] S4: Design an improvement strategy for the model in step S3;
[0011] S5: Build the improved model and perform model training using the same data set in step S3;
[0012] S6: Compare the training results of the improved model with those of the basic model for performance evaluation;
[0013] S7: After determining the final improvement of the model, the final model training result is saved and the final optimal model parameter file is output.
[0014] Preferably, in step S1, image data of various types of apple diseases in natural environments are collected online. To ensure the diversity and complexity of the data, the image shooting angles are diversified, the disease types are diversified, and the natural conditions are diversified, so as to ensure the generalization and robustness of the model. Internet resources are used to collect leaf images containing various types of apple diseases, ensuring that the images cover leaf diseases in different seasons, different weather conditions, and different time periods, ensuring that the images contain multiple disease types, and each disease type has multiple manifestations, and also including different growth stages and angles of the leaves.
[0015] Preferably, in step S2, the collected image data is manually labeled with disease targets, data preprocessed, and prepared for data set division, and the specific steps include:
[0016] S201: Use Labelimg to classify the disease targets and manually annotate the targets in the collected apple disease image data, and finally organize the annotated files into a .txt file format suitable for YOLO;
[0017] S202: Performing offline data enhancement processing on the labeled image data;
[0018] S203: Divide the complete data set into three parts: training set, test set and validation set.
[0019] Preferably, in step S201, the collected apple disease image data is classified and manually labeled using Labelimg, and the final labeled file is organized into a .txt file format suitable for YOLO. The specific steps include:
[0020] S20101: In the Labelimg interface, select the Open Dir option and import the folder where the previously collected apple disease image dataset is located;
[0021] S20102: According to the type of apple disease, set the corresponding labeling category in Labelimg;
[0022] S20103: For each image, use Labelimg's annotation tool to manually select the disease target in the image. While selecting the target, select the corresponding disease category label and record the disease type to which the target belongs.
[0023] S20104: After completing the annotation of an image, save the annotation result of the image. Labelimg saves the annotation result as a .txt file with the same name as the image file, wherein the .txt file records the position information of each annotation box and the annotation category information;
[0024] S20105: Perform the above labeling process on each image in the dataset until all images are correctly labeled.
[0025] Preferably, in step S202, offline data enhancement processing is performed on the labeled image data to enrich the diversity and complexity of the data and improve the generalization ability and robustness of the model. The specific steps include:
[0026] S20201: Image flipping: flip the original image horizontally or vertically to increase data diversity;
[0027] S20202: Image rotation: Rotate the original image at random angles to simulate the different orientations of leaves in the natural environment. The rotation angle can be randomly selected within a certain range, ranging from -90 degrees to 90 degrees.
[0028] S20203: Image scaling: Scale the original image to change the image size to simulate the situation of shooting leaf diseases at different distances, so that the model can adapt to target detection at different scales;
[0029] S20204: Image cropping: Randomly crop sub-images of different sizes and positions from the original image to help the model learn the local features of the diseased target;
[0030] S20205: Color transformation: adjust the color of the original image, including changing the brightness, contrast, and saturation to simulate leaf diseases under different lighting conditions, which is used to improve the robustness of the model to lighting changes;
[0031] S20206: Add noise: Add a certain amount of noise to the original image, including Gaussian noise and salt and pepper noise, to simulate the interference in the image transmission process, which is used to improve the model's anti-noise ability;
[0032] S20207: Data enhancement combination: Combine multiple data enhancement methods in steps S20201-S20206 to generate diversified training data.
[0033] Preferably, in step S3, the PyCharm platform is used to build a YOLOv8 basic model with PyTorch as the framework, and the built data set is used for training. The specific steps include:
[0034] S301: equipped with PyCharm compilation platform;
[0035] S302: Configure the PyTorch environment as the model framework, download the YOLOv8n model file, and use the official pre-trained model to accelerate the training process;
[0036] S303: Import the divided data set into the model to start training. The training process is accelerated by GPU. After the training is completed, the training results are saved.
[0037] Preferably, in step S4, an improvement strategy is designed for the model in step S3. First, an attention mechanism is added to the BackBone of YOLOv8n to improve the model's effective feature extraction capability and attention to disease targets, which can effectively reduce the occurrence of false detection and missed detection. Second, an IOU loss function, which is extremely important in the target detection task, is improved to accelerate the convergence of the model and allocate appropriate optimization strategies to complex samples to improve detection accuracy. The specific steps include:
[0038] S401: Select the LSKNet attention mechanism to dynamically adjust the spatial receptive field and enhance the model's ability to detect targets in complex situations;
[0039] S402: Integrate the selected attention mechanism into BackBone of YOLOv8n to ensure its compatibility with the original network structure;
[0040] S403: Select W_IoU_LOSS loss function to process anchor boxes of different qualities;
[0041] S404: Implement the selected alternative loss function in the YOLOv8n framework to ensure its compatibility with the original network structure.
[0042] Preferably, in step S5, the downloaded YOLOv8n model is structurally optimized using the same operating procedure as in step S3, and the same data set as in step S3 is used for training.
[0043] Preferably, in step S6, four groups of ablation experiments are conducted, namely YOLOv8n, YOLOv8n+Attention, YOLOv8n+WIoU_LOSS, and YOLOv8n+Attention+WIoU_LOSS. The results obtained by training the improved model are compared with the basic model training results through the performance evaluation indicators of target detection to find the best parameter configuration and improvement plan; the performance indicators include accuracy, recall rate and mAP indicators; the specific steps are as follows:
[0044] S601: Configure the software and hardware environment required for evaluation, including GPU, PyTorch framework, and PyCharm platform;
[0045] S602: Setting performance evaluation indicators, including accuracy, recall and mAP indicators;
[0046] S603: For each model, the same test set is used for performance evaluation, which contains diverse apple disease images;
[0047] S604: Calculate the accuracy, recall and mAP indicators of each model on the test set;
[0048] S605: Compare the performance indicators of each improved model (i.e., YOLOv8n+Attention, YOLOv8n+WIoU_LOSS, YOLOv8n+Attention+WIoU_LOSS) with the basic model YOLOv8n;
[0049] S606: Analyze the impact of each improvement strategy on model performance, including the improvement or decrease in accuracy, recall, and mAP, and identify the best performing model, that is, the model with the best comprehensive performance of accuracy, recall, and mAP indicators;
[0050] S607: Based on the performance evaluation results, determine the optimal model parameter configuration and improvement plan, including attention mechanism, loss function parameters and training strategy.
[0051] Preferably, in step S7, after the final improvement of the model is determined, the final model training result is saved and the final optimal model parameter file is output, specifically:
[0052] The optimal model and parameter settings obtained after the performance comparison analysis in step S6 are saved and the parameter file of the optimal model is exported.
[0053] Beneficial effects of the present invention:
[0054] 1. The present invention increases the complexity of the data by performing offline data enhancement on the labeled data set, thereby improving the detection accuracy of the model when facing image data in different situations, and enhancing the generalization ability and robustness of the model;
[0055] 2. The present invention uses deep network learning technology to build a PyTorch environment, uses the PyCharm platform to construct a YOLOv8 model framework, and adjusts parameters through the model, thereby improving the generalization ability of the model and reducing missed detections and false detections;
[0056] 3. This experiment optimizes and improves the structure and loss function of YOLOv8, and evaluates the performance improvement of the improved model through performance evaluation indicators in the field of target detection, such as accuracy, recall rate and mAP. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 Shown is a schematic flow chart of the step 1 of the method for intelligent detection and identification of apple diseases based on multi-target recognition technology of the present invention;
[0058] Figure 2 What is shown is a structural diagram of the attention mechanism used in the method for intelligent detection and identification of apple diseases based on multi-target recognition technology of the present invention;
[0059] Figure 3 What is shown is the structure diagram of the YOLOv8 model after the improvement and optimization of the method for intelligent detection and identification of apple diseases based on multi-target recognition technology of the present invention;
[0060] Figure 4 What is shown is the actual detection effect diagram of the apple disease intelligent detection and identification method model based on multi-target recognition technology of the present invention. DETAILED DESCRIPTION
[0061] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0062] See also Figure 1-4 The present invention provides an embodiment: an intelligent detection and identification method for apple diseases based on multi-target recognition technology, comprising the following steps:
[0063] S1: Collect disease images of apple tree leaves in natural environments and build an apple disease dataset;
[0064] S2: Manual labeling of disease targets, data preprocessing and data set division of the collected image data;
[0065] S3: Use the PyCharm platform and PyTorch as the framework to build the YOLOv8 basic model and use the built data set for training;
[0066] S4: Design an improvement strategy for the model in step S3;
[0067] S5: Build the improved model and perform model training using the same data set in step S3;
[0068] S6: Compare the training results of the improved model with those of the basic model for performance evaluation;
[0069] S7: After determining the final improvement of the model, the final model training result is saved and the final optimal model parameter file is output.
[0070] Preferably, in step S1, image data of various types of apple diseases in natural environments are collected online. To ensure the diversity and complexity of the data, the image shooting angles are diversified, the disease types are diversified, and the natural conditions are diversified, so as to ensure the generalization and robustness of the model. Internet resources are used to collect leaf images containing various types of apple diseases, ensuring that the images cover leaf diseases in different seasons, different weather conditions, and different time periods, ensuring that the images contain multiple disease types, and each disease type has multiple manifestations, and also including different growth stages and angles of the leaves.
[0071] Preferably, in step S2, the collected image data is manually labeled with disease targets, data preprocessed, and prepared for data set division, and the specific steps include:
[0072] S201: Use Labelimg to classify the disease targets and manually annotate the targets in the collected apple disease image data, and finally organize the annotated files into a .txt file format suitable for YOLO;
[0073] S202: Performing offline data enhancement processing on the labeled image data;
[0074] S203: Divide the complete data set into three parts: training set, test set and validation set.
[0075] Preferably, in step S201, the collected apple disease image data is classified and manually labeled using Labelimg, and the final labeled file is organized into a .txt file format suitable for YOLO. The specific steps include:
[0076] S20101: In the Labelimg interface, select the Open Dir option and import the folder where the previously collected apple disease image dataset is located;
[0077] S20102: According to the type of apple disease, set the corresponding labeling category in Labelimg;
[0078] S20103: For each image, use Labelimg's annotation tool to manually select the disease target in the image. While selecting the target, select the corresponding disease category label and record the disease type to which the target belongs.
[0079] S20104: After completing the annotation of an image, save the annotation result of the image. Labelimg saves the annotation result as a .txt file with the same name as the image file, wherein the .txt file records the position information of each annotation box and the annotation category information;
[0080] S20105: Perform the above labeling process on each image in the dataset until all images are correctly labeled.
[0081] Preferably, in step S202, offline data enhancement processing is performed on the labeled image data to enrich the diversity and complexity of the data and improve the generalization ability and robustness of the model. The specific steps include:
[0082] S20201: Image flipping: flip the original image horizontally or vertically to increase data diversity;
[0083] S20202: Image rotation: Rotate the original image at random angles to simulate the different orientations of leaves in the natural environment. The rotation angle can be randomly selected within a certain range, ranging from -90 degrees to 90 degrees.
[0084] S20203: Image scaling: Scale the original image to change the image size to simulate the situation of shooting leaf diseases at different distances, so that the model can adapt to target detection at different scales;
[0085] S20204: Image cropping: Randomly crop sub-images of different sizes and positions from the original image to help the model learn the local features of the diseased target;
[0086] S20205: Color transformation: adjust the color of the original image, including changing the brightness, contrast, and saturation to simulate leaf diseases under different lighting conditions, which is used to improve the robustness of the model to lighting changes;
[0087] S20206: Add noise: Add a certain amount of noise to the original image, including Gaussian noise and salt and pepper noise, to simulate the interference in the image transmission process, which is used to improve the model's anti-noise ability;
[0088] S20207: Data enhancement combination: Combine multiple data enhancement methods in steps S20201-S20206 to generate diversified training data.
[0089] Preferably, in step S3, the PyCharm platform is used to build a YOLOv8 basic model with PyTorch as the framework, and the built data set is used for training. The specific steps include:
[0090] S301: equipped with PyCharm compilation platform;
[0091] S302: Configure the PyTorch environment as the model framework, download the YOLOv8n model file, and use the official pre-trained model to accelerate the training process;
[0092] S303: Import the divided data set into the model to start training. The training process is accelerated by GPU. After the training is completed, the training results are saved.
[0093] Preferably, in step S4, an improvement strategy is designed for the model in step S3. First, an attention mechanism is added to the BackBone of YOLOv8n to improve the model's effective feature extraction capability and attention to disease targets, which can effectively reduce the occurrence of false detection and missed detection. Second, an IOU loss function, which is extremely important in the target detection task, is improved to accelerate the convergence of the model and allocate appropriate optimization strategies to complex samples to improve detection accuracy. The specific steps include:
[0094] S401: Select the LSKNet attention mechanism to dynamically adjust the spatial receptive field and enhance the model's ability to detect targets in complex situations;
[0095] S402: Integrate the selected attention mechanism into BackBone of YOLOv8n to ensure its compatibility with the original network structure;
[0096] S403: Select W_IoU_LOSS loss function to process anchor boxes of different qualities;
[0097] S404: Implement the selected alternative loss function in the YOLOv8n framework to ensure its compatibility with the original network structure.
[0098] Preferably, in order to improve the model's feature extraction capability for complex situations of apple leaf disease, especially when the disease target is not obvious and the disease target is small due to the influence of angle and distance, the LSKNet attention mechanism is added to BackBone to enhance the model's ability to detect targets in complex situations by dynamically adjusting the spatial receptive field; W_IoU_LOSS is used to replace the original CIoU_LOSS. W_IoU introduces the idea of Focal Loss, constructs distance attention and focusing coefficients, and allocates different gradient gains to the model when facing anchor frames of different qualities, so that the model pays more attention to difficult target anchor frames, which can effectively improve the generalization ability and robustness of the model.
[0099] Preferably, in step S5, the downloaded YOLOv8n model is structurally optimized using the same operating procedure as in step S3, and the same data set as in step S3 is used for training.
[0100] Preferably, in step S6, four groups of ablation experiments are conducted, namely YOLOv8n, YOLOv8n+Attention, YOLOv8n+WIOU_Loss, and YOLOv8n+Attention+WIOU_Loss. The results obtained by training the improved model are compared with the basic model training results through the performance evaluation indicators of target detection to find the best parameter configuration and improvement plan; the performance indicators include accuracy, recall rate and mAP indicators; the specific steps are as follows:
[0101] S601: Configure the software and hardware environment required for evaluation, including GPU, PyTorch framework, and PyCharm platform;
[0102] S602: Setting performance evaluation indicators, including accuracy, recall and mAP indicators;
[0103] S603: For each model, the same test set is used for performance evaluation, which contains diverse apple disease images;
[0104] S604: Calculate the accuracy, recall and mAP indicators of each model on the test set;
[0105] S605: Compare the performance indicators of each improved model (i.e., YOLOv8n+Attention, YOLOv8n+WIoU_LOSS, YOLOv8n+Attention+WIoU_LOSS) with the basic model YOLOv8n;
[0106] S606: Analyze the impact of each improvement strategy on model performance, including the improvement or decrease in accuracy, recall, and mAP, and identify the best performing model, that is, the model with the best comprehensive performance of accuracy, recall, and mAP indicators;
[0107] S607: Based on the performance evaluation results, determine the optimal model parameter configuration and improvement plan, including attention mechanism, loss function parameters and training strategy.
[0108] Among them, the ablation experiment results are shown in the following table:
[0109]
[0110] Finally, through comparison, the improved model has an accuracy (P) of 3.4 percentage points higher than the basic model, a recall rate (R) of 1.2 percentage points higher, and a mAP0.5 of 1.6 percentage points higher. In summary, the improved model has a significant effect on improving the detection accuracy of diseases.
[0111] Preferably, in step S7, after the final improvement of the model is determined, the final model training result is saved and the final optimal model parameter file is output, specifically:
[0112] The optimal model and parameter settings obtained after the performance comparison analysis in step S6 are saved and the parameter file of the optimal model is exported.
[0113] Example
[0114] Optionally, when evaluating the intelligent disease identification application, 5,000 apple disease images in natural environments were collected from the Internet and field photography. The images covered leaf diseases in different seasons (spring, summer, and autumn), different weather conditions (sunny, cloudy, and rainy), and different time periods (morning, noon, and evening). The types of diseases involved included common diseases such as apple rust, apple anthracnose, and apple leaf spot.
[0115] A variety of data augmentation methods including flipping, rotating, scaling, cropping, color transformation and adding noise were applied to each image, and finally 15,000 augmented images were generated. The dataset was divided into a training set (12,000 images), a validation set (1,500 images) and a test set (1,500 images).
[0116] When training and improving the model, the PyCharm platform and PyTorch framework were used to build the YOLOv8n basic model, the LSKNet attention mechanism was added to BackBone, and the CIoU_LOSS loss function was replaced with the W_IoU_LOSS loss function. The training process used GPU acceleration training, the number of training rounds was 100 rounds, the initial learning rate was set to 0.01, and the cosine annealing learning rate scheduling strategy was adopted;
[0117] Four sets of ablation experiments were conducted to evaluate the performance of the model, including the precision (P), recall (R), and mAP0.5 indicators. The specific results are shown in the following table:
[0118]
[0119]
[0120] By analyzing the comparative structure, the improved model (YOLOv8n+WIoU+Attention) has improved the accuracy by 3.4 percentage points compared with the basic model (YOLOv8n), reaching 94.9%; although the improvement in recall is relatively small (1.2 percentage points), it still reaches 86.7%, indicating that the model has better coverage when detecting diseased targets; the improved model has improved mAP0.5 by 1.6 percentage points, reaching 95.6%, which further proves the significant improvement in the detection accuracy of the model; the specific experimental image detection results are shown in the figure below. Figure 4 As shown;
[0121] Through the analysis of the above experimental data and results, the intelligent detection and recognition method of apple diseases based on multi-target recognition technology proposed in the present invention effectively improves the accuracy of disease detection; by adding the attention mechanism and improving the loss function in the YOLOv8n model, the model has achieved significant improvements in performance indicators such as accuracy, recall rate and mAP0.5.
[0122] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of those skilled in the art without departing from the spirit of the present invention.
Claims
1. An intelligent detection and identification method for apple diseases based on multi-target recognition technology; characterized in that: The following steps are involved: S1: Collect disease images of apple tree leaves in natural environments and build an apple disease dataset; S2: Manual labeling of disease targets, data preprocessing and data set division of the collected image data; S3: Use the PyCharm platform and PyTorch as the framework to build the YOLOv8 basic model and use the built data set for training; S4: Design an improvement strategy for the model in step S3; S5: Build the improved model and perform model training using the same data set in step S3; S6: Compare the training results of the improved model with those of the basic model for performance evaluation; S7: After determining the final improvement of the model, the final model training result is saved and the final optimal model parameter file is output.
2. The method for intelligent detection and identification of apple diseases based on multi-target recognition technology according to claim 1 is characterized in that: In the step S1, various types of apple disease image data in the natural environment are collected online. In order to ensure the diversity and complexity of the data, the image shooting angles are diversified, the disease types are diversified, and the natural conditions are diversified, so as to ensure the generalization ability and robustness of the model. Internet resources are used to collect leaf images containing various types of apple diseases to ensure that the images cover leaf diseases in different seasons, different weather conditions, and different time periods. It is ensured that the images contain multiple disease types, and each disease type has multiple manifestations, and also include different growth stages and angles of the leaves.
3. The method for intelligent detection and identification of apple diseases based on multi-target recognition technology according to claim 1, characterized in that: In step S2, the collected image data is manually labeled with disease targets, data preprocessed, and prepared for data set division. The specific steps include: S201: Use Labelimg to classify the disease targets and manually annotate the targets in the collected apple disease image data, and finally organize the annotated files into a .txt file format suitable for YOLO; S202: Performing offline data enhancement processing on the labeled image data; S203: Divide the complete data set into three parts: training set, test set and validation set.
4. The method for intelligent detection and identification of apple diseases based on multi-target recognition technology according to claim 3 is characterized in that: In step S201, the collected apple disease image data is used to classify the disease targets and manually annotate the targets using Labelimg, and the final annotated file is organized into a .txt file format suitable for YOLO. The specific steps include: S20101: In the Labelimg interface, select the Open Dir option and import the folder where the previously collected apple disease image dataset is located; S20102: According to the type of apple disease, set the corresponding labeling category in Labelimg; S20103: For each image, use Labelimg's annotation tool to manually select the disease target in the image. While selecting the target, select the corresponding disease category label and record the disease type to which the target belongs. S20104: After completing the annotation of an image, save the annotation result of the image. Labelimg saves the annotation result as a .txt file with the same name as the image file, wherein the .txt file records the position information of each annotation box and the annotation category information; S20105: Perform the above labeling process on each image in the dataset until all images are correctly labeled.
5. The method for intelligent detection and identification of apple diseases based on multi-target recognition technology according to claim 3 is characterized in that: In step S202, offline data enhancement processing is performed on the labeled image data to enrich the diversity and complexity of the data and improve the generalization ability and robustness of the model. The specific steps include: S20201: Image flipping: flip the original image horizontally or vertically to increase data diversity; S20202: Image rotation: Rotate the original image at random angles to simulate the different orientations of leaves in the natural environment. The rotation angle can be randomly selected within a certain range, ranging from -90 degrees to 90 degrees. S20203: Image scaling: Scale the original image to change the size of the image to simulate the situation of shooting leaf diseases at different distances, so that the model can adapt to target detection at different scales; S20204: Image cropping: Randomly crop sub-images of different sizes and positions from the original image to help the model learn the local features of the diseased target; S20205: Color transformation: adjust the color of the original image, including changing the brightness, contrast, and saturation to simulate leaf diseases under different lighting conditions, which is used to improve the robustness of the model to lighting changes; S20206: Add noise: Add a certain amount of noise to the original image, including Gaussian noise and salt and pepper noise, to simulate the interference in the image transmission process, which is used to improve the model's anti-noise ability; S20207: Data enhancement combination: Combine multiple data enhancement methods in steps S20201-S20206 to generate diversified training data.
6. The method for intelligent detection and identification of apple diseases based on multi-target recognition technology according to claim 1, characterized in that: In step S3, the PyCharm platform is used to build a YOLOv8 basic model with PyTorch as the framework and the built data set is used for training. The specific steps include: S301: equipped with PyCharm compilation platform; S302: Configure the PyTorch environment as the model framework, download the YOLOv8n model file, and use the official pre-trained model to accelerate the training process; S303: Import the divided data set into the model to start training. The training process is accelerated by GPU. After the training is completed, the training results are saved.
7. The method for intelligent detection and identification of apple diseases based on multi-target recognition technology according to claim 1, characterized in that: In step S4, an improvement strategy is designed for the model in step S3. First, an attention mechanism is added to the BackBone of YOLOv8n to improve the model's effective feature extraction capability and attention to disease targets, which can effectively reduce the occurrence of false detection and missed detection. Second, the IOU loss function, which is extremely important in the target detection task, is improved to accelerate the convergence of the model and allocate appropriate optimization strategies to complex samples to improve detection accuracy. The specific steps include: S401: Select the LSKNet attention mechanism to dynamically adjust the spatial receptive field and enhance the model's ability to detect targets in complex situations; S402: Integrate the selected attention mechanism into BackBone of YOLOv8n to ensure its compatibility with the original network structure; S403: Select W_IoU_LOSS loss function to process anchor boxes of different qualities; S404: Implement the selected alternative loss function in the YOLOv8n framework to ensure its compatibility with the original network structure.
8. The method for intelligent detection and identification of apple diseases based on multi-target recognition technology according to claim 1, characterized in that: In step S5, the downloaded YOLOv8n model is structurally optimized using the same operating process as in step S3, and is trained using the same data set as in step S3.
9. The method for intelligent detection and identification of apple diseases based on multi-target recognition technology according to claim 1, characterized in that: In step S6, four groups of ablation experiments are conducted, namely YOLOv8n, YOLOv8n+Attention, YOLOv8n+WIOU_Loss, and YOLOv8n+Attention+WIOU_Loss. The results obtained by training the improved model are compared with the basic model training results through the performance evaluation indicators of target detection to find the best parameter configuration and improvement plan; the performance indicators include accuracy, recall rate and mAP indicators; the specific steps are as follows: S601: Configure the software and hardware environment required for evaluation, including GPU, PyTorch framework, and PyCharm platform; S602: Setting performance evaluation indicators, including accuracy, recall and mAP indicators; S603: For each model, the same test set is used for performance evaluation, which contains diverse apple disease images; S604: Calculate the accuracy, recall and mAP indicators of each model on the test set; S605: Compare the performance indicators of each improved model (i.e., YOLOv8n+Attention, YOLOv8n+WIoU_LOSS, YOLOv8n+Attention+WIoU_LOSS) with the basic model YOLOv8n; S606: Analyze the impact of each improvement strategy on model performance, including the improvement or decrease in accuracy, recall, and mAP, and identify the best performing model, that is, the model with the best comprehensive performance of accuracy, recall, and mAP indicators; S607: Based on the performance evaluation results, determine the optimal model parameter configuration and improvement plan, including attention mechanism, loss function parameters and training strategy.
10. The method for intelligent detection and identification of apple diseases based on multi-target recognition technology according to claim 9, characterized in that: In step S7, after the final improvement of the model is determined, the final model training result is saved and the final optimal model parameter file is output, specifically: The optimal model and parameter settings obtained after the performance comparison analysis in step S6 are saved and the parameter file of the optimal model is exported.