Method and device for determining the number of crop plants

By performing the connection domain grading analysis of farmland crop images and using the trained model to calculate the number of crop plants, the problems of time-consuming, labor-intensive and low accuracy in manual statistics in the prior art are solved, and fast and efficient plant counting is achieved.

CN113807139BActive Publication Date: 2025-03-07GUANGZHOU XAIRCRAFT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010538242.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-12
Publication Date
2025-03-07
Estimated Expiration
2040-06-12

AI Technical Summary

Technical Problem

In the prior art, the statistics on the number of farmland crop plants requires a large number of manual or drone photos to be taken for estimation, resulting in time-consuming, labor-intensive and low accuracy.

Method used

By obtaining crop images of the target area, the crop connectivity domain collections in each planting row area in the crop image are determined, and the characteristic information of these connectivity domains is input into the trained connectivity domain hierarchical model for analysis, and the level to which each crop connectivity domain belongs is obtained. Different levels correspond to different plants, and then the total number of plants in each planting row area and target area is calculated.

Benefits of technology

It realizes the rapid and efficient calculation of the number of crop plants, improves the accuracy and efficiency of statistics, and solves the problems of inaccurate and inefficient manual counting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113807139B_ABST
    Figure CN113807139B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for determining the number of crop plants. The method comprises: obtaining a crop image of a target area; determining a set of crop connected domains in each planting row area in the crop image; inputting feature information of each crop connected domain in the crop connected domain set into a connected domain grading model for analysis to obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain grading model is obtained by training multiple groups of data, each group of data comprising: a sample connected domain image and a label for marking the level to which the sample connected domain belongs; determining the number of plants in each planting row area based on the level; and determining the total number of plants in the target area based on the number of plants in each planting row area. The present invention solves the technical problems of inaccurate counting and low efficiency caused by manual counting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of crop identification, and in particular to a method and a device for determining the number of crop plants. Background Art

[0002] In the prior art, when counting the number of crop plants in farmland, a large amount of manpower is generally required to do basic statistics or use drone inspections to count and estimate through photos taken by drones. However, both of the above methods are time-consuming and labor-intensive, prone to human errors, and have low statistical accuracy.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present invention provide a method and device for determining the number of crop plants, so as to at least solve the technical problems of inaccurate counting and low efficiency caused by manual counting.

[0005] According to one aspect of an embodiment of the present invention, a method for determining the number of crop plants is provided, comprising: acquiring a crop image of a target area; determining a set of crop connected domains in each planting row area in the crop image; inputting feature information of each crop connected domain in the crop connected domain set into a connected domain grading model for analysis to obtain a level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain grading model is obtained by training with multiple groups of data, each group of data comprising: a sample connected domain image and a label for marking the level to which the sample connected domain belongs; determining the number of plants in each planting row area based on the level; and determining the total number of plants in the target area based on the number of plants in each planting row area.

[0006] Optionally, before inputting feature information of each crop connected domain in the crop connected domain set into a connected domain grading model for analysis, the method includes: acquiring a sample image; determining the crop connected domain in each planting row area in the sample image; grading the crop connected domain according to preset grading rules to obtain grading results; and marking the crop connected domain based on the grading results to obtain multiple groups of data.

[0007] Optionally, the crop connectivity domain is graded according to preset grading rules to obtain a grading result, including: determining the number of good pixel points in the crop connectivity domain; determining the value range to which the number of pixel points belongs; determining the level corresponding to the value range, and using the determined level as the grading result.

[0008] Optionally, before determining the set of crop connected domains in each planting row area in the crop image, the method includes: extracting the vegetation area from the crop image, generating a first binary map corresponding to the vegetation area, wherein the first binary map is determined based on the vegetation connected domain obtained after screening the connected domain in the vegetation area; determining the main direction of each planting row in the target area; generating a circumscribed rectangle of the first binary image based on the length of each planting row in the target area in the main direction; and establishing a coordinate system with the width of the rectangle as the vertical coordinate and the length direction as the horizontal coordinate; determining the number of non-vegetation pixels in the main direction, and based on the number of non-vegetation pixels, generating a curve in the coordinate system for indicating the distribution of the number of non-vegetation pixels; cutting out the first binary image according to the peak vertex of the curve and the straight lines in the straight line set corresponding to the main direction to obtain the planting row area, wherein the straight lines in the straight line set are used to indicate a set of position points where non-vegetation pixels are located between adjacent planting rows.

[0009] Optionally, determining the main direction of each planting row in the target area includes: performing a Hough transform on the first binary image, and outputting a list of polar coordinate system parameter pairs of the first binary image in the Hough space through a Hough space accumulator; determining the main direction of the crop planting row based on the angle parameters in the polar coordinate system parameter pair list, wherein the polar coordinate system parameter pair list includes at least one polar coordinate system parameter pair, and each polar coordinate system parameter pair includes an angle and a radius.

[0010] Optionally, when the number of polar coordinate parameter pairs in the polar coordinate parameter pair list is greater than a predetermined value, the polar coordinate angle at the first position in the polar coordinate parameter pair list is used as the main direction of the crop planting row; or, when the number of polar coordinate parameter pairs in the polar coordinate parameter pair list is less than a predetermined value, the polar coordinate angle at the first position in the polar coordinate parameter pair list is used as the main direction of the crop planting row.

[0011] Optionally, before cutting the first valued image to obtain the planting row area based on the peak vertices of the curve and the straight lines in the straight line set corresponding to the main direction, it also includes: smoothing the curve to obtain a target curve after smoothing; when the target curve after smoothing includes non-vegetation pixels, offsetting the straight line set so that the target curve does not contain non-vegetation pixels.

[0012] Optionally, determining a set of crop connected domains in each planting row area in the crop image includes: inputting the crop image into a crop recognition model for analysis to obtain the set of crop connected domains.

[0013] Optionally, the crop recognition model and the connected domain classification model are the same machine learning model.

[0014] Optionally, obtaining a crop image of the target area includes: receiving a crop image of the target area taken by a drone.

[0015] According to one aspect of an embodiment of the present invention, another method for determining the number of crop plants is provided, including: acquiring a crop image of a target area; inputting the crop image into a machine learning model for analysis to obtain a set of crop connected domains in each planting row area in the crop image and a level to which each crop connected domain in the set of crop connected domains belongs, wherein different levels correspond to different numbers of plants; determining the number of plants in each planting row area based on the level; and determining the total number of plants in the target area based on the number of plants in each planting row area.

[0016] According to one aspect of an embodiment of the present invention, another method for determining the number of crop plants is provided, including: acquiring a crop image of a target area; determining a set of crop connected domains in each planting row area in the crop image; determining a level to which each crop connected domain in the set of crop connected domains belongs, wherein different levels correspond to different numbers of plants; determining the number of plants corresponding to the level based on the level, and determining the number of plants in each planting row area based on the number of plants; and determining the total number of plants in the target area based on the number of plants in each planting row area.

[0017] According to another aspect of an embodiment of the present invention, a device for calculating the number of crop plants is also provided, including: an acquisition module, used to acquire a crop image of a target area; a first determination module, used to determine a set of crop connected domains in each planting row area in the crop image, inputting feature information of each crop connected domain in the crop connected domain set into a connected domain grading model for analysis, and obtaining the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain grading model is obtained by training with multiple groups of data, each group of data including a sample connected domain image and a label for marking the level to which the sample connected domain belongs; a second determination module, used to determine the number of plants in each planting row area based on the level, and a calculation module, used to determine the total number of plants in the target area based on the number of plants in each planting row area.

[0018] According to another aspect of an embodiment of the present invention, there is also provided an unmanned aerial vehicle, comprising: an image acquisition device, for acquiring a crop image of a target area; a processor, connected to the image acquisition device, for determining a set of crop connected domains in each planting row area in the crop image, inputting feature information of each crop connected domain in the crop connected domain set into a connected domain grading model for analysis, and obtaining a level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain grading model is obtained by training with multiple groups of data, each group of data comprising a sample connected domain image and a label for marking the level to which the sample connected domain belongs, the number of plants in each planting row area is determined based on the level, and the total number of plants in the target area is determined based on the number of plants in each planting row area.

[0019] According to another aspect of an embodiment of the present invention, a spraying operation method is provided, including: a spraying device executes any method for determining the number of crop plants to determine the total number of plants in a target area; the spraying device determines the spraying dosage in the target area based on the total number of plants in the target area.

[0020] According to another aspect of an embodiment of the present invention, a yield estimation method is provided, including: determining the total number of plants in a target area using any method for determining the number of crop plants; and determining the total yield of the target area by the yield of the unit number of plants in the target area and the total number of plants in the target area.

[0021] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is provided, the non-volatile storage medium including a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute any method for determining the number of crop plants.

[0022] According to another aspect of an embodiment of the present invention, a processor is provided, and the processor is used to run a program, wherein when the program is run, any method for determining the number of crop plants is executed.

[0023] In an embodiment of the present invention, a method of recognizing crop images based on a deep learning model is adopted, by acquiring a crop image of a target area; determining a set of crop connected domains in each planting row area in the crop image; inputting feature information of each crop connected domain in the crop connected domain set into a connected domain grading model for analysis, and obtaining a level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain grading model is obtained by training with multiple groups of data, each group of data including: a sample connected domain image and a label for marking the level to which the sample connected domain belongs; determining the number of plants in each planting row area based on the level; and determining the total number of plants in the target area based on the number of plants in each planting row area, thereby achieving the purpose of calculating the number of crop plants, thereby realizing the technical effect of quickly and efficiently obtaining the total number of crop plants, and further solving the technical problems of inaccurate counting and low efficiency caused by manual counting. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0025] Figure 1 is a schematic flow chart of a method for determining the number of crop plants according to an embodiment of the present invention;

[0026] Figure 2 is a schematic diagram of a coordinate system established according to an optional embodiment of the present invention;

[0027] Figure 3 is a schematic diagram of a framework for obtaining a planting row area image according to an optional embodiment of the present invention;

[0028] Figure 4 is a schematic diagram of a framework for smoothing a curve according to an optional embodiment of the present invention;

[0029] Figure 5 is a flow chart of another method for determining the number of crop plants according to an embodiment of the present invention;

[0030] Figure 6 is a schematic structural diagram of a device for calculating the number of crop plants according to an embodiment of the present invention;

[0031] Figure 7 is a schematic structural diagram of a drone according to an embodiment of the present invention;

[0032] Figure 8 is a flow chart of another method for determining the number of crop plants according to an embodiment of the present invention;

[0033] Fig. 9It is a schematic diagram of an optional statistical principle for counting the number of crop plants of the present invention. DETAILED DESCRIPTION

[0034] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 should fall within the scope of protection of the present invention.

[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0036] According to an embodiment of the present invention, an embodiment of a method for determining the number of crop plants is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0037] Figure 1 A method for determining the number of crop plants according to an embodiment of the present invention is as follows: Figure 1 As shown, the method comprises the following steps:

[0038] Step S102, acquiring a crop image of a target area;

[0039] Step S104, determining a set of crop connected domains in each planting row area in the crop image;

[0040] Step S106, inputting feature information of each crop connected domain in the crop connected domain set into a connected domain classification model for analysis, and obtaining the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain classification model is obtained by training multiple sets of data, each set of data including: a sample connected domain image and a label for marking the level to which the sample connected domain belongs;

[0041] Step S108, determining the number of plants in each planting row area based on the level;

[0042] Step S110, determining the total number of plants in the target area based on the number of plants in each planting row area.

[0043] In the above-mentioned method for determining the number of crop plants, first, a crop image of the target area is obtained, and then a set of crop connected domains in each planting row area in the crop image is determined. Secondly, the feature information of each crop connected domain in the crop connected domain set is input into a connected domain classification model for analysis to obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants. The connected domain classification model is obtained by training with multiple groups of data, and each group of data includes: a sample connected domain image and a label for marking the level to which the sample connected domain belongs. Then, the number of plants in each planting row area is determined based on the level. Finally, the total number of plants in the target area is determined based on the number of plants in each planting row area, thereby achieving the purpose of calculating the number of crop plants, thereby realizing the technical effect of quickly and efficiently obtaining the total number of crop plants, and further solving the technical problems of inaccurate counting and low efficiency caused by manual counting.

[0044] It should be noted that the crop image refers to the photo to be counted, in which the number of plants in each planting row area is determined based on the level. The number of crop connected domains in each planting row area can be determined first; then the level to which each crop connected domain belongs can be determined; then, the number of plants in each crop connected domain can be determined based on the level; finally, the number of plants in each planting row area can be determined based on the number of plants.

[0045] In an optional embodiment of the present application, before determining that the feature information of each crop connected domain in the crop connected domain set is input into the connected domain grading model for analysis, the method includes: acquiring a sample image; determining the crop connected domain in each planting row area in the sample image; grading the crop connected domain according to preset grading rules to obtain grading results; and marking the crop connected domain based on the grading results to obtain multiple groups of data.

[0046] In some embodiments of the present application, the crop connectivity domain is graded according to preset grading rules to obtain a grading result. The number of good pixels in the crop connectivity domain can be determined first; the value range to which the number of pixels belongs can be determined; the level corresponding to the value range can be determined, and the determined level can be used as the grading result.

[0047] Specifically, the classification rules are related to the size of the connected domain of the crop, the type of crop, the planting experience, and the growth cycle of the crop. A density function corresponding to each level can be established according to the different levels in the classification. For example, if the number of pixels in the connected domain of a crop in the seedling stage is 200-250, it is marked as a medium level, and the corresponding density is 3 seedlings per hole.

[0048] In some embodiments of the present application, before determining the set of crop connected domains in each planting row area in the crop image, a vegetation area can be extracted from the crop image to generate a first binary image corresponding to the vegetation area, wherein the first binary image is determined based on the vegetation connected domain obtained after screening the connected domains in the vegetation area. Specifically, in an optional embodiment of the present application, a vegetation area is extracted from a regional image, and a first binary image corresponding to the vegetation area is generated. The greenness index of each pixel point in the regional image can be first determined; for each pixel point, the greenness index and the greenness threshold are compared; whether the pixel point is a pixel point in the vegetation area is determined based on the comparison result; the pixel points belonging to the vegetation area are counted, and the first binary image is determined based on the statistical result, specifically, the excess green index (Excess Green Index) is used to calculate the greenness index of each pixel point in the regional image. Taking the super green index as an example, ExG=2*Green–Red–Blue, where the right side of the formula is a pixel value of the three channels G, R, and B. The above formula needs to be normalized and other mathematical processing in actual use. After calculating the super green index, the vegetation area is separated by the threshold. The super green index of the pixel point is greater than or equal to the threshold and is non-zero, and the super green index of the pixel point is less than the threshold and is set to zero. The grayscale value of the non-zero value greater than or equal to the threshold is set to 255, and the grayscale value of the zero value less than the threshold is 0, generating a binary image. It should be noted that the threshold can be set artificially according to the planting area, type, shape and size, planting experience, etc. of the crop, and can also be obtained by the Ostu method.

[0049] In some embodiments of the present application, methods for screening vegetation connected domains include but are not limited to the following methods: artificially set threshold method, statistical screening method, shape screening method, texture screening method, etc.

[0050] Specifically, for example, the vegetation connected domain is screened by the shape screening method. For example, if there is a green truck parked by the side of the field and the crops are apple trees that are approximately circular in shape, it can be determined through geometric analysis that the car does not belong to the vegetation connected domain.

[0051] Specifically, for example, through the statistical screening method, the areas of all connected domains are counted, and the crop area range is determined by methods such as mode and dense interval, and the vegetation connected domains within the area range are retained for screening. For example, the area interval of the vegetation connected domain is [20, 50] (unit / ㎡), then the vegetation connected domains that meet this area interval are retained. For example, the mode of the area of ​​the vegetation connected domain is 30㎡, then the connected domain with an area of ​​30 square meters can be retained.

[0052] It should be noted that in order to improve the accuracy of screening, the above screening methods can be used in combination. For example, if a car parked by the field meets the super green index of the vegetation connectivity domain and its shape is similar to that of the crop, the area range can be further combined to determine whether the vehicle is a vegetation connectivity domain.

[0053] Figure 2 is a coordinate system established according to an optional embodiment of the present invention, such as Figure 2 As shown, a bounding rectangle of the first binary image is generated based on the length of each planting row in the target area in the main direction; and a coordinate system is established with the width direction of the rectangle as the ordinate and the length direction as the abscissa;

[0054] Figure 3 It is a framework schematic diagram of obtaining a planting row area image according to an optional embodiment of the present invention, determining the number of non-vegetation pixels in the main direction, and based on the number of non-vegetation pixels, generating a curve 30 in the coordinate system for indicating the distribution of the number of non-vegetation pixels; according to the peak vertex of the curve and a straight line 32 in a straight line set corresponding to the main direction, cutting the first valued image to obtain the planting row area, wherein the straight lines in the straight line set are used to indicate a set of position points where non-vegetation pixels are located between adjacent planting rows.

[0055] In an optional embodiment of the present application, the main direction of each planting row in the target area can be determined in the following manner: performing a Hough transform on the first binary image, and outputting a list of polar coordinate system parameter pairs of the first binary image in the Hough space through a Hough space accumulator; determining the main direction of the crop planting row based on the angle parameters in the polar coordinate system parameter pair list, wherein the polar coordinate system parameter pair list includes at least one polar coordinate system parameter pair, and each polar coordinate system parameter pair includes an angle and a radius.

[0056] In some embodiments of the present application, when the number of polar coordinate parameter pairs in the polar coordinate parameter pair list is greater than a predetermined value, the polar coordinate angle at the first position in the polar coordinate parameter pair list is used as the main direction of the crop planting row; or, when the number of polar coordinate parameter pairs in the polar coordinate parameter pair list is less than a predetermined value, the polar coordinate angle at the first position in the polar coordinate parameter pair list is used as the main direction of the crop planting row.

[0057] Figure 4 It is a framework diagram for smoothing a curve according to an optional embodiment of the present invention. According to the peak vertices of the curve and the straight lines in the straight line set corresponding to the main direction, the curve 40 can be smoothed before cutting the first valued image to obtain the planting row area to obtain the smoothed target curve 42; when the target curve after smoothing includes non-vegetation pixels, the straight line set is offset so that the target curve does not contain non-vegetation pixels.

[0058] It should be noted that the smoothing method includes but is not limited to denoising after moving average, denoising after LOWESS smoothing, denoising after Univariate Spline fitting, and denoising after Savitzky_Golay Filter smoothing. The denoising situation includes but is not limited to correcting the value of negative numbers after Savitzky_Golay Filter smoothing. The peak vertex and width of the smoothed curve can be calculated using scipy.signal.find_peaks and other similar methods; when the curve before smoothing includes non-vegetation pixels, the straight line set is offset so that the target curve does not include non-vegetation pixels. Specifically, if necessary, the straight line set can be offset left and right within a certain neighborhood range. The trigger condition of the offset can be that there is a horizontal axis point with a cumulative value of zero in the original cumulative curve in the neighborhood. The reason for the offset is that it is possible that after a peak point is smoothed, it is offset from the original true zero point, and its translation is limited. Set an adjacent distance threshold (neighborhood) and search for a point with a cumulative value of zero in the cumulative curve before smoothing in the neighborhood of the peak. In addition, if there is a lack of boundary lines on the left and right sides, you can add boundary lines.

[0059] In an optional embodiment of the present application, determining a set of crop connected domains in each planting row area in a crop image includes: inputting the crop image into a crop recognition model for analysis to obtain a set of crop connected domains.

[0060] In an optional embodiment of the present application, the crop recognition model and the connected domain classification model are the same machine learning model.

[0061] In an optional embodiment of the present application, obtaining a crop image of a target area includes: receiving a crop image of the target area taken by a drone.

[0062] Figure 5 Another method for determining the number of crop plants according to an embodiment of the present invention is as follows: Figure 5 As shown, the method comprises the following steps:

[0063] Step S502, acquiring a crop image of a target area;

[0064] Step S504, determining a set of crop connected domains in each planting row area in the crop image;

[0065] Step S506, determining the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants;

[0066] Step S508, determining the number of plants corresponding to the level based on the level, and determining the number of plants in each planting row area based on the number of plants;

[0067] Step S510, determining the total number of plants in the target area based on the number of plants in each planting row area.

[0068] In the above-mentioned method for determining the number of crop plants, first, a crop image of the target area is obtained; then a set of crop connected domains in each planting row area in the crop image is determined; secondly, the level to which each crop connected domain in the crop connected domain set belongs is determined, wherein different levels correspond to different numbers of plants; then, the number of plants corresponding to the level is determined based on the level, and the number of plants in each planting row area is determined based on the number of plants; finally, the total number of plants in the target area is determined based on the number of plants in each planting row area, thereby achieving the purpose of calculating the number of crop plants, thereby realizing the technical effect of quickly and efficiently obtaining the total number of crop plants, and further solving the technical problems of inaccurate counting and low efficiency caused by manual counting.

[0069] Figure 6 A device for calculating the number of crop plants according to an embodiment of the present invention includes:

[0070] An acquisition module 60, used to acquire a crop image of a target area;

[0071] The first determination module 62 is used to determine the crop connected domain set in each planting row area in the crop image, input the feature information of each crop connected domain in the crop connected domain set into the connected domain classification model for analysis, and obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain classification model is obtained by training multiple groups of data, each group of data includes a sample connected domain and a label for marking the level to which the sample connected domain belongs;

[0072] A second determination module 64 is used to determine the number of plants in each planting row area based on the level;

[0073] The calculation module 66 is used to determine the total number of plants in the target area based on the number of plants in each planting row area.

[0074] The above-mentioned device for calculating the number of crop plants includes an acquisition module 60, which is used to acquire a crop image of a target area; a first determination module 62, which is used to determine a set of crop connected domains in each planting row area in the crop image, and input the characteristic information of each crop connected domain in the crop connected domain set into a connected domain grading model for analysis to obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain grading model is obtained by training with multiple sets of data, each set of data including a sample connected domain and a label for marking the level to which the sample connected domain belongs; a second determination module 64, which is used to determine the number of plants in each planting row area based on the level, and a calculation module 66, which is used to determine the total number of plants in the target area based on the number of plants in each planting row area, thereby achieving the purpose of calculating the number of crop plants, thereby realizing the technical effect of quickly and efficiently obtaining the total number of crop plants, and further solving the technical problems of inaccurate counting and low efficiency caused by manual counting.

[0075] Figure 7 is a drone according to an embodiment of the present invention, such as Figure 7 As shown, the drone includes:

[0076] An image acquisition device 70, used to acquire crop images of a target area;

[0077] The processor 72 is connected to the image acquisition device and is used to determine a set of crop connected domains in each planting row area in the crop image, input feature information of each crop connected domain in the crop connected domain set into a connected domain classification model for analysis, and obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants. The connected domain classification model is obtained by training with multiple groups of data, each group of data includes a sample connected domain image and a label for marking the level to which the sample connected domain belongs. The number of plants in each planting row area is determined based on the level, and the total number of plants in the target area is determined based on the number of plants in each planting row area.

[0078] The image acquisition device 70 of the above-mentioned drone is used to obtain crop images of the target area; the processor 72 is connected to the image acquisition device, and is used to determine the set of crop connected domains in each planting row area in the crop image, and input the characteristic information of each crop connected domain in the crop connected domain set into the connected domain classification model for analysis to obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain classification model is obtained by training with multiple groups of data, each group of data includes a sample connected domain image and a label for marking the level to which the sample connected domain belongs, the number of plants in each planting row area is determined based on the level, and the total number of plants in the target area is determined based on the number of plants in each planting row area, thereby achieving the purpose of calculating the number of crop plants, thereby realizing the technical effect of quickly and efficiently obtaining the total number of crop plants, and further solving the technical problems of inaccurate counting and low efficiency caused by manual counting.

[0079] Figure 8 Another method for determining the number of crop plants according to an embodiment of the present invention is as follows: Figure 8 As shown, the method comprises the following steps:

[0080] S802, acquiring a crop image of a target area;

[0081] S804, inputting the crop image into a machine learning model for analysis, obtaining a set of crop connected domains in each planting row area in the crop image and a level to which each crop connected domain in the set of crop connected domains belongs, wherein different levels correspond to different numbers of plants;

[0082] S806, determining the number of plants in each planting row area based on the level;

[0083] S808: Determine the total number of plants in the target area based on the number of plants in each planting row area.

[0084] In the above embodiment, first, a crop image of the target area is obtained; then, the crop image is input into a machine learning model for analysis to obtain a set of crop connected domains in each planting row area in the crop image and a level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants; secondly, the number of plants in each planting row area is determined based on the level; finally, the total number of plants in the target area is determined based on the number of plants in each planting row area, thereby achieving the purpose of calculating the number of crop plants, thereby realizing the technical effect of quickly and efficiently obtaining the total number of crop plants, and further solving the technical problems of inaccurate counting and low efficiency caused by manual counting.

[0085] Fig. 9 Schematic diagram of an optional statistical principle for counting the number of crop plants of the present invention, such as Fig. 9As shown, the statistical principle mainly includes the following steps:

[0086] First, a large number of photos of farmland are taken from overhead to form a collection of farmland photos. The algorithm is used to extract the area where the vegetation is located in the photo, and all connected domains are screened to keep the connected domain of vegetation and generate a binary map of vegetation. The Hough straight line detection method is used to obtain the main direction of the planting row, and then the circumscribed rectangle of the binary map is generated with the main direction as the width direction. The width of the circumscribed rectangle (main direction) is used as the ordinate and the length direction is used as the abscissa. The number of non-vegetation pixels in the main direction is accumulated to obtain an accumulated curve; the accumulated curve is then smoothed, and the peak vertex of the smoothed curve is calculated. According to the set of straight lines determined by the peak vertex and the main direction, the planting row area of ​​the binary map is cut out. Finally, the connected domains in the planting row area are conditionally screened one by one, and the connected domains that meet the conditions are marked according to the specified feature classification to generate the corresponding crop connected domain label set.

[0087] Then, we obtain a training data set, a test data set, and a validation data set, which store farmland photos and generated crop labels in pairs. Secondly, we train the training data set through a deep network to obtain a deep learning model. The test data set is used to adjust hyperparameters and select the parameters corresponding to the optimal model. The validation data set is used to measure the optimal performance. Finally, we obtain a hierarchical counting model for crop connected domains.

[0088] In order to perform spraying operations more quickly and efficiently, according to another aspect of an embodiment of the present invention, a spraying operation method is also provided. Specifically, the above-mentioned method for determining the number of crop plants is performed using a spraying device. First, the total number of plants in the target area can be determined; then, the spraying device determines the spraying dosage in the target area based on the total number of plants in the target area. For example, when the spraying material is a certain pesticide, the pesticide is generally sprayed at a dosage of 0.5 liters, and 1,000 crop plants can be covered. When the total number of plants in the target area is 10,000, the spraying device should spray 5 liters of pesticide according to the above-mentioned corresponding ratio.

[0089] In order to more accurately estimate the yield of crops in a certain area, according to another aspect of an embodiment of the present invention, a yield estimation method is further provided. Specifically, the total number of plants in the target area can be determined by using any of the above-mentioned methods for determining the number of crop plants; the total yield of the target area is determined by the yield of the unit number of plants in the target area and the total number of plants in the target area. For example, when the crop is corn, the average corn yield of each corn plant can be first determined based on statistical calculations, and then the total number of corn plants in a certain area can be determined by using the above-mentioned method for determining the number of crop plants. Then, the average corn yield of each corn plant can be multiplied by the total number of corn plants in the area to obtain a more accurate yield value.

[0090] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is provided, which includes a stored program, wherein when the program is executed, a device where the non-volatile storage medium is located is controlled to execute any method for determining the number of crop plants.

[0091] Specifically, the non-volatile storage medium is used to store program instructions for executing the following functions to achieve the following functions:

[0092] Acquire a crop image of a target area; determine a set of crop connected domains in each planting row area in the crop image; input feature information of each crop connected domain in the crop connected domain set into a connected domain grading model for analysis to obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain grading model is obtained by training with multiple sets of data, each set of data including: a sample connected domain image and a label for marking the level to which the sample connected domain belongs; determine the number of plants in each planting row area based on the level; and determine the total number of plants in the target area based on the number of plants in each planting row area.

[0093] According to another aspect of an embodiment of the present invention, a processor is provided, and the processor is used to run a program, wherein when the program is run, any method for determining the number of crop plants is executed.

[0094] Specifically, the processor is used to call the program instructions in the memory to implement the following functions:

[0095] Acquire a crop image of a target area; determine a set of crop connected domains in each planting row area in the crop image; input feature information of each crop connected domain in the crop connected domain set into a connected domain grading model for analysis to obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain grading model is obtained by training with multiple sets of data, each set of data including: a sample connected domain image and a label for marking the level to which the sample connected domain belongs; determine the number of plants in each planting row area based on the level; and determine the total number of plants in the target area based on the number of plants in each planting row area.

[0096] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0097] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0098] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0099] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0100] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0101] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0102] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for determining the number of crop plants, characterized in that: include: Acquire a crop image of a target area; Extracting vegetation areas from the crop image, generating a first binary image corresponding to the vegetation area, wherein the first binary image is determined based on the vegetation connected domain obtained after screening the connected domain in the vegetation area; determining the main direction of each planting row in the target area; generating a circumscribed rectangle of the first binary image based on the length of each planting row in the target area in the main direction; and establishing a coordinate system with the width of the rectangle as the ordinate and the length direction as the abscissa; determining the number of non-vegetation pixels in the main direction, and based on the number of non-vegetation pixels, generating a curve in the coordinate system for indicating the distribution of the number of non-vegetation pixels; cutting the first binary image according to the peak of the curve and the straight lines in the straight line set corresponding to the main direction to obtain the planting row area, wherein the straight lines in the straight line set are used to indicate the set of position points where the non-vegetation pixels are located between adjacent planting rows; Determining a set of connected crop domains in each planting row region in the crop image; Inputting feature information of each crop connected domain in the crop connected domain set into a connected domain classification model for analysis to obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain classification model is obtained by training multiple sets of data, each set of data including: a sample connected domain image and a label for marking the level to which the sample connected domain belongs; determining the number of plants in each planting row area based on the level; The total number of plants in the target area is determined based on the number of plants in each planting row area.

2. The method according to claim 1, characterized in that Before determining to input the characteristic information of each crop connected domain in the crop connected domain set into the connected domain classification model for analysis, the method includes: Get a sample image; Determining a connected domain of crops in each planting row region in the sample image; Classifying the crop connected domains according to a preset classification rule to obtain a classification result; The crop connected domains are marked based on the classification results to obtain the multiple groups of data.

3. The method according to claim 2, characterized in that The crop connected domains are classified according to preset classification rules to obtain classification results, including: Determining the number of pixels in the crop connected domain; Determine the value range to which the number of pixels belongs; The level corresponding to the value range is determined, and the determined level is used as the grading result.

4. The method according to claim 1, characterized in that: Determining the main direction of each planting row in the target area includes: Performing a Hough transform on the first binary image, and outputting a list of polar coordinate system parameter pairs of the first binary image in the Hough space through a Hough space accumulator; determining the main direction of the crop planting row based on the angle parameters in the polar coordinate system parameter pair list, wherein the polar coordinate system parameter pair list includes at least one polar coordinate system parameter pair, and each polar coordinate system parameter pair includes an angle and a radius.

5. The method according to claim 4, characterized in that include: When the number of polar coordinate parameter pairs in the polar coordinate parameter pair list is greater than a predetermined value, the polar coordinate angle at the first position in the polar coordinate parameter pair list is used as the main direction of the crop planting row; or When the number of polar coordinate parameter pairs in the polar coordinate system parameter pair list is less than a predetermined value, the polar coordinate angle at the first position in the polar coordinate system parameter pair list is used as the main direction of the crop planting row.

6. The method according to claim 1, characterized in that Before cutting the first binary image to obtain the planting row area according to the peak vertices of the curve and the straight lines in the straight line set corresponding to the main direction, the method further includes: Smoothing the curve to obtain the target curve after smoothing; When the target curve after smoothing includes non-vegetation pixels, the straight line set is offset so that the target curve does not include the non-vegetation pixels.

7. The method according to claim 1, characterized in that Determining a set of crop connected domains in each planting row region in the crop image includes: The crop image is input into a crop recognition model for analysis to obtain the crop connected domain set.

8. The method according to claim 7, characterized in that The crop recognition model and the connected domain classification model are the same machine learning model.

9. The method according to any one of claims 1 to 8, characterized in that Acquire crop images of the target area, including: Receive a crop image of the target area taken by a drone.

10. A method for determining the number of crop plants, characterized in that: include: Acquire a crop image of a target area; Extracting vegetation areas from the crop image, generating a first binary image corresponding to the vegetation area, wherein the first binary image is determined based on the vegetation connected domain obtained after screening the connected domain in the vegetation area; determining the main direction of each planting row in the target area; generating a circumscribed rectangle of the first binary image based on the length of each planting row in the target area in the main direction; and establishing a coordinate system with the width of the rectangle as the ordinate and the length direction as the abscissa; determining the number of non-vegetation pixels in the main direction, and based on the number of non-vegetation pixels, generating a curve in the coordinate system for indicating the distribution of the number of non-vegetation pixels; cutting the first binary image according to the peak of the curve and the straight lines in the straight line set corresponding to the main direction to obtain the planting row area, wherein the straight lines in the straight line set are used to indicate the set of position points where the non-vegetation pixels are located between adjacent planting rows; Inputting the crop image into a machine learning model for analysis, obtaining a set of crop connected domains in each planting row area in the crop image and a level to which each crop connected domain in the set of crop connected domains belongs, wherein different levels correspond to different numbers of plants; determining the number of plants in each planting row area based on the level; The total number of plants in the target area is determined based on the number of plants in each planting row area.

11. A method for determining the number of crop plants, characterized in that: include: Acquire a crop image of a target area; Extracting vegetation areas from the crop image, generating a first binary image corresponding to the vegetation area, wherein the first binary image is determined based on the vegetation connected domain obtained after screening the connected domain in the vegetation area; determining the main direction of each planting row in the target area; generating a circumscribed rectangle of the first binary image based on the length of each planting row in the target area in the main direction; and establishing a coordinate system with the width of the rectangle as the ordinate and the length direction as the abscissa; determining the number of non-vegetation pixels in the main direction, and based on the number of non-vegetation pixels, generating a curve in the coordinate system for indicating the distribution of the number of non-vegetation pixels; cutting the first binary image according to the peak of the curve and the straight lines in the straight line set corresponding to the main direction to obtain the planting row area, wherein the straight lines in the straight line set are used to indicate the set of position points where the non-vegetation pixels are located between adjacent planting rows; Determining a set of connected crop domains in each planting row region in the crop image; Determine the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants; Determining the number of plants corresponding to the level based on the level, and determining the number of plants in each planting row area based on the number of plants; The total number of plants in the target area is determined based on the number of plants in each planting row area.

12. A device for calculating the number of crop plants, characterized in that: include: An acquisition module is used to acquire a crop image of a target area, extract a vegetation area from the crop image, and generate a first binary image corresponding to the vegetation area, wherein the first binary image is determined based on a vegetation connected domain obtained after screening a connected domain in the vegetation area; determine the main direction of each planting row in the target area; generate a circumscribed rectangle of the first binary image based on the length of each planting row in the target area in the main direction; and establish a coordinate system with the width of the rectangle as the ordinate and the length direction as the abscissa; determine the number of non-vegetation pixels in the main direction, and based on the number of non-vegetation pixels, generate a curve in the coordinate system for indicating the distribution of the number of non-vegetation pixels; cut the first binary image according to the peak of the curve and the straight lines in the straight line set corresponding to the main direction to obtain a planting row area, wherein the straight lines in the straight line set are used to indicate a set of position points where the non-vegetation pixels are located between adjacent planting rows; A first determination module is used to determine a set of crop connected domains in each planting row area in the crop image, input feature information of each crop connected domain in the crop connected domain set into a connected domain classification model for analysis, and obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain classification model is obtained by training multiple groups of data, each group of data includes a sample connected domain image and a label for marking the level to which the sample connected domain belongs; A second determination module is used to determine the number of plants in each planting row area based on the level; A calculation module is used to determine the total number of plants in the target area based on the number of plants in each planting row area.

13. A drone, characterized in that: include: An image acquisition device, used for acquiring crop images of a target area; A processor is connected to the image acquisition device, and is used to extract a vegetation area from the crop image and generate a first binary image corresponding to the vegetation area, wherein the first binary image is determined based on a vegetation connected domain obtained after screening the connected domain in the vegetation area; determine the main direction of each planting row in the target area; generate a circumscribed rectangle of the first binary image based on the length of each planting row in the target area in the main direction; and establish a coordinate system with the width of the rectangle as the vertical coordinate and the length direction as the horizontal coordinate; determine the number of non-vegetation pixels in the main direction, and based on the number of non-vegetation pixels, generate a curve in the coordinate system for indicating the distribution of the number of non-vegetation pixels; cut the vegetation area according to the peak of the curve and the straight line in the straight line set corresponding to the main direction. The first binary image is cut to obtain the planting row area, wherein the straight lines in the straight line set are used to indicate the position point set where the non-vegetation pixels are located between adjacent planting rows; the crop connected domain set in each planting row area in the crop image is determined, and the feature information of each crop connected domain in the crop connected domain set is input into the connected domain classification model for analysis to obtain the level to which each crop connected domain in the crop connected domain set belongs, wherein different levels correspond to different numbers of plants, and the connected domain classification model is obtained by training with multiple groups of data, each group of data includes a sample connected domain image and a label for marking the level to which the sample connected domain belongs, the number of plants in each planting row area is determined based on the level, and the total number of plants in the target area is determined based on the number of plants in each planting row area.

14. A spraying method, characterized in that: include: The spraying device performs the method for determining the number of crop plants as described in any one of claims 1 to 11 to determine the total number of plants in the target area; The spraying equipment determines the spraying dosage in the target area according to the total number of plants in the target area.

15. A method for calculating production, characterized in that: include: Determine the total number of plants in the target area using the method for determining the number of crop plants as described in any one of claims 1 to 11; The total yield of the target area is determined by the yield of the units of plants in the target area and the total number of plants in the target area.

16. A non-volatile storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the method for determining the number of crop plants as described in any one of claims 1 to 11.

17. A processor, characterized in that: The processor is used to run a program, wherein the program, when running, executes the method for determining the number of crop plants described in any one of claims 1 to 11.