Deep learning-based targeted removal method and system for weeds in corn field

Through the improved YOLOv8 network and feature focused diffusion pyramid module, the problem of low weed detection accuracy in corn fields is solved, precise weeding in corn fields is achieved, crop yield and safety are improved, and pesticide consumption and environmental pollution are reduced.

CN118608946AInactive Publication Date: 2024-09-06HEBEI AGRICULTURAL UNIV.

Patent Information

Application Number
CN202410655904.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-09-06
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies have problems with low accuracy and serious missed detections in weed detection in corn fields, and traditional methods are time-consuming and labor-intensive, resulting in reduced crop yields and pesticide contamination.

Method used

The improved YOLOv8 network is used to build a recognition model, and the GIoU loss function, C2f_PKIModule and feature focusing diffusion pyramid modules are used for feature extraction and recognition, and industrial cameras are combined to achieve automatic recognition and targeted spraying and weeding.

Benefits of technology

It achieves accurate identification and precise positioning of weeds in corn fields, reduces the amount of pesticides, increases crop yield and quality, and reduces labor costs and environmental pollution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118608946A
    Figure CN118608946A
Patent Text Reader

Abstract

The invention relates to the technical field of agricultural precise plant protection, in particular to a corn field weed targeted removal method and system based on deep learning, and the method comprises the steps: collecting a to-be-weeding image of a seedling stage corn field; the to-be-weeded image is input into a preset recognition model, a corn seedling and weed recognition result is output, the recognition model is obtained based on training of a training set, the training set comprises seedling stage corn field images containing various types of weeds, and the recognition model is constructed through an improved YOLOv8 network; and removing the corn seedlings based on the recognition result, obtaining weed positions, and completing targeted weeding through the weed positions. The method can guide precise spraying and weeding operation of the farmland, reduces the pesticide dosage, and improves the crop yield and quality at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of agricultural precision plant protection, and in particular to a method and system for targeted removal of weeds in corn fields based on deep learning. Background Art

[0002] Corn is easily affected by weeds in the early stages of growth and development. Weeds reproduce quickly and have a short growth cycle. They will compete with crops in the early growth stages for light, water and nutrients. If not controlled in time, it will lead to reduced crop yields and reduced quality of agricultural products.

[0003] With the continuous development of computer vision technology, the application of target detection technology in the agricultural field has gradually become a research hotspot. In agricultural production, weeding is a time-consuming and labor-intensive task, and large-scale spraying of pesticides will cause a series of problems such as environmental pollution and pesticide residues in food. Traditional crop and weed detection methods extract feature information such as color, texture, shape, height, etc. of crops and weeds, and input a combination of one or more features into a feature classifier to achieve classification detection. Manual feature selection and calibration are required, and the selection of features depends on the designer's experience. In addition, due to the influence of various factors such as lighting changes, background noise, and target morphology diversity, it is difficult to design a highly robust feature extraction model.

[0004] Therefore, the weed detection process in corn fields is affected by factors such as severe occlusion, close-up view, overlap, and illumination changes. The existing deep learning network has problems such as low weed detection accuracy and serious missed detection. It is necessary to overcome the above problems and improve the weeding efficiency by improving the corn field weeding method of the deep learning network. Summary of the invention

[0005] The purpose of the present invention is to provide a method and system for targeted weed removal in corn fields based on deep learning, in view of the fact that existing weeding methods cannot meet the needs of agricultural production. The method and system can realize automatic identification and targeted spraying of weeds through industrial cameras, and has the characteristics of accuracy, efficiency and reliability.

[0006] To achieve the above object, the present invention provides the following solutions:

[0007] A method for targeted weed removal in corn fields based on deep learning, comprising:

[0008] Collect images of weeds to be removed in the corn field at the seedling stage;

[0009] Inputting the image to be weeded into a preset recognition model, and outputting corn seedling and weed recognition results, wherein the recognition model is obtained based on training of a training set, the training set includes corn field images at the seedling stage containing multiple types of weeds, and the recognition model is constructed by improving the YOLOv8 network;

[0010] The corn seedlings are removed based on the identification results, and the weed positions are obtained, and targeted weeding is completed through the weed positions.

[0011] Optionally, before training the recognition model based on the training set, the training set is preprocessed, and the preprocessing includes:

[0012] After data cleaning and data enhancement are performed on the corn field images at the seedling stage containing various types of weeds, the corn seedlings and weeds are labeled respectively.

[0013] Optionally, constructing the recognition model by improving the YOLOv8 network includes:

[0014] The YOLOv8 network is used as the basic network, the loss function in the YOLOv8 network is set to the GIoU loss function, the C2f module in the YOLOv8 network is set to the C2f_PKIModule module, and a feature-focused diffusion pyramid module is added to the detection head of the YOLOv8 network.

[0015] Optionally, the GIoU loss function is:

[0016]

[0017]

[0018] Among them, IoU is the IoU loss function, A is the annotation box, B is the prediction box, C is the area closure of the annotation box and the prediction box, and A C The area of ​​the labeled box and the predicted box is enclosed by a rectangular box, and U represents the union of the labeled box and the predicted box.

[0019] Optionally, the C2f_PKIModule module includes: a PKI unit, a CAA unit and a convolution unit; feature extraction is performed through the PKI unit and the CAA unit respectively to obtain a first feature and a second feature, and the first feature and the second feature are merged to obtain a third feature; after adding the first feature to the third feature, a global feature is output through the convolution unit.

[0020] Optionally, the feature-focused diffusion pyramid module includes: an input unit, a deep convolution unit and an output unit, the input unit is used to receive multi-scale input, the deep convolution unit is used to capture cross-scale information of the input based on deep separable convolution, and the output unit is used to fuse the captured cross-scale information and output it.

[0021] Optionally, removing the corn seedlings based on the recognition result and obtaining the weed position includes:

[0022] The corn seedlings in the recognition result are deleted by threshold adjustment, and after deletion, the position coordinates of the weeds are determined by threshold segmentation.

[0023] Optionally, achieving targeted weed control through the weed location comprises:

[0024] measuring the distance between the weeds and the weeding device based on the weed position and generating a control instruction;

[0025] The control instruction controls the weeding device to spray the weeds, thereby completing targeted weeding.

[0026] To further achieve the above-mentioned object, the present invention also provides a corn field weed targeted removal system based on deep learning, comprising: an image acquisition module, a weed recognition module, and a weed removal module;

[0027] The image acquisition module is used to acquire images of weeds to be removed in the corn field during the seedling stage;

[0028] The weed recognition module inputs the image to be weeded into a preset recognition model and outputs corn seedling and weed recognition results, wherein the recognition model is obtained based on training of a training set, the training set includes corn field images at the seedling stage containing multiple types of weeds, and the recognition model is constructed by improving the YOLOv8 network;

[0029] The weed removal module is used to remove the corn seedlings based on the recognition result, obtain the weed positions, and complete targeted weeding through the weed positions.

[0030] The beneficial effects of the present invention are:

[0031] (1) The present invention uses an improved deep learning network to accurately identify and locate weeds in corn fields during the seedling stage, which is beneficial for guiding precise spraying and weed control operations in farmland, reducing the use of pesticides, and improving crop yield and quality.

[0032] (2) Identifying corn seedlings and weeds by labeling automatic learning features can help reduce labor costs, improve work efficiency, and enhance safety.

[0033] (3) The YOLOv8n network is used as the recognition and detection model. Compared with other target detection models such as DETR, EfficientDet, SegNet, etc. for image recognition and detection, it has the advantages of faster detection speed, simple network structure, and efficient multi-scale feature fusion. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0035] Figure 1 This is a flow chart of a method for targeted removal of weeds in corn fields based on deep learning according to an embodiment of the present invention;

[0036] Figure 2 It is a schematic diagram of the union of the predicted box and the real box of the GIoU loss function according to an embodiment of the present invention;

[0037] Figure 3 A schematic diagram of the C2f_PKIModule module structure of an embodiment of the present invention;

[0038] Figure 4 It is a schematic diagram of the structure of a feature-focused diffusion pyramid module according to an embodiment of the present invention;

[0039] Figure 5 A schematic diagram of the structure of a recognition model according to an embodiment of the present invention;

[0040] Figure 6 This is a loss change curve diagram during the training of the recognition model according to an embodiment of the present invention;

[0041] Figure 7 This is a schematic diagram of the structure of a corn field weed targeted removal system based on deep learning according to an embodiment of the present invention. DETAILED DESCRIPTION

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

[0043] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0044] This embodiment provides a method for targeted removal of weeds in corn fields based on deep learning, including:

[0045] Collect images of weeds to be removed in the corn field at the seedling stage;

[0046] The image to be weeded is input into a preset recognition model, and the corn seedling and weed recognition results are output, wherein the recognition model is obtained by training based on a training set, the training set includes corn field images at the seedling stage containing various types of weeds, and the recognition model is constructed by improving the YOLOv8 network;

[0047] Based on the recognition results, the corn seedlings are removed, and the weed locations are obtained, and targeted weeding is completed through the weed locations.

[0048] Furthermore, before training the recognition model based on the training set, the training set is also preprocessed, and the preprocessing includes:

[0049] After data cleaning and data enhancement of corn field images at the seedling stage containing various types of weeds, the corn seedlings and weeds were labeled separately.

[0050] Furthermore, the recognition model is constructed by improving the YOLOv8 network including:

[0051] Take the YOLOv8 network as the base network, set the loss function in the YOLOv8 network as the GIoU loss function, set the C2f module in the YOLOv8 network to the C2f_PKIModule module, and add a feature-focused diffusion pyramid module to the detection head of the YOLOv8 network.

[0052] Among them, the GIoU loss function is:

[0053]

[0054]

[0055] Where IoU is the IoU loss function, A is the annotation box, B is the prediction box, C is the area closure of the annotation box and the prediction box, and A C The area of ​​the labeled box and the predicted box is enclosed by a rectangular box, and U represents the union of the labeled box and the predicted box.

[0056] The C2f_PKIModule module includes: a PKI unit, a CAA unit and a convolution unit; feature extraction is performed through the PKI unit and the CAA unit respectively to obtain a first feature and a second feature, and the first feature and the second feature are fused to obtain a third feature; the first feature is added to the third feature and then the global feature is output through the convolution unit.

[0057] The feature-focused diffusion pyramid module includes: an input unit, a deep convolution unit and an output unit. The input unit is used to receive multi-scale inputs, the deep convolution unit is used to capture cross-scale information of the input based on deep separable convolution, and the output unit is used to fuse the captured cross-scale information and output it.

[0058] Further, corn seedlings are removed based on the recognition results, and weed positions are obtained. Targeted weeding is accomplished through weed positions, including:

[0059] The corn seedlings in the recognition results are deleted by threshold adjustment, and after deletion, the location coordinates of the weeds are determined by threshold segmentation;

[0060] measuring the distance between the weeds and the weed removal device based on the weed position and generating a control instruction;

[0061] The weed control device is controlled by control instructions to spray the weeds, thereby completing targeted weed control.

[0062] This embodiment also provides a corn field weed targeted removal system based on deep learning, including: an image acquisition module, a weed recognition module, and a weed removal module;

[0063] An image acquisition module, used for acquiring images of weeds to be removed in a corn field at the seedling stage;

[0064] The weed recognition module inputs the image to be weeded into a preset recognition model and outputs the corn seedling and weed recognition results, wherein the recognition model is obtained based on the training set, which includes corn field images at the seedling stage containing various types of weeds, and the recognition model is constructed by improving the YOLOv8 network;

[0065] The weed removal module is used to remove corn seedlings based on the recognition results, obtain the weed positions, and complete targeted weeding through the weed positions.

[0066] Combine the following Figure 1-7 The method and system for targeted weed removal in corn fields based on deep learning proposed in this implementation are specifically described as follows: Figure 1 As shown, the method includes:

[0067] Step 1: Collect images of weeds in corn fields: Use industrial cameras to capture images of weeds in corn fields and collect image datasets containing various types of weeds.

[0068] Step 2: Perform data cleaning, image enhancement and image preprocessing on the collected images, and divide them into training set, validation set and test set; data cleaning and data enhancement include rotating, scaling, adjusting brightness and adding random noise to the original images. Image preprocessing includes using the labelimg annotation tool to annotate the corn seedlings and weeds in the image and generate a label file. After completing the collection of weed images in the corn field, the image data and labels are integrated into a data set, and the training set, validation set and test set are divided according to the ratio of 7:2:1.

[0069] Step 3: Input the preprocessed and enhanced image data set into the improved deep learning network, train the improved deep learning network YOLOv8n, and obtain a corn seedling and weed recognition model;

[0070] The deep learning network YOLOv8n improves the deep learning YOLOv8 by replacing the network loss function with the GIoU loss function, replacing the original C2f module with the C2f_PKIModule module in the model backbone network, and adding a feature focusing diffusion pyramid module (Focusing Diffusion Pyramid Network, FDPN) to the network detection head for training and feature extraction. The improved network, that is, the recognition model structure is as follows Figure 5 shown.

[0071] The GIoU loss function has scale invariance and identity, and the specific expression is:

[0072]

[0073]

[0074] Where A is the annotation box, B is the prediction box, and C is the closure of the two regions (in the GIoU loss function, the closure is the smallest rectangle parallel to the coordinate axis that surrounds the two rectangular regions). C Represents the area of ​​both A and B enclosed by a rectangular box, and U represents the union of A and B.

[0075] GIoU is the lower bound of IoU. When the two boxes A and B overlap infinitely, When the distance between A and B approaches infinity, IoU(A,B)=1. Unlike IoU, which only focuses on overlapping areas, GIoU not only focuses on overlapping areas, but also on other non-overlapping areas, which can better reflect the overlap between the two and has a faster convergence speed. The union of the predicted box and the real box of the GIoU loss function is as follows: Figure 2 shown.

[0076] The C2f_PKIModule module improves the C2f module by PKI unit and CAA unit. The PKI unit is used to capture multi-scale texture features, while the CAA unit is used to capture long-range context information. These two units work together to extract adaptive features with local and global context information, thereby improving the performance of target detection. The C2f_PKIModule module structure is as follows: Figure 3 shown.

[0077] The PKI unit is a key component in PKINet, which is used to capture multi-scale texture features. The unit consists of a small convolution kernel for extracting local information and a set of parallel deep convolutions for capturing multi-scale contextual information. The structure of the PKI unit consists of a small convolution kernel, a deep convolution, and a 1x1 convolution. First, the local features are extracted by a small convolution kernel, then the context features are extracted by a series of deep convolutions, and finally the local and context features are fused by a 1x1 convolution to achieve the fusion of local and global features and obtain adaptive features.

[0078] The specific structure of the CAA unit includes the following steps: first, the average pooling operation is used to obtain the local area features, then two depth strip convolutions are used to approximate the standard large convolution kernel depth convolution, and finally, the CAA unit generates an attention weight to capture the contextual dependencies between distant pixels and enhance the central features at the same time.

[0079] The feature focusing diffusion pyramid module (Focusing Diffusion Pyramid Network, FDPN) uses feature focusing and feature diffusion mechanisms to make the features of each scale have detailed context information. It can accept inputs of three scales. It contains an Inception-style deep separable convolution and uses a set of parallel deep convolutions to capture rich information across multiple scales. The diffusion mechanism allows features with rich context information to be diffused to each detection scale. The structure of the feature focusing diffusion pyramid module is as follows: Figure 4 shown.

[0080] Step 4: Input the preprocessed image data set into the improved deep learning network YOLOv8n, train the improved YOLOv8n network, and obtain the recognition model.

[0081] During the training process, the training iteration of the improved YOLOv8n network is set to 2000 rounds, the batch is set to 4, that is, four images are processed in each batch, the width and height of the input image size are both 640 pixels, and lr0 (initial learning rate) is set to 0.01. Through such parameter settings, GPU memory overflow is effectively prevented. Small batch data is conducive to enhancing the learning ability of the model. The loss change curve during identification model training is as follows: Figure 6 shown.

[0082] Step 5: Use the trained recognition model to process and identify the weed images collected by the industrial camera, analyze the weed location, and use threshold adjustment to delete the detected corn seedlings, and then use threshold segmentation to determine the specific coordinate values ​​of the weeds. Compare the threshold segmentation result with the weed recognition accuracy of the recognition model to select the weed coordinates with greater accuracy, and further control the weed removal device to spray drugs for targeted weed removal.

[0083] Specifically, the weeding device of this embodiment includes a nozzle, a solenoid valve and a stepper motor. The distance between the weeds and the weeding device is measured according to the selected weed coordinates, and a control instruction is generated. The stepper motor is driven and the solenoid valve is controlled through the control instruction, and then the nozzle is controlled to spray the weeds, thereby completing targeted weeding.

[0084] like Figure 7 As shown, the system includes: an image acquisition module, a weed recognition module, and a weed removal module;

[0085] The image acquisition module is used to acquire the images of weeds to be removed in the corn field at the seedling stage. The image acquisition module in this embodiment adopts an industrial camera.

[0086] The weed recognition module inputs the image to be weeded into a preset recognition model and outputs the corn seedling and weed recognition results. The recognition model is obtained based on the training set, which includes corn field images in the seedling stage containing various types of weeds. The recognition model is constructed by improving the YOLOv8 network.

[0087] The weed removal module is used to remove corn seedlings based on the recognition results, obtain the weed positions, and complete targeted weeding through the weed positions.

[0088] Furthermore, the weed removal module includes a control unit, a motor drive unit, and a steering gear unit. The control unit is used to measure the distance between the weeds and the weed removal device based on the weed position and generate a control instruction. The weed removal device of this embodiment includes a nozzle, a solenoid valve and a stepper motor; the motor drive unit is used to drive the stepper motor based on the control instruction, and the steering gear unit is used to control the on and off time of the solenoid valve based on the control instruction, thereby controlling the nozzle to spray pesticides.

[0089] In this embodiment, the weed image collected by the industrial camera is processed and identified in the recognition model, the weed position is analyzed, the position of the nozzle is adjusted after the laser radar distance measurement, and converted into a corresponding control instruction, which is sent to the stepper motor fixed on the weeding device. The pulse instruction drives the stepper motor to rotate and drives the nozzle to rotate. At the same time, an instruction is sent to the solenoid valve to make the solenoid valve turn on and off for 0-1 second, and the nozzle sprays pesticides to achieve precise and quantitative spraying.

[0090] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.

Claims

1. A method for targeted removal of weeds in corn fields based on deep learning, characterized in that: include: Collect images of weeds to be removed in the corn field at the seedling stage; Inputting the image to be weeded into a preset recognition model, and outputting corn seedling and weed recognition results, wherein the recognition model is obtained based on training of a training set, the training set includes corn field images at the seedling stage containing multiple types of weeds, and the recognition model is constructed by improving the YOLOv8 network; The corn seedlings are removed based on the identification results, and the weed positions are obtained, and targeted weeding is completed through the weed positions.

2. The method for targeted removal of weeds in corn fields based on deep learning according to claim 1, characterized in that: Before training the recognition model based on the training set, the training set is preprocessed, and the preprocessing includes: After data cleaning and data enhancement are performed on the corn field images at the seedling stage containing various types of weeds, the corn seedlings and weeds are labeled respectively.

3. The method for targeted removal of weeds in corn fields based on deep learning according to claim 1, characterized in that: The recognition model is constructed by improving the YOLOv8 network, including: The YOLOv8 network is used as the basic network, the loss function in the YOLOv8 network is set to the GIoU loss function, the C2f module in the YOLOv8 network is set to the C2f_PKIModule module, and a feature-focused diffusion pyramid module is added to the detection head of the YOLOv8 network.

4. The method for targeted removal of weeds in corn fields based on deep learning according to claim 3, characterized in that: The GIoU loss function is: Among them, IoU is the IoU loss function, A is the annotation box, B is the prediction box, C is the area closure of the annotation box and the prediction box, and A C The area of ​​the labeled box and the predicted box is enclosed by a rectangular box, and U represents the union of the labeled box and the predicted box.

5. The method for targeted removal of weeds in corn fields based on deep learning according to claim 3, characterized in that: The C2f_PKIModule module includes: a PKI unit, a CAA unit and a convolution unit; feature extraction is performed through the PKI unit and the CAA unit respectively to obtain a first feature and a second feature, and the first feature and the second feature are merged to obtain a third feature; after adding the first feature to the third feature, a global feature is output through the convolution unit.

6. The method for targeted removal of weeds in corn fields based on deep learning according to claim 3, characterized in that: The feature-focused diffusion pyramid module includes: an input unit, a depth convolution unit and an output unit. The input unit is used to receive multi-scale inputs, the depth convolution unit is used to capture cross-scale information of the inputs based on depth-separable convolution, and the output unit is used to fuse the captured cross-scale information and output it.

7. The method for targeted removal of weeds in corn fields based on deep learning according to claim 1, characterized in that: Removing the corn seedlings based on the recognition result and obtaining the weed position includes: The corn seedlings in the recognition result are deleted by threshold adjustment, and after deletion, the position coordinates of the weeds are determined by threshold segmentation.

8. The method for targeted removal of weeds in corn fields based on deep learning according to claim 1, characterized in that: Targeted weed control accomplished by the weed location includes: measuring the distance between the weeds and the weed removal device based on the weed position and generating a control instruction; The control instruction controls the weeding device to spray the weeds, thereby completing targeted weeding.

9. A deep learning-based targeted weed removal system for corn fields, used to implement the deep learning-based targeted weed removal method for corn fields as described in any one of claims 1 to 8, characterized in that: include: Image acquisition module, weed recognition module, weed removal module; The image acquisition module is used to acquire images of weeds to be removed in the corn field during the seedling stage; The weed recognition module inputs the image to be weeded into a preset recognition model and outputs corn seedling and weed recognition results, wherein the recognition model is obtained based on training of a training set, the training set includes corn field images at the seedling stage containing multiple types of weeds, and the recognition model is constructed by improving the YOLOv8 network; The weed removal module is used to remove the corn seedlings based on the recognition result, obtain the weed positions, and complete targeted weeding through the weed positions.

Citation Information

Patent Citations

  • Crop seedling and weed detection method and system based on deep learning

    CN111340141A

  • Weed rice identification method and system based on deep learning

    CN116912681A

  • Corn crop row identification method based on Faster-YOLOv8s network

    CN117036861A

  • Accurate visual weeding method for cotton field

    CN117522968A

Cited By

  • Vegetable field weed model construction and detection method based on improved yov8 network

    CN119229283A