Method for identifying weeds in crop planting area
By performing data augmentation of weed pictures and training on YOLO v5 algorithms, weed recognition model is generated, which solves the problem that manual inspections consume a lot of manual and difficult to identify weeds in time, and realizes efficient weed recognition and removal in crop planting areas.
Patent Information
- Application Number
- CN202411606115.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-02-25
AI Technical Summary
In the prior art, weed identification in crop planting areas mainly relies on manual inspections, which consumes a lot of labor, is easy to miss, and it is difficult to detect and identify weeds in a timely manner on a large scale, resulting in missing the opportunity to remove and affecting crop growth.
By collecting weed pictures and enhancing them for data processing, the YOLO v5 algorithm is trained to obtain a weed recognition model, and the model is used to identify the crop planting area pictures.
It has achieved timely detection and identification of weeds grown in crop planting areas on a large scale, ensuring that they can be removed in time and avoiding serious impacts on crop growth.
Smart Images

Figure CN119516380A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of methods for identifying weeds in crop planting areas, and specifically relates to a method for identifying weeds in crop planting areas. Background Art
[0002] Weeds often grow in crop planting areas, such as pigweed, sowwort, wild oats, veronica and prickly lettuce, which compete with crops for fertilizer, water and sunlight, seriously affecting the growth of crops. Therefore, it is necessary to remove the weeds growing in the crop planting areas in a timely manner.
[0003] To remove weeds growing in crop planting areas, you first need to identify the weeds growing in the crop planting areas, and then you can remove them in a targeted manner.
[0004] At present, weeds growing in crop planting areas are mostly identified by manual inspection. This method consumes a lot of manpower and is prone to omissions. It is difficult to ensure that weeds growing in crop planting areas can be discovered and identified in a timely manner over a large area, and the opportunity for removal is missed, which can easily seriously affect crop growth.
[0005] This application is proposed in view of the above-mentioned technical defects.
[0006] It should be noted that the disclosure of the above background technology content is only used to assist in understanding the inventive concept and technical solution of the present invention, and it does not necessarily belong to the prior art of this patent application. In the absence of clear evidence that the above content has been disclosed on the filing date of this application, the above background technology should not be used to evaluate the novelty and creativity of the present application. Summary of the invention
[0007] The purpose of the present application is to provide a method for identifying weeds in a crop-growing area to overcome or alleviate at least one of the known technical deficiencies.
[0008] The technical solution of this application is:
[0009] A method for identifying weeds in a crop planting area, comprising:
[0010] Step 1: Collect weed pictures;
[0011] Step 2: Perform data enhancement processing on the weed image;
[0012] Step 3: Use weed pictures to train the YOLO v5 algorithm to obtain a weed recognition model;
[0013] Step 4: Collect pictures of crop planting areas and use weed recognition models to identify weeds.
[0014] Optionally, in the above-mentioned method for identifying weeds in a crop planting area, in step 1, weed pictures are collected, including pictures of Clerodendrum sphaerocephalum, Artemisia selengensis, Oats australis, Veronica officinalis, and Eupatorium truncatum.
[0015] Optionally, in the above-mentioned method for identifying weeds in a crop planting area, in step 2, data enhancement processing is performed on the weed image, including:
[0016] Rotate the weed image, specifically 90°, 180°, and 270° counterclockwise;
[0017] Flip the weed image horizontally;
[0018] Add noise to the weed image, including Gaussian noise, salt and pepper noise, and scattered noise.
[0019] Optionally, in the above-mentioned method for identifying weeds in a crop planting area, in step three, 80% of the weed images are randomly used for training, 10% of the weed images are used for testing, and 10% of the weed images are used for verification.
[0020] Optionally, in the above-mentioned method for identifying weeds in crop planting areas, in step three, the network structure of the YOLO v5 algorithm model includes an input layer, a backbone layer, a network layer, and a detection layer.
[0021] Optionally, in the above-mentioned method for identifying weeds in crop planting areas, in step three, in the network structure of the YOLO v5 algorithm model, the backbone layer and the network layer extract and fuse features of the weed image, and pass the feature image of the weed image to the detection layer for weed identification.
[0022] Optionally, in the above-mentioned method for identifying weeds in crop planting areas, in step three, in the network structure of the YOLO v5 algorithm model, an anchor box is used in the feature image of the weed image output by the network layer, and GIOU is used as the loss function for bounding box training.
[0023] Optionally, in the above-mentioned method for identifying weeds in crop planting areas, in step 3, in the network structure of the YOLO v5 algorithm model, the loss function GIOU is:
[0024]
[0025] in,
[0026] I O U is the intersection area of the predicted box and the real box;
[0027] A c is the minimum enclosed area of the predicted box and the true box;
[0028] U is the area of the region in the closure region that does not belong to the predicted box or the true box.
[0029] This application has at least the following beneficial technical effects:
[0030] A method for identifying weeds in a crop planting area is provided. By collecting weed pictures, performing data enhancement processing on the weed pictures, and training a YOLO v5 algorithm, a weed identification model is obtained. Then, the weed identification model can be used to identify weeds in pictures of crop planting areas to determine whether weeds grow in the crop planting areas. The method can timely detect and identify weeds growing in crop planting areas over a large range, remove the weeds growing in the crop planting areas, and avoid serious impact on crop growth. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a schematic diagram of a method for identifying weeds in a crop planting area provided in an embodiment of the present application;
[0032] Figure 2 It is a schematic diagram of the network structure of the YOLO v5 algorithm model provided in an embodiment of the present application;
[0033] Figure 3 is a schematic diagram of a weed picture provided in an embodiment of the present application;
[0034] Figure 4 Schematic diagram of a weed picture with feature extraction provided in an embodiment of the present application.
[0035] In order to better illustrate this embodiment, some contents of the drawings may be omitted, which is only used for exemplary description and should not be construed as a limitation of this patent. DETAILED DESCRIPTION
[0036] In order to make the technical solution and advantages of the present application clearer, the technical solution of the present application will be further described in detail in detail and in detail in conjunction with the accompanying drawings. It can be understood that the specific embodiments described here are only partial embodiments of the present application, which are only used to explain the present application, not to limit the present application. It should be noted that, for the convenience of description, only the parts related to the present application are shown in the accompanying drawings, and other related parts can refer to the general design. In the absence of conflict, the embodiments in the present application and the technical features in the embodiments can be combined with each other to obtain new embodiments.
[0037] In addition, unless otherwise defined, the technical terms or scientific terms used in the description of this application shall be the common meanings understood by the general technicians in the field to which this application belongs. The words "upper", "lower", "left", "right", "center", "vertical", "horizontal", "inside", "outside" and other words indicating orientation used in the description of this application are only used to indicate the relative direction or positional relationship, and do not imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation. When the absolute position of the described object changes, its relative positional relationship may also change accordingly, so it cannot be understood as a limitation on this application. The "first", "second", "third" and similar terms used in the description of this application are only used for descriptive purposes to distinguish different components, and cannot be understood as indicating or implying relative importance. The similar words "one", "one" or "the" used in the description of this application should not be understood as an absolute limitation on quantity, but should be understood as the existence of at least one. The similar words "including" or "comprising" used in the description of this application mean that the elements or objects appearing in front of the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects.
[0038] In addition, it should be noted that, unless otherwise clearly specified and limited, the words "installed", "connected", "connected" and similar terms used in the description of this application should be understood in a broad sense. For example, the connection can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, an indirect connection through an intermediate medium, or the internal connection of two components. Technical personnel in the field can understand their specific meanings in this application according to the specific circumstances.
[0039] A method for identifying weeds in a crop planting area, such as Figure 1 shown.
[0040] Step 1: Collect pictures of weeds.
[0041] Collect pictures of pigweed, sophora japonica, wild oats, veronica, and thorny lettuce. You can collect them from the Internet or by taking pictures.
[0042] Step 2: Perform data enhancement on the weed image.
[0043] The weed image can be rotated, for example, 90°, 180°, or 270° counterclockwise.
[0044] Flip the weed image horizontally.
[0045] Add noise to the weed image, for example, you can add an appropriate amount of Gaussian noise, salt and pepper noise, or scattered noise.
[0046] The image annotation tool Labelmg can be used to manually annotate the path, width and height, number of channels, and location information of crop and weed annotation boxes of weed images and store them in PASCAL VOC format.
[0047] Step 3: Use weed pictures to train the YOLO v5 algorithm to obtain a weed recognition model.
[0048] Data augmentation processing of weed images can increase the data for YOLO v5 algorithm training and promote the efficient and accurate weed recognition model.
[0049] Randomly use 80% of the weed pictures for training, 10% of the weed pictures for testing, and 10% of the weed pictures for validation.
[0050] The core idea of the YOLO v5 algorithm is to divide the image into multiple grids and use a separate neural network on each grid to predict the bounding box and category of the target object through reverse propagation. The network structure of the YOLO v5 algorithm model includes the input layer (Input), the backbone layer (Backbone), the network layer (Neck), and the detection layer (Detect). Figure 2 shown.
[0051] The backbone layer and network layer extract and fuse the features of the weed images, and pass the feature images of the weed images to the detection layer for weed recognition.
[0052] The anchor box is used in the feature picture of the weed picture output by the network layer, and GIOU is used as the loss function for bounding box training:
[0053]
[0054] in,
[0055] I O U is the intersection area of the predicted box and the real box;
[0056] A c is the minimum enclosed area of the predicted box and the true box;
[0057] U is the area of the region in the closure region that does not belong to the predicted box or the true box.
[0058] In a specific example, a weed image such as Figure 3 As shown, the feature-extracted weed pictures are as follows Figure 4 shown.
[0059] Step 4: Collect pictures of crop planting areas and use weed recognition models to identify weeds.
[0060] A rotating camera or a drone with a camera can be used to collect pictures of the crop planting area at a certain frequency.
[0061] The weed recognition model can be used to identify the presence of weeds in images of crop planting areas, and then determine the type and quantity of weeds.
[0062] The method for identifying weeds in crop planting areas disclosed in the above embodiment collects weed pictures, performs data enhancement processing on the weed pictures, and then trains the YOLO v5 algorithm to obtain a weed identification model. The weed identification model can then be used to identify weeds in crop planting area pictures to determine whether weeds have grown in the crop planting area. The method can timely detect and identify weeds grown in crop planting areas over a large range, remove the weeds grown in the crop planting areas, and avoid serious impact on crop growth.
[0063] So far, the technical solution of the present application has been described in conjunction with the preferred embodiments shown in the accompanying drawings. Those skilled in the art should understand that the scope of protection of the present application is obviously not limited to these specific embodiments. Without departing from the principles of the present application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the scope of protection of the present application.
Claims
1. A method for identifying weeds in a crop planting area, characterized in that: include: Step 1: Collect weed pictures; Step 2: Perform data enhancement processing on the weed image; Step 3: Use weed pictures to train the YOLO v5 algorithm to obtain a weed recognition model; Step 4: Collect pictures of crop planting areas and use weed recognition models to identify weeds.
2. The method for identifying weeds in a crop planting area according to claim 1, characterized in that: In step one, collect pictures of weeds, including pictures of pigweed, sowwort, wild oats, veronica, and prickly lettuce.
3. The method for identifying weeds in a crop planting area according to claim 2, characterized in that: In step 2, data enhancement processing is performed on the weed image, including: Rotate the weed image, specifically 90°, 180°, and 270° counterclockwise; Flip the weed image horizontally; Add noise to the weed image, including Gaussian noise, salt and pepper noise, and scattered noise.
4. The method for identifying weeds in a crop planting area according to claim 3, characterized in that: In step 3, 80% of the weed images are randomly used for training, 10% of the weed images are used for testing, and 10% of the weed images are used for verification.
5. The method for identifying weeds in a crop planting area according to claim 4, characterized in that: In step three, the network structure of the YOLO v5 algorithm model includes input layer, backbone layer, network layer, and detection layer.
6. The method for identifying weeds in a crop planting area according to claim 1, characterized in that: In step 3, in the network structure of the YOLO v5 algorithm model, the backbone layer and the network layer extract and fuse the features of the weed image, and pass the feature image of the weed image to the detection layer for weed recognition.
7. The method for identifying weeds in a crop planting area according to claim 6, characterized in that: In step 3, in the network structure of the YOLO v5 algorithm model, the anchor box is used in the feature image of the weed picture output by the network layer, and GIOU is used as the loss function for bounding box training.
8. The method for identifying weeds in a crop planting area according to claim 7, characterized in that: In step 3, in the network structure of the YOLO v5 algorithm model, the loss function GIOU is: in, I O U is the intersection area of the predicted box and the real box; A c is the minimum enclosed area of the predicted box and the true box; U is the area of the region in the closure region that does not belong to the predicted box or the true box.