Method, system and equipment for detecting dead leaves based on YOLOv8 model
Through the dead leaf detection method based on the YOLOv8 model, the problem of subjectivity and low automation of dead leaf detection in the existing technology is solved, and high accuracy and high efficiency detection is achieved, which is suitable for the identification and cleaning of dead leaf in different scenarios.
Patent Information
- Application Number
- CN202510048723.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-05-09
AI Technical Summary
The existing technology has problems such as strong subjectivity in the detection of dead branches and leaves, low automation and intelligence, and great impact on the external environment, making it difficult to achieve high accuracy and high efficiency detection.
A dead leaf detection method based on the YOLOv8 model is adopted, and a YOLOv8 model for dead leaf detection is established by obtaining historical image data for preprocessing and annotating, and a small object detection layer is set up in the model to detect leaves with pixel sizes of 4×4 or more.
It realizes high-accurate detection of dead branches and leaves, has a fast inference speed, can respond to environmental changes in a timely manner and make corresponding actions, and is suitable for use in different scenarios.
Smart Images

Figure CN119963973A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer image processing, and in particular relates to a dead leaf detection method, system and device based on a YOLOv8 model. Background Art
[0002] In orchards, the accumulation of dead branches and leaves will affect the healthy development of fruit trees, reduce the quality of fruit, and may even cause diseases and insect pests. Dead branches and leaves on both sides of the road not only affect the appearance of the city, but may also cause safety hazards under bad weather conditions. Therefore, it is necessary to detect and identify dead branches and leaves in a timely manner and clean them up.
[0003] Among the detection methods used in the existing technologies, the manual detection methods have the disadvantages of strong subjectivity, low efficiency and low detection accuracy; the instrument-based detection methods have the limitations of low automation and intelligence and the results being affected by factors such as the external environment; the mathematical statistics-based detection methods have the limitations of large workload, small scope of application and the need for professional statistics and agricultural knowledge. Summary of the invention
[0004] In order to solve the above technical problems, the present invention proposes a dead leaf detection method, system and device based on the YOLOv8 model, which can help to more accurately detect and identify dead branches and leaves, and can respond to environmental changes in a timely manner and take corresponding actions.
[0005] To achieve the above object, the present invention adopts the following technical solutions:
[0006] A dead leaf detection method based on the YOLOv8 model comprises the following steps:
[0007] Obtain historical images of dead branches and leaves in the target environment, pre-process the historical image data, and then annotate the image data with labels to obtain an image data set; divide the image data set into a training set and a test set according to a preset ratio;
[0008] A YOLOv8 model for dead leaf detection is established, wherein a small target detection layer is set in the YOLOv8 model; the small target detection layer is a detection feature map with a pixel size of 160×160, which is used to detect leaves with a pixel size of 4×4 or more; the YOLOv8 model is trained using the training set to obtain a trained YOLOv8 model;
[0009] Obtain the leaf image to be detected in the target environment, input the leaf image to be detected into the trained YOLOv8 model, obtain the detection result of dead branches and leaves, and test the detection result of dead branches and leaves using the test set.
[0010] Furthermore, the method further comprises: cleaning up the dead branches and leaves that need to be cleaned up according to the detection result of the dead branches and leaves.
[0011] Furthermore, the pictures of dead branches and leaves in the target environment are pictures taken at different angles, under different lighting conditions and in different scenes.
[0012] Furthermore, the image data is annotated with labels, specifically: the image data is annotated with leave and branch to change the image brightness.
[0013] Furthermore, the YOLOv8 model is used to receive a 640×640 pixel image of leaves to be detected.
[0014] Furthermore, the YOLOv8 model includes a Backbone layer, a Neck layer and a Head layer;
[0015] The Backbone layer uses the improved lightweight convolutional neural network ShuffleNetV2 as the backbone network for feature extraction;
[0016] The Neck layer retains the PAN-FPN structure and adds the SEnet attention mechanism after the upsample structure to cooperate with the small target detection layer;
[0017] The Head layer retains the decoupled head structure and separates the classification and detection heads.
[0018] Furthermore, the Backbone layer retains the SP-PF module to solve the problem of repeated feature extraction of images by the convolutional neural network.
[0019] Furthermore, during the working process of the YOLOv8 model:
[0020] Accumulate the 80×80 scale feature layer on the Backbone side and the upsampled feature layer on the Neck side;
[0021] Through C2f, SEnet and Upsample operations, a deep semantic feature layer containing small target feature information is obtained;
[0022] The deep semantic feature layer is accumulated with the shallow position feature layer in Backbone, so as to improve the expression ability of the 160×160 pixel fusion feature layer for the semantic features and position information of small objects;
[0023] Send the output of the Backbone layer to an additional decoupled head in the Head.
[0024] The present invention also proposes a dead leaf detection system based on the YOLOv8 model, comprising a preprocessing module, a model building module and a detection module;
[0025] The preprocessing module is used to obtain historical images of dead branches and leaves in the target environment, and after preprocessing the historical image data, use labels to annotate the image data to obtain an image data set; divide the image data set into a training set and a test set according to a preset ratio;
[0026] The model building module is used to build a YOLOv8 model for dead leaf detection, wherein a small target detection layer is set in the YOLOv8 model; the small target detection layer is a detection feature map with a pixel size of 160×160, which is used to detect leaves with a pixel size of 4×4 or more; the YOLOv8 model is trained using the training set to obtain a trained YOLOv8 model;
[0027] The detection module is used to obtain the leaf image to be detected in the target environment, input the leaf image to be detected into the trained YOLOv8 model, obtain the detection result of dead branches and leaves, and test the detection result of dead branches and leaves using the test set.
[0028] The present invention also proposes a device, comprising:
[0029] Memory for storing computer programs;
[0030] A processor is used to implement the method steps described when executing the computer program.
[0031] The effects provided in the content of the invention are only the effects of the embodiments, not all the effects of the invention. One of the above technical solutions has the following advantages or beneficial effects:
[0032] The present invention proposes a dead leaf detection method, system and device based on the YOLOv8 model, the method comprising the following steps: obtaining historical images of dead branches and leaves in a target environment, preprocessing the historical image data and then annotating the image data with labels to obtain an image data set; dividing the image data set into a training set and a test set according to a preset ratio; establishing a YOLOv8 model for dead leaf detection, wherein a small target detection layer is set in the YOLOv8 model; the small target detection layer is a detection feature map with a pixel size of 160×160, which is used to detect leaves with a pixel size of 4×4 or more; training the YOLOv8 model with the training set to obtain a trained YOLOv8 model; obtaining an image of leaves to be detected in the target environment, inputting the image of leaves to be detected into the trained YOLOv8 model, obtaining the detection results of dead branches and leaves, and testing the detection results of dead branches and leaves with the test set. Based on a dead leaf detection method based on the YOLOv8 model, a dead leaf detection system and device based on the YOLOv8 model are also proposed. The present invention can achieve high-accuracy dead branches and leaves detection target detection and has a faster reasoning speed, helping to more accurately detect and identify dead branches and leaves that need to be cleaned.
[0033] The YOLOv8 model used in the present invention has multi-scale processing capabilities and can effectively process target objects of different sizes and proportions, thereby enhancing adaptability and flexibility in different scenarios. The YOLOv8 model is a relatively lightweight target detection model with a small model size and low memory usage, and is suitable for use in systems with limited resources. The YOLOv8 model provides a concise training and deployment process, which can quickly train the model and integrate it into the system, lowering the technical threshold and improving the convenience of application. The YOLOv8 model has high real-time performance, can complete target detection tasks in a shorter time, and can respond to environmental changes in a timely manner and take corresponding actions. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 This is a flow chart of a dead leaf detection method based on the YOLOv8 model proposed in Example 1 of the present invention;
[0035] Figure 2 This is a schematic diagram of the YOLOv8 model structure proposed in Example 1 of the present invention;
[0036] Figure 3 A schematic diagram of a dead leaf detection system based on the YOLOv8 model proposed in Example 2 of the present invention;
[0037] Figure 4 This is a schematic diagram of a dead leaf detection device based on the YOLOv8 model proposed in Example 3 of the present invention. DETAILED DESCRIPTION
[0038] In order to clearly illustrate the technical features of the present solution, the present invention is described in detail below through specific implementation methods and in conjunction with the accompanying drawings. The disclosure below provides many different embodiments or examples for realizing different structures of the present invention. In order to simplify the disclosure of the present invention, the components and settings of specific examples are described below. In addition, the present invention may repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed. It should be noted that the components illustrated in the accompanying drawings are not necessarily drawn to scale. The present invention omits the description of known components and processing techniques and processes to avoid unnecessary limitations on the present invention.
[0039] Example 1
[0040] A dead leaf detection method based on the YOLOv8 model proposed in Example 1 of the present invention is used to solve the problems encountered in the dead branch and rotten leaf detection in the prior art.
[0041] Computer image processing technology has become one of the important applications in various fields. Computer image processing technology can be used to process and optimize digital images, improve the quality and clarity of images, and help us extract more useful information from them.
[0042] Figure 1 This is a flow chart of a dead leaf detection method based on the YOLOv8 model proposed in Example 1 of the present invention;
[0043] In step S1, historical images of dead branches and leaves in a target environment are obtained, and it is ensured that the obtained historical images include images of various angles, lighting conditions, and different scenes.
[0044] In step S2, after preprocessing the historical image data, the image data is annotated with labels to obtain an image data set; the image data set is divided into a training set and a test set according to a preset ratio.
[0045] The collected historical images are preprocessed, including image enhancement, size adjustment and other operations, to meet the input requirements for subsequent model training.
[0046] Use LabelImg to annotate the preprocessed historical images with two labels: leave and branch. Change the brightness of the images and add noise. Finally, split the image dataset into a training set and a test set with a ratio of 8:2.
[0047] In step S3, a YOLOv8 model for dead leaf detection is established, in which a small target detection layer is set; the small target detection layer is a detection feature map with a pixel size of 160×160, which is used to detect leaves with a pixel size of more than 4×4; the YOLOv8 model is trained using the training set to obtain a trained YOLOv8 model. Figure 2 This is a schematic diagram of the YOLOv8 model structure proposed in Example 1 of the present invention;
[0048] The YOLOv8 model includes Backbone layer, Neck layer and Head layer;
[0049] The Backbone layer uses the improved lightweight convolutional neural network ShuffleNetV2 as the backbone network for feature extraction; the Backbone layer retains the SP-PF module to solve the problem of repeated feature extraction of images by the convolutional neural network, which speeds up the generation of candidate boxes and saves computing costs.
[0050] The Neck layer retains the PAN-FPN structure and adds the SEnet attention mechanism after the upsample structure to cooperate with the small target detection layer, making the model efficient and fast.
[0051] The head layer retains the decoupled head structure, separating the classification and detection heads, effectively improving the detection accuracy. It uses 4 output branches, but each output branch is divided into two parts, namely classification and regression bounding box. Finally, the model also combines the original data enhancement, feature fusion, loss function, sample matching and module mechanism of YOLOv8. This combination not only ensures the lightweight of the network, but also ensures the detection accuracy, and also reduces the number of parameters and computational complexity of the model, thereby improving the practicality and scalability of the model. In short, the improvement of the original algorithm improves the detection accuracy without losing the detection speed and the degree of model lightweight. This design method can improve the robustness of detection and enhance the model's ability to extract features of the target.
[0052] The YOLOv8 model is used to receive a 640×640 pixel image of leaves to be detected. The original YOLOv8 detection sizes are: feature map pixels of 80×80, used to detect targets with a pixel size of 8×8 or more; feature map pixels of 40×40, used to detect targets with a pixel size of 16×16 or more; feature map pixels of 20×20, used to detect targets with a pixel size of 32×32 or more. However, if the height and width of the target are both less than 8 pixels, the original model may not be able to accurately identify the target feature information within the grid. Therefore, by adding a small target detection layer, that is, adding a detection feature map with a pixel size of 160×160 to the original model, and detecting targets with a pixel size of 4×4 or more, the network can pay more attention to the detection of small target diseased leaves and improve the detection effect.
[0053] During the working process of the YOLOv8 model: the 80×80 scale feature layer of the Backbone end is accumulated with the upsampled feature layer of the Neck end; through C2f, SEnet and Upsample operations, a deep semantic feature layer containing small target feature information is obtained; the deep semantic feature layer is accumulated with the shallow position feature layer in the Backbone to improve the expression ability of the 160×160 pixel fusion feature layer for the semantic features and position information of small targets; the output of the Backbone layer is sent to an additional decoupling head in the Head. Use cross-validation to evaluate the performance of the model and adjust the model or hyperparameters as needed.
[0054] The YOLOv8 model used in the present invention has multi-scale processing capabilities and can effectively process target objects of different sizes and proportions, thereby enhancing adaptability and flexibility in different scenarios. The YOLOv8 model is a relatively lightweight target detection model with a small model size and low memory usage, and is suitable for use in systems with limited resources. The YOLOv8 model provides a concise training and deployment process, which can quickly train the model and integrate it into the system, lowering the technical threshold and improving the convenience of application. The YOLOv8 model has high real-time performance, can complete target detection tasks in a shorter time, and can respond to environmental changes in a timely manner and take corresponding actions.
[0055] In step S4, the image of leaves to be detected in the target environment is obtained.
[0056] In step S5, the leaf image to be detected is input into the trained YOLOv8 model to obtain the detection result of dead branches and leaves, and the detection result of dead branches and leaves is tested using the test set. The dead branches and leaves that need to be cleaned are cleaned according to the detection result of dead branches and leaves.
[0057] Use drones or cameras installed in orchards to collect image data, and input the collected images into a dead branch and leaf detection algorithm. The algorithm automatically identifies the dead branches and leaves in the image and outputs their location information. A cleaning machine (such as a robot or automated vehicle) navigates to the corresponding location based on the location information provided by the algorithm, and the cleaning machine performs the cleaning operation.
[0058] The sanitation vehicle is equipped with a camera to collect images and transmit the collected image data to the dead branches and leaves detection system. The system uses image detection algorithms to identify and locate dead branches and leaves on both sides of the road. The cleaning vehicle navigates to the designated location based on the location information provided by the system and performs the cleaning operation.
[0059] A dead leaf detection method based on the YOLOv8 model proposed in Example 1 of the present invention can achieve high-accuracy dead branch and leaf detection target detection and has a faster reasoning speed, helping to more accurately detect and identify dead branches and leaves that need to be cleaned.
[0060] Example 2
[0061] Based on the dead leaf detection method based on the YOLOv8 model proposed in Example 1 of the present invention, Example 2 of the present invention further proposes a dead leaf detection system based on the YOLOv8 model. Figure 3 A schematic diagram of a dead leaf detection system based on a YOLOv8 model proposed in Example 2 of the present invention; the system includes: a preprocessing module, a model building module and a detection module;
[0062] The preprocessing module is used to obtain historical images of dead branches and leaves in the target environment, and after preprocessing the historical image data, use labels to annotate the image data to obtain an image data set; divide the image data set into a training set and a test set according to a preset ratio;
[0063] The model building module is used to build a YOLOv8 model for dead leaf detection, wherein a small target detection layer is set in the YOLOv8 model; the small target detection layer is a detection feature map with a pixel size of 160×160, which is used to detect leaves with a pixel size of 4×4 or more; the YOLOv8 model is trained using the training set to obtain a trained YOLOv8 model;
[0064] The detection module is used to obtain the leaf image to be detected in the target environment, input the leaf image to be detected into the trained YOLOv8 model, obtain the detection result of dead branches and leaves, and test the detection result of dead branches and leaves using the test set.
[0065] In the preprocessing module: the pictures of dead branches and leaves in the target environment are: pictures of different angles, different lighting conditions and different scenes.
[0066] The image data is annotated with labels as follows: the image data is annotated with leave and branch to change the image brightness.
[0067] In the model building module, the YOLOv8 model is used to receive the 640×640 pixel image of the leaf to be detected.
[0068] The YOLOv8 model includes Backbone layer, Neck layer and Head layer; the Backbone layer uses the improved lightweight convolutional neural network ShuffleNetV2 as the backbone network for feature extraction; the Neck layer retains the PAN-FPN structure, and adds the SEnet attention mechanism after the upsample structure to cooperate with the small target detection layer; the Head layer retains the decoupled head structure to separate the classification and detection heads. The Backbone layer retains the SP-PF module to solve the problem of repeated feature extraction of the convolutional neural network for images.
[0069] During the working process of the YOLOv8 model: the 80×80 scale feature layer of the Backbone end and the upsampling feature layer of the Neck end are accumulated; through C2f, SEnet and Upsample operations, a deep semantic feature layer containing small target feature information is obtained; the deep semantic feature layer is accumulated with the shallow position feature layer in the Backbone to improve the expression ability of the 160×160 pixel fusion feature layer for the semantic features and position information of small targets; the output result of the Backbone layer is sent to an additional decoupling head in the Head.
[0070] After the detection module is executed, the dead branches and leaves that need to be cleaned are cleaned up according to the detection results of the dead branches and leaves.
[0071] A dead leaf detection system based on the YOLOv8 model proposed in Example 2 of the present invention can achieve high-accuracy dead branch and leaf detection target detection and has a faster reasoning speed, helping to more accurately detect and identify dead branches and leaves that need to be cleaned.
[0072] Example 3
[0073] The present invention also proposes a device, Figure 4 A schematic diagram of a dead leaf detection device based on a YOLOv8 model proposed in Embodiment 3 of the present invention includes:
[0074] Memory for storing computer programs;
[0075] The processor is used to implement the following method steps when executing the computer program:
[0076] In step S1, historical images of dead branches and leaves in a target environment are obtained, and it is ensured that the obtained historical images include images of various angles, lighting conditions, and different scenes.
[0077] In step S2, after preprocessing the historical image data, the image data is annotated with labels to obtain an image data set; the image data set is divided into a training set and a test set according to a preset ratio.
[0078] In step S3, a YOLOv8 model for dead leaf detection is established, in which a small target detection layer is set; the small target detection layer is a detection feature map with a pixel size of 160×160, which is used to detect leaves with a pixel size of more than 4×4; the YOLOv8 model is trained using the training set to obtain a trained YOLOv8 model. Figure 2 This is a schematic diagram of the YOLOv8 model structure proposed in Example 1 of the present invention;
[0079] In step S4, the image of leaves to be detected in the target environment is obtained.
[0080] In step S5, the leaf image to be detected is input into the trained YOLOv8 model to obtain the detection result of dead branches and leaves, and the detection result of dead branches and leaves is tested using the test set. The dead branches and leaves that need to be cleaned are cleaned according to the detection result of dead branches and leaves.
[0081] A dead leaf detection device based on the YOLOv8 model proposed in Example 3 of the present invention can achieve high-accuracy dead branch and leaf detection target detection and has a faster reasoning speed, helping to more accurately detect and identify dead branches and leaves that need to be cleaned.
[0082] For the description of the relevant parts of a dead leaf detection device based on a YOLOv8 model provided in Example 3 of the present application, please refer to the detailed description of the corresponding parts of a dead leaf detection method based on a YOLOv8 model provided in Example 1 of the present application, which will not be repeated here.
[0083] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment that includes a series of elements are inherent to the elements. In the absence of more restrictions, the elements limited by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or equipment that includes the elements. In addition, the above-mentioned technical solution provided in the embodiment of the present application is consistent with the corresponding technical solution in the prior art in principle, and the part is not described in detail, so as not to repeat too much.
[0084] Although the above describes the specific implementation of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. For those skilled in the art, other different forms of modifications or deformations can be made on the basis of the above description. It is not necessary and impossible to list all the implementation methods here. On the basis of the technical solution of the present invention, various modifications or deformations that can be made by those skilled in the art without creative work are still within the scope of protection of the present invention.
Claims
1. A dead leaf detection method based on the YOLOv8 model, characterized in that: The following steps are involved: Obtain historical images of dead branches and leaves in the target environment, pre-process the historical image data, and then annotate the image data with labels to obtain an image data set; divide the image data set into a training set and a test set according to a preset ratio; A YOLOv8 model for dead leaf detection is established, wherein a small target detection layer is set in the YOLOv8 model; the small target detection layer is a detection feature map with a pixel size of 160×160, which is used to detect leaves with a pixel size of 4×4 or more; the YOLOv8 model is trained using the training set to obtain a trained YOLOv8 model; Obtain the leaf image to be detected in the target environment, input the leaf image to be detected into the trained YOLOv8 model, obtain the detection result of dead branches and leaves, and test the detection result of dead branches and leaves using the test set.
2. The dead leaves detection method based on the YOLOv8 model according to claim 1, characterized in that: The method further comprises: cleaning the dead branches and leaves that need to be cleaned according to the detection result of the dead branches and leaves.
3. The dead leaf detection method based on the YOLOv8 model according to claim 1, characterized in that: The pictures of dead branches and leaves in the target environment are pictures taken at different angles, under different lighting conditions and in different scenes.
4. The dead leaf detection method based on the YOLOv8 model according to claim 1, characterized in that: The image data is annotated with labels as follows: the image data is annotated with leave and branch to change the image brightness.
5. The dead leaf detection method based on the YOLOv8 model according to claim 1, characterized in that: The YOLOv8 model is used to receive a 640×640 pixel image of leaves to be detected.
6. The dead leaves detection method based on the YOLOv8 model according to claim 5, characterized in that: The YOLOv8 model includes a Backbone layer, a Neck layer and a Head layer; The Backbone layer uses the improved lightweight convolutional neural network ShuffleNetV2 as the backbone network for feature extraction; The Neck layer retains the PAN-FPN structure and adds the SEnet attention mechanism after the upsample structure to cooperate with the small target detection layer; The Head layer retains the decoupled head structure and separates the classification and detection heads.
7. The dead leaves detection method based on the YOLOv8 model according to claim 6, characterized in that: The Backbone layer retains the SP-PF module to solve the problem of repeated feature extraction of images by the convolutional neural network.
8. The dead leaf detection method based on the YOLOv8 model according to claim 7, characterized in that: The YOLOv8 model works as follows: Accumulate the 80×80 scale feature layer on the Backbone side and the upsampled feature layer on the Neck side; Through C2f, SEnet and Upsample operations, a deep semantic feature layer containing small target feature information is obtained; The deep semantic feature layer is accumulated with the shallow position feature layer in Backbone, so as to improve the expression ability of the 160×160 pixel fusion feature layer for the semantic features and position information of small objects; Send the output of the Backbone layer to an additional decoupled head in the Head.
9. A dead leaf detection system based on the YOLOv8 model, characterized in that: It includes a preprocessing module, a model building module and a detection module; The preprocessing module is used to obtain historical images of dead branches and leaves in the target environment, and after preprocessing the historical image data, use labels to annotate the image data to obtain an image data set; divide the image data set into a training set and a test set according to a preset ratio; The model building module is used to build a YOLOv8 model for dead leaf detection, wherein a small target detection layer is set in the YOLOv8 model; the small target detection layer is a detection feature map with a pixel size of 160×160, which is used to detect leaves with a pixel size of 4×4 or more; the YOLOv8 model is trained using the training set to obtain a trained YOLOv8 model; The detection module is used to obtain the leaf image to be detected in the target environment, input the leaf image to be detected into the trained YOLOv8 model, obtain the detection result of dead branches and leaves, and test the detection result of dead branches and leaves using the test set.
10. A device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the method steps according to any one of claims 1 to 8 when executing the computer program.
Citation Information
Cited By
Intelligent environmental sanitation vehicle collaborative scheduling method and system based on cross-modal data
CN120124981A
Vision-based chip placement system and operation method thereof
CN120507640A