Method and device for calculating quantity of missing seedlings of field crops and medium
Through the target detection model and preset gap adjustment technology, the problem of inaccurate calculation of the number of missing seedlings in field crops is solved, and accurate calculation of the number of missing seedlings in field crops and precise guidance of replenishing seedlings at the missing points are achieved, improving the accuracy of field management. and efficiency.
Patent Information
- Application Number
- CN202410796293.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-06-19
AI Technical Summary
Traditional seedling shortage statistics of field crops rely on manual field patrols, which lacks accuracy and timeliness. Moreover, the lack of seedling bounding boxes in UAV remote sensing technology lacks prior knowledge, resulting in inaccurate calculation of the number of missing seedlings.
The crop seedling stage images are processed through the target detection model to obtain the bounding boxes of seedlings and missing seedlings, and the bounding boxes of missing seedlings are adjusted based on the preset gaps to avoid overlap and coverage problems and accurately calculate the number of missing seedlings.
It achieves accurate calculation of the number of missing seedlings in field crops, provides precise germination rate and guidance for replenishing missing seedlings, and improves the accuracy and efficiency of field management.
Smart Images

Figure CN118799730A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of agricultural detection technology, and in particular to a method, device and medium for calculating the number of missing seedlings of field crops. Background Art
[0002] The calculation of the number of missing seedlings and the feedback of missing seedling points in the seedling stage after crop sowing are of great guiding significance for field management. Traditional field missing seedling statistics rely on manual field inspections and visual estimation, which are often inaccurate, lack timeliness, and have high labor costs.
[0003] The algorithm combining UAV remote sensing technology and target detection is an effective alternative for field seedling and missing seedling detection. However, the missing seedling bounding box obtained through target detection lacks prior knowledge, and there are problems such as overlapping areas between the seedling bounding box and the missing seedling bounding box, and insufficient coverage of the missing seedling bounding box, which leads to inaccurate calculation of the number of missing seedlings of field crops. At the same time, most studies tend to only stay at the results of missing seedling bounding box detection, and lack feedback on field replanting. Summary of the invention
[0004] The purpose of this application is to provide a method, device and medium for calculating the number of missing seedlings of field crops, which can accurately calculate the number of missing seedlings of field crops, and then provide detailed guidance and evaluation for the calculation of the germination rate of field crops and the filling of missing seedling points.
[0005] To achieve the above objectives, this application provides the following solutions:
[0006] In a first aspect, a method for calculating the number of missing seedlings of field crops is provided, the method comprising:
[0007] Inputting the crop seedling stage image into the target detection model to obtain a bounding box; the bounding box includes a seedling bounding box and a missing seedling bounding box;
[0008] Obtaining an overlapping area between a seedling boundary box and the missing seedling boundary box;
[0009] Based on a preset gap, each target seedling-missing boundary box is determined according to the overlapping area, the upper boundary and the lower boundary of the seedling boundary box; wherein the preset gap is a fixed gap between any two adjacent boundary boxes;
[0010] Along the y-axis direction of the rectangular coordinate system, for each target missing seedling boundary box, adjusting the target height of the target missing seedling boundary box based on the preset gap and the seedling boundary box adjacent to the target missing seedling boundary box; the rectangular coordinate system is established with the width of the boundary box as the x-axis and the height of the boundary box as the y-axis;
[0011] For any adjusted target height of the target missing seedling boundary box, determining the number of missing seedlings in the adjusted target missing seedling boundary box according to the target height and the image seedling spacing;
[0012] The number of missing seedlings of crops in the field is determined according to the number of missing seedlings in all the adjusted target missing seedling boundary boxes.
[0013] In a second aspect, a computer device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for calculating the number of missing seedlings of field crops described in the first aspect.
[0014] In a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the method for calculating the number of missing seedlings of field crops described in the first aspect is implemented.
[0015] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0016] The crop seedling image is processed by the target detection model to obtain the seedling bounding box and the missing seedling bounding box, so as to detect the seedling bounding box and the missing seedling bounding box at the same time. The overlapping area of the seedling bounding box and the missing seedling bounding box is obtained, and based on the preset gap, each target missing seedling bounding box is determined according to the overlapping area and the upper and lower boundaries of the seedling bounding box. In this way, the overlapping area of the seedling bounding box and the missing seedling bounding box is targeted for processing, thereby avoiding the problem in the prior art that the overlapping area of the seedling bounding box and the missing seedling bounding box is ignored due to the lack of prior knowledge of the missing seedling bounding box obtained by the target detection model.
[0017] Along the y-axis direction, for each target missing seedling boundary box, the target height of the target missing seedling boundary box is determined based on the preset gap and the seedling boundary box adjacent to the target missing seedling boundary box, thereby avoiding the situation where the missing seedling boundary box covers insufficient area.
[0018] Finally, according to the target height and the seedling spacing in the image, the number of missing seedlings in each target missing seedling boundary box is accurately determined, and then the number of missing seedlings in each target missing seedling boundary box, that is, the number of missing seedlings of field crops, is obtained more accurately, which provides detailed guidance and evaluation for the calculation of field crop germination rate and seedling filling of missing seedling points. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present application 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 A schematic diagram of a flow chart of a method for calculating the number of missing seedlings of field crops provided in Example 1 of the present application;
[0021] Figure 2 A schematic diagram of the intersection of the overlapping area of the missing seedling boundary box and the seedling boundary box provided in Example 1 of the present application; wherein: Figure 2 (a) is a schematic diagram of three overlapping situations of the overlapping area before segmentation; Figure 2 (b) is a schematic diagram of three situations of the overlapping area after segmentation;
[0022] Figure 3 The schematic diagram of the collinear equation provided in Example 1 of the present application;
[0023] Figure 4 Schematic diagram of calculation of missing seedling number and location of missing seedling points provided in Example 2 of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] The purpose of this application is to provide a method, device and medium for calculating the number of missing seedlings of field crops, aiming to accurately calculate the number of missing seedlings of field crops, and then provide detailed guidance and evaluation for the calculation of the germination rate of field crops and the filling of missing seedling points.
[0026] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0027] Example 1
[0028] like Figure 1 As shown, a method for calculating the number of missing seedlings of field crops in this embodiment includes:
[0029] Step 101: Input the crop seedling image into the target detection model to obtain a bounding box; the bounding box includes a seedling bounding box and a missing seedling bounding box; wherein the crop seedling image is collected along the ridge direction of the field.
[0030] Step 102: Obtain the overlapping area between the seedling boundary box and the missing seedling boundary box.
[0031] Among them, by traversing all seedling boundary boxes and the missing seedling boundary box, it is detected whether they intersect or overlap with any seedling boundary box, that is, the overlapping area.
[0032] In some embodiments, obtaining the overlapping area between the seedling boundary box and the missing seedling boundary box specifically includes: calculating the intersection-and-union ratio of the seedling boundary box and the missing seedling boundary box; determining whether the intersection-and-union ratio is greater than zero to obtain a first result; when the first result is yes, determining that the seedling boundary box and the missing seedling boundary box have the overlapping area; when the first result is no, determining that the seedling boundary box and the missing seedling boundary box do not have the overlapping area.
[0033] The intersection-and-union ratio of the missing seedling boundary box and the seedling boundary box is detected. When the intersection-and-union ratio is greater than 0, there is an intersection or overlap between the missing seedling boundary box and the seedling boundary box, that is, an overlapping area.
[0034] Step 103: Based on a preset gap, each target seedling-missing boundary box is determined according to the overlapping area, the upper boundary and the lower boundary of the seedling boundary box; wherein the preset gap is a fixed gap between any two adjacent boundary boxes.
[0035] Exemplarily, the distance between the upper boundary or the lower boundary of the missing seedling boundary box and the lower boundary or the lower boundary of the adjacent seedling boundary box is a preset gap, represented by d, and d is not greater than 10 pixels.
[0036] In some embodiments, each target missing seedling boundary box is determined according to the overlapping area and the upper and lower boundaries of the seedling boundary box, specifically comprising: when the overlapping area is located at the upper boundary of the missing seedling boundary box, the missing seedling boundary box is segmented by the upper boundary of the missing seedling boundary box and the lower boundary of the seedling boundary box to generate a segmented boundary box, and the segmented boundary box where the seedling boundary box and the missing seedling boundary box still overlap is deleted to determine the target missing seedling boundary box; when the overlapping area is located at the middle area of the missing seedling boundary box, the missing seedling boundary box is segmented by the upper and lower boundaries of the seedling boundary box to generate a segmented boundary box, and the segmented boundary box where the seedling boundary box and the missing seedling boundary box still overlap is deleted to determine the target missing seedling boundary box; when the overlapping area is located at the lower boundary of the missing seedling boundary box, the missing seedling boundary box is segmented by the lower boundary of the missing seedling boundary box and the upper boundary of the seedling boundary box to generate a segmented boundary box, and the segmented boundary box where the seedling boundary box and the missing seedling boundary box still overlap is deleted to determine the target missing seedling boundary box.
[0037] Wherein, when the overlapping area is located at the upper boundary of the missing seedling boundary box, the missing seedling boundary box is segmented by using the upper boundary of the missing seedling boundary box and the lower boundary of the seedling boundary box, and after the segmented boundary box is generated, it also includes: the segmented boundary box includes a first missing seedling frame and a second missing seedling frame. The lower boundary of the first missing seedling frame coincides with the lower boundary of the seedling boundary box, and the upper boundary of the second missing seedling frame coincides with the lower boundary of the seedling boundary box; the upper boundary of the second missing seedling frame is adjusted downward until the gap between the upper boundary of the second missing seedling frame and the lower boundary of the seedling boundary box is a preset gap, and the second missing seedling frame is used as the target missing seedling boundary box.
[0038] Among them, when the overlapping area is located in the middle area of the missing seedling boundary box, the missing seedling boundary box is segmented using the upper and lower boundaries of the seedling boundary box, and after generating the segmented boundary box, it also includes: the segmented boundary box includes a third missing seedling frame, a fourth missing seedling frame and a fifth missing seedling frame, wherein the lower boundary of the third missing seedling frame coincides with the upper boundary of the seedling boundary box; the fourth missing seedling frame coincides with the seedling boundary box; the upper boundary of the fifth missing seedling frame coincides with the lower boundary of the seedling boundary box, the lower boundary of the third missing seedling frame is adjusted upward until the gap with the upper boundary of the seedling boundary box is a preset gap, and the lower boundary of the fifth missing seedling frame is adjusted downward until the gap with the lower boundary of the seedling boundary box is a preset gap; the third missing seedling frame and the fifth missing seedling frame are used as target missing seedling boundary boxes.
[0039] Wherein, when the overlapping area is located at the lower boundary of the missing seedling boundary box, the missing seedling boundary box is segmented using the lower boundary of the missing seedling boundary box and the upper boundary of the seedling boundary box, and after the segmented boundary box is generated, it also includes: the segmented boundary box includes a sixth missing seedling frame and a seventh missing seedling frame. The lower boundary of the sixth missing seedling frame coincides with the upper boundary of the seedling boundary box, and the lower boundary of the seventh missing seedling frame is adjusted upward until the gap between the lower boundary of the seedling boundary box and the upper boundary of the seedling boundary box is a preset gap, and the seventh missing seedling frame is determined as the target missing seedling boundary box.
[0040] It can be understood that when segmenting the missing seedling boundary box, after segmentation according to the upper boundary or the lower boundary, the gap between each segmented missing seedling boundary box is adjusted to the preset gap, and then the missing seedling boundary box in which there is an overlapping area between the seedling boundary box and the missing seedling boundary box is deleted, that is, the first missing seedling frame, the fourth missing seedling frame and the sixth missing seedling frame mentioned above are deleted, so that the gap between the target missing seedling boundary box and the seedling boundary box is the preset gap.
[0041] It is worth noting that in the subsequent process of adjusting the height of the target missing seedling boundary box to the target height, the preset gap will also be used to determine the gap between the newly acquired seedling boundary box and the target missing seedling boundary box as the preset gap. Because the gap between the newly acquired seedling boundary box and the target missing seedling boundary box is far away and there is no overlap with the missing seedling boundary box, it is very easy to be ignored. This application will extend the height of the target missing seedling boundary box for this situation to avoid the problem of insufficient coverage area of the missing seedling boundary box, and prepare for the subsequent accurate calculation of the number of missing seedlings of field crops. .
[0042] Reference Figure 2 ,against Figure 2 (a): ① represents the first case where the overlapping area is located at the upper boundary of the missing seedling boundary box. ② represents the second case where the overlapping area is located in the middle area of the missing seedling boundary box. ③ represents the third case where the overlapping area is located at the lower boundary of the missing seedling boundary box.
[0043] against Figure 2 (b): ① represents the first case where the overlapping area is located at the upper boundary of the missing seedling boundary box, after deleting the seedling boundary box and the missing seedling boundary box, there is still an overlapping segmentation boundary box, and a target missing seedling boundary box is determined, namely the second missing seedling boundary box. ② represents the second case where the overlapping area is located in the middle area of the missing seedling boundary box, after deleting the seedling boundary box and the missing seedling boundary box, there is still an overlapping segmentation boundary box, and two target missing seedling boundary boxes are determined, namely the third missing seedling frame and the fifth missing seedling frame. ③ represents the third case where the overlapping area is located at the lower boundary of the missing seedling boundary box, after deleting the seedling boundary box and the missing seedling boundary box, there is still an overlapping segmentation boundary box, and a target missing seedling boundary box is determined, namely the seventh missing seedling frame.
[0044] In some embodiments, obtaining the target missing seedling border coordinates of the adjusted target missing seedling boundary box specifically includes: presetting the missing seedling boundary box coordinates to the first horizontal coordinate and the first vertical coordinate corresponding to the coordinate point of the upper left corner of the missing seedling boundary box, and the height of the missing seedling boundary box and the width of the missing seedling boundary box.
[0045] For example, the first horizontal coordinate corresponding to the coordinate point of the upper left corner of the missing seedling boundary box is represented by x1, and the first vertical coordinate is represented by y1; the height of the missing seedling boundary box is represented by w1, and the width of the missing seedling boundary box is represented by h1. That is, the coordinates of the missing seedling frame are (x1, y1, w1, h1).
[0046] In some embodiments, the seedling bounding box coordinates are preset to be a second horizontal coordinate and a second vertical coordinate corresponding to a coordinate point of an upper left corner of the seedling bounding box, and a height of the seedling bounding box and a width of the seedling bounding box.
[0047] Exemplarily, the second horizontal coordinate corresponding to the coordinate point of the upper left corner of the seedling boundary box is represented by x2, and the second vertical coordinate is represented by y2; the height of the seedling boundary box is represented by w2 and the width of the seedling boundary box is represented by h2. That is, the target seedling-missing border coordinates are (x2, y2, w2, h2).
[0048] In some embodiments, based on the missing seedling border coordinates, the seedling border coordinates and the preset gap, the target missing seedling border coordinates are determined, and the target missing seedling border coordinates are the third horizontal coordinate and the third vertical coordinate corresponding to the coordinate point in the upper left corner of the target missing seedling border coordinates, and the target height of the target missing seedling border coordinates and the width of the target missing seedling border coordinates; wherein the third horizontal coordinate is determined based on the preset gap, the missing seedling border coordinates and the seedling border coordinates; the third vertical coordinate is determined based on the preset gap, the missing seedling border coordinates and the seedling border coordinates; the target height of the target missing seedling border coordinates is determined based on the preset gap, the missing seedling border coordinates and the seedling border coordinates.
[0049] Exemplarily, the third horizontal coordinate corresponding to the coordinate point of the upper left corner of the target seedling-missing boundary box is represented by x3, and the third vertical coordinate is represented by y3; the height of the target seedling-missing boundary box is represented by w3 and the width of the target seedling-missing boundary box is represented by h3. That is, the coordinates of the target seedling-missing boundary box are (x3, y3, w3, h3).
[0050] Reference Figure 2 Based on the missing seedling border coordinates, the seedling border coordinates and the preset gap, the specific process of determining the target missing seedling border coordinates includes three cases:
[0051] ① When the seedling boundary box is located at the upper boundary of the missing seedling boundary box, such as Figure 2 As shown, x1 and w1 remain unchanged, the preset gap between the upper boundary of the target missing seedling boundary box (i.e., the second missing seedling frame) and the lower boundary of the seedling boundary box is d, then y3 is equal to y2+h2+d, and the height h3 is equal to (y1+h1)-(y2+h2+d)=y1+h1-y2-h2-d, so the adjusted target missing seedling boundary box coordinates (x3, y3, w3, h3) are equal to (x1, y2+h2+d, w1, y1+h1-y2-h2-d).
[0052] ② When the seedling bounding box is located in the middle area of the missing seedling bounding box, such as Figure 2 As shown, there are two target missing seedling boundary boxes, an upper missing seedling boundary box and a lower missing seedling boundary box, namely the third missing seedling box and the fifth missing seedling box.
[0053] When the target missing seedling frame coordinates are the third missing seedling frame coordinates, the x1, y1 and w1 of the third missing seedling frame coordinates remain unchanged, the preset distance between the lower boundary of the third missing seedling frame and the upper boundary of the seedling boundary box is d, then h3 is equal to (y2-d)-y1=y2-d-y1, and the third missing seedling frame coordinates (x3, y3, w3, h3) are equal to (x1, y1, w1, y2-d-y1).
[0054] When the target missing seedling frame coordinates are the fifth missing seedling frame coordinates, the x1 and w1 of the fifth missing seedling frame coordinates remain unchanged, and the preset gap between the upper boundary of the fifth missing seedling frame and the lower boundary of the seedling boundary box is d, then y3 is equal to y2+h2+d, h3 is equal to y1+h1-(y2+h2+d)=y1+h1-y2-h2-d, therefore, the fifth missing seedling frame coordinates (x3, y3, w3, h3) are equal to (x1, y2+h2+d, w1, y1+h1-y2-h2-d).
[0055] ③ When the seedling boundary box is located at the lower boundary of the missing seedling boundary box, Figure 2 As shown, x1, y1 and w1 remain unchanged, the preset gap between the lower boundary of the target missing seedling boundary box (i.e., the seventh missing seedling frame) and the upper boundary of the seedling boundary box is d, then h3 is equal to y2-y1-d, therefore, the adjusted target missing seedling boundary box coordinates (x3, y3, w3, h3) are equal to (x1, y1, w1, y2-y1-d).
[0056] Step 104: Along the y-axis direction of the rectangular coordinate system, for each target missing seedling boundary box, adjust the target height of the target missing seedling boundary box based on the preset gap and the seedling boundary box adjacent to the target missing seedling boundary box; the rectangular coordinate system is established with the width of the boundary box as the x-axis and the height of the boundary box as the y-axis.
[0057] In some embodiments, based on the preset gap and the seedling boundary box adjacent to the target seedling-missing boundary box, the target height of the target seedling-missing boundary box is adjusted, specifically including: obtaining a first seedling boundary box adjacent to the upper boundary of the target seedling-missing boundary box, and a second seedling boundary box adjacent to the lower boundary of the target seedling-missing boundary box; extending the height of the target seedling-missing boundary box upward to the lower boundary of the first seedling boundary box until the gap between the upper boundary of the target seedling-missing boundary box and the lower boundary of the first seedling boundary box is the preset gap; and extending the height of the target seedling-missing boundary box downward to the upper boundary of the second seedling boundary box until the gap between the lower boundary of the target seedling-missing boundary box and the upper boundary of the second seedling boundary box is the preset gap.
[0058] Among them, in order to avoid the problem of insufficient coverage area of the missing seedling boundary box, the gap between the seedling boundary box adjacent to each target missing seedling boundary box and the target missing seedling boundary box is traversed. If the gap is greater than the preset gap, the target height of the target missing seedling boundary box is adjusted to make the missing seedling boundary box cover sufficient area.
[0059] Step 105: for any adjusted target seedling-missing boundary box, determine the number of missing seedlings in the adjusted target seedling-missing boundary box according to the target height and the image seedling spacing.
[0060] In some embodiments, for any adjusted target height of the target missing seedling boundary box, the number of missing seedlings in the adjusted target missing seedling boundary box is determined based on the target height and the image seedling spacing, which also includes: obtaining the ground sampling distance and the field seedling spacing; wherein the ground sampling distance is collected by an unmanned aerial vehicle sensor, and the field seedling spacing is the actual measurement value in the field; and the ratio of the field seedling spacing to the ground sampling distance is used as the image seedling spacing.
[0061] In practical applications, the Ground Sampling Distdnce (GSD) is obtained from the drone sensor. In remote sensing, Geographic Information System (GIS, a technical system for collecting, storing, managing, analyzing and displaying data related to geographic location) and map making, GSD refers to the actual distance between two adjacent pixels on the ground when the sensor acquires the image. The image seedling spacing is calculated by GSD and the known field seedling spacing D1. Among them, GSD can be displayed by the control software during drone acquisition, given by the puzzle software after the drone image is orthophoto-puzzled, or calculated according to the drone sensor parameters and acquisition setting parameters. The field seedling spacing is obtained by the specific setting of the sowing time or field measurement. Image seedling spacing D2 = D1 / GSD.
[0062] In some embodiments, before determining each target missing seedling bounding box, it further includes: obtaining all the segmentation bounding boxes; deleting the segmentation bounding boxes with a height less than the image seedling spacing.
[0063] Among them, when there should be no seedlings in the segmentation bounding box with a height less than the image seedling spacing, which belongs to the misdetection area, removing it can ensure the prediction accuracy of the subsequent missing seedling quantity of field crops.
[0064] In practical applications, traverse the height h1 of all the missing seedling bounding boxes. When h1 < D2, delete the corresponding missing seedling bounding box.
[0065] Step 4: According to the image seedling spacing D2 obtained in Step 3, the number of missing seedlings n in each missing seedling bounding box = h1 / D2, where h1 is rounded down. Accumulate the number of missing seedlings in each missing seedling bounding box to obtain the total number of missing seedlings in the field plot.
[0066] Step 5: Locate the coordinates of n missing seedling points according to the number of missing seedlings in the missing seedling bounding box (x1, y1, w1, h1) obtained in Step 4, so that the missing seedling points are evenly distributed on the symmetry line of the optimized missing seedling bounding box. Then the image coordinates of the i-th missing seedling point are (x1 + w1 / 2, y1 + (h1 - (n - 1)×D2) / 2 + (i - 1)×D2), where 0 < i ≤ n.
[0067] Step 106: Determine the number of missing seedlings of field crops according to the number of missing seedlings of all the adjusted target missing seedling bounding boxes.
[0068] In some embodiments, after determining the number of missing seedlings of field crops according to the number of missing seedlings of all the adjusted target missing seedling bounding boxes, it further includes: for any adjusted target missing seedling bounding box, obtaining the target missing seedling bounding box coordinates of the adjusted target missing seedling bounding box; based on the target missing seedling bounding box coordinates and the number of missing seedlings of the adjusted target missing seedling bounding box, determining the field missing seedling points in the adjusted target missing seedling bounding box and the missing seedling point image coordinates of the field missing seedling points; among them, the missing seedling points are evenly distributed on the symmetry line of the adjusted target missing seedling bounding box; based on the principle of photogrammetry, performing geodetic coordinate transformation on the missing seedling point coordinates to obtain the missing seedling point geographical location coordinates corresponding to each missing seedling point in the total number of missing seedlings in the field, where the principle of photogrammetry includes the collinearity equation principle.
[0069] In practical applications, assuming the camera pitch angle ω, yaw angle roll angle k, according to the attitude parameters of the UAV The image rotation transformation matrix (Formula (1)) can be solved to realize the transformation from the image space coordinate system xyz to the image space auxiliary coordinate system x'y'z' rectangular coordinate system, so that the rotated image space coordinate system is parallel to the object space coordinate system. The image space auxiliary coordinate system of the ground point A is calculated as Formula (2).
[0070] like Figure 3 As shown, in the object space coordinate system XYZ, the ground point A, the image point a in the image space coordinate system x'y'z' and the photography center S (the perspective center of the camera) are on the same straight line. Based on the principle of similar triangles, we can get formula (3). Substitute formula (3) into formula (1) and replace -z' with focal length f. a , the absolute coordinates of the ground point A can be obtained, as shown in formula (4). When the surface of the field is relatively flat, the elevation value Z can be ignored. A According to the image coordinates of the missing seedling point obtained in step 105, the coordinates are substituted into formula (4) as the coordinates of point a to convert the image coordinates of the missing seedling point into the geographic location coordinates of the missing seedling point.
[0071]
[0072]
[0073] In formula (1), R represents the rotation transformation matrix, ω represents the pitch angle, represents the yaw angle, κ represents the roll angle, a1, a2, a3, b1, b2, b3, c1, c2, c3 represent the corresponding elements in the rotation matrix, (X A ,Y A ,Z A ) is the coordinate of ground point A in the object space coordinate system, (X S ,Y S ,Z S ) is the coordinate of the photography center S in the object space coordinate system, (x a ,y a ,z a ) is the coordinate of the image point a in the image space coordinate system, (x a ',y a ',z a ') is the coordinate of image point a in the auxiliary coordinate system of image space, and f is the focal length of the camera.
[0074] The present application includes five stages: seedling-missing area segmentation, bounding box expansion, false detection area removal, seedling-missing number calculation and seedling-missing point location. Based on the existing field drone images and their seedling bounding boxes and seedling-missing bounding boxes, the crop seedling images collected along the ridge direction by the field drone are traversed in the first stage, all seedling-missing bounding boxes and seedling bounding boxes are detected, and the overlapping area of the seedling-missing bounding box and the seedling bounding box is detected. In the second stage, all seedling-missing bounding boxes and their adjacent seedling bounding boxes are traversed, and the target height is expanded along the height direction of the seedling-missing bounding box to obtain the target height, so that the upper and lower boundaries of the seedling-missing bounding box and the upper and lower boundaries of the adjacent seedling bounding box are all preset gaps. In the third stage, the image seedling spacing is converted according to the ground sampling distance and the field seedling spacing, and the seedling-missing bounding box whose height is less than the image seedling spacing is deleted. In the fourth stage, according to the image seedling spacing and the height of the target seedling-missing bounding box, the target height of each target seedling-missing bounding box is divided by the image seedling spacing and then the integer is taken, and the cumulative value is the number of crop seedlings missing in the field. In the fifth stage, the image coordinates of each seedling-missing point are obtained. Then, according to the principle of collinear equations, combined with the internal and external parameters of the camera and the acquisition parameters, the image coordinates are converted into geographic location coordinates. According to the method proposed in this application, the number of missing crop seedlings can be accurately calculated, and the geographic coordinates of the missing seedling points can be given, providing detailed guidance and evaluation for the calculation of field crop germination rate and the replenishment of missing seedlings.
[0075] Example 2
[0076] Reference Figure 4 , provides a method for calculating the number of missing seedlings of field crops, the method comprising the following steps:
[0077] Step 1: Set the drone heading repetition rate to 80%, the drone lateral repetition rate to 80%, the flight speed to 1m / s, and the flight altitude to 12m. Use the DJI Mavic3E drone to collect the color image of the corn at the second leaf stage of the plot to be detected along the ridge direction, with a resolution of 5280×3956. Input the obtained color image into the trained YOLOv8 target detection model for sliding sampling seedling and missing seedling bounding box prediction, and obtain the corn two-leaf color image containing seedling and missing seedling bounding box information. Among them, the representation of the seedling and missing seedling bounding box is (c, x, y, w, h), c is the bounding box category, 0 represents the seedling box, 1 represents the missing seedling box, x and y are the coordinates of the upper left corner of the bounding box, and w and h are the width and height of the bounding box, respectively.
[0078] Step 3: Calculate the intersection-and-union ratio of all missing seedling bounding boxes and seedling bounding boxes, and detect whether there is intersection or overlap between the missing seedling bounding box and the seedling bounding box. When the intersection-and-union ratio is > 0, perform boundary box segmentation and adjustment on the corresponding missing seedling bounding box, and make the upper or lower boundary of the adjusted missing seedling bounding box and the lower or upper boundary of the seedling detection box as close as 5 pixels.
[0079] Step 4: Find the adjacent seedling bounding boxes of all missing seedling bounding boxes on the same ridge direction (i.e., there are intersections or overlaps in the x-axis direction), and adjust the height of the corresponding missing seedling bounding box along the y-axis direction to be 5 pixels away from the adjacent seedling bounding box.
[0080] Step 5: The GSD of the collected drone image is calculated to be 0.33 cm / pixel based on the drone sensor parameters and acquisition setting parameters. The seedling spacing of the collected field is 25 cm, so the image seedling spacing is 75 pixels. Delete the missing seedling boundary box with a height less than 75 pixels.
[0081] Step 6: Calculate the number of missing seedlings in each missing seedling boundary box. Figure 3 The number of missing seedlings in each missing seedling boundary box is 5 and 2 respectively. Therefore, the total number of missing seedlings in the field corresponding to this image is 7.
[0082] Step 7: Locate the missing points according to the number of missing seedlings in each missing seedling frame calculated in step 6. The coordinates of the missing points in the image are: (141, 135), (141, 210), (141, 285), (141, 360), (141, 435), (373, 365), (373, 440).
[0083] Step 8: Based on Python libraries such as osgeo and exifread, read the internal and external parameter information of the drone, and convert the image coordinates into geographic location coordinates based on the collinear equation: (30°19′6.38″N, 119°55′55.82″E), (30°19′6.38″N, 119°55′55.82″E), (30°19′6.38″N, 119°55′55.82″E), (30°19′6.40″N, 119°55′55.82″E), (30°19′6.40″N, 119°55′55.82″E), (30°19′6.40″N, 119°55′55.82″E), (30°19′6.40″N, 119°55′55.78″E), (30°19′6.40″N, 119°55′55.78″E).
[0084] Example 3
[0085] A computer device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for calculating the number of missing seedlings of field crops in Example 1.
[0086] Example 4
[0087] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the method for calculating the number of missing seedlings of field crops in Example 1.
[0088] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0089] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A method for calculating the number of missing seedlings of field crops, characterized in that: The method comprises: Inputting the crop seedling stage image into the target detection model to obtain a bounding box; the bounding box includes a seedling bounding box and a missing seedling bounding box; Obtaining an overlapping area between a seedling boundary box and the missing seedling boundary box; Based on a preset gap, each target seedling-missing boundary box is determined according to the overlapping area, the upper boundary and the lower boundary of the seedling boundary box; wherein the preset gap is a fixed gap between any two adjacent boundary boxes; Along the y-axis direction of the rectangular coordinate system, for each target missing seedling boundary box, adjusting the target height of the target missing seedling boundary box based on the preset gap and the seedling boundary box adjacent to the target missing seedling boundary box; the rectangular coordinate system is established with the width of the boundary box as the x-axis and the height of the boundary box as the y-axis; For any adjusted target height of the target missing seedling boundary box, determining the number of missing seedlings in the adjusted target missing seedling boundary box according to the target height and the image seedling spacing; The number of missing seedlings of crops in the field is determined according to the number of missing seedlings in all the adjusted target missing seedling boundary boxes.
2. The method for calculating the number of missing seedlings of field crops according to claim 1, characterized in that: Determining each target seedling-missing boundary box according to the overlapping area, the upper boundary and the lower boundary of the seedling boundary box, specifically includes: When the overlapping area is located at the upper boundary of the missing seedling boundary box, the missing seedling boundary box is segmented using the upper boundary of the missing seedling boundary box and the lower boundary of the seedling boundary box to generate a segmented boundary box, and the segmented boundary boxes where the seedling boundary box and the missing seedling boundary box still overlap are deleted to determine the target missing seedling boundary box; When the overlapping area is located in the middle area of the missing seedling boundary box, the missing seedling boundary box is segmented using the upper boundary and the lower boundary of the seedling boundary box to generate a segmented boundary box, and the segmented boundary boxes where the seedling boundary box and the missing seedling boundary box still overlap are deleted to determine the target missing seedling boundary box; When the overlapping area is located at the lower boundary of the missing seedling boundary box, the missing seedling boundary box is segmented using the lower boundary of the missing seedling boundary box and the upper boundary of the seedling boundary box to generate a segmented boundary box, and the segmented boundary boxes where the seedling boundary box and the missing seedling boundary box still overlap are deleted to determine the target missing seedling boundary box.
3. The method for calculating the number of missing seedlings of field crops according to claim 2, characterized in that: Before determining the boundary boxes of each target missing seedling, it also includes: Obtain all of the segmentation bounding boxes; Delete the segmentation bounding boxes whose height is less than the image seedling spacing.
4. The method for calculating the number of missing seedlings of field crops according to claim 1, characterized in that: Adjusting a target height of the target missing seedling boundary box based on the preset gap and a seedling boundary box adjacent to the target missing seedling boundary box specifically includes: Acquire a first seedling boundary box adjacent to an upper boundary of the target missing seedling boundary box, and a second seedling boundary box adjacent to a lower boundary of the target missing seedling boundary box; Extending the height of the target missing seedling boundary box upward to the lower boundary of the first seedling boundary box until the gap between the upper boundary of the target missing seedling boundary box and the lower boundary of the first seedling boundary box is the preset gap; And, the height of the target seedling-missing boundary box is extended downward to the upper boundary of the second seedling boundary box until the gap between the lower boundary of the target seedling-missing boundary box and the upper boundary of the second seedling boundary box is the preset gap.
5. The method for calculating the number of missing seedlings of field crops according to claim 1, characterized in that: For any adjusted target height of the target missing seedling boundary box, the number of missing seedlings in the adjusted target missing seedling boundary box is determined according to the target height and the image seedling spacing, wherein the method further includes: Obtaining the ground sampling distance and the field seedling spacing; wherein the ground sampling distance is collected by an unmanned aerial vehicle sensor, and the field seedling spacing is an actual field measurement value; The ratio of the field seedling spacing to the ground sampling distance is used as the image seedling spacing.
6. The method for calculating the number of missing seedlings of field crops according to claim 1, characterized in that: According to the number of missing seedlings of all the adjusted target missing seedling bounding boxes, the number of missing seedlings of crops in the field is determined, and then the following steps are further included: For any adjusted target missing seedlings boundary box, obtaining target missing seedlings frame coordinates of the adjusted target missing seedlings boundary box; Based on the target seedling-missing border coordinates and the number of seedling-missing in the adjusted target seedling-missing border frame, determine the field seedling-missing points in the adjusted target seedling-missing border frame and the seedling-missing point image coordinates of the field seedling-missing points; wherein the seedling-missing points are evenly distributed on the symmetry line of the adjusted target seedling-missing border frame; Based on the principle of photogrammetry, the image coordinates of the missing seedling points are converted into geographic coordinates to obtain the geographical location coordinates of the missing seedling points corresponding to each missing seedling point in the total number of missing seedlings in the field; wherein the principle of photogrammetry includes the principle of collinear equations.
7. The method for calculating the number of missing seedlings of field crops according to claim 6, characterized in that: Obtaining the target missing seedlings border coordinates of the adjusted target missing seedlings border box specifically includes: Preset the missing seedling boundary box coordinates as the first horizontal coordinate and the first vertical coordinate corresponding to the coordinate point of the upper left corner of the missing seedling boundary box, as well as the height of the missing seedling boundary box and the width of the missing seedling boundary box; Presetting the seedling boundary box coordinates to be a second horizontal coordinate and a second vertical coordinate corresponding to a coordinate point at an upper left corner of the seedling boundary box, as well as a height of the seedling boundary box and a width of the seedling boundary box; Based on the missing seedling border coordinates, the seedling border coordinates and the preset gap, the target missing seedling border coordinates are determined; the target missing seedling border coordinates are the third horizontal coordinate and the third vertical coordinate corresponding to the coordinate point in the upper left corner of the target missing seedling border coordinates, as well as the target height of the target missing seedling border coordinates and the width of the target missing seedling border coordinates.
8. The method for calculating the number of missing seedlings of field crops according to claim 1, characterized in that: The obtaining of the overlapping area of the seedling boundary box and the missing seedling boundary box specifically includes: Calculating the intersection-and-union ratio of the seedling bounding box and the missing seedling bounding box; Determine whether the intersection-over-union ratio is greater than zero, and obtain a first result; When the first result is yes, determining that the seedling boundary box and the missing seedling boundary box have the overlapping area; When the first result is no, it is determined that the seedling boundary box and the missing seedling boundary box do not have the overlapping area.
9. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for calculating the number of missing seedlings of field crops as described in any one of claims 1-8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for calculating the number of missing seedlings of field crops as described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Method and system for estimating density of plants in crop seedling stage based on RGB images
CN112614147A
Rice seedling missing calculation method and system based on remote sensing image of unmanned aerial vehicle
CN116994157A
Automatic extraction method for sugarcane seedling missing rate information
CN117422901A
