A method and system for extracting field flight paths based on seedling row segmentation

By establishing a diversified data set in corn fields and using Local-SegNeXt network for seedling strip segmentation, the region of interest is extracted adaptively and the improved sampling consistency fitting route method is adopted, the accuracy and efficiency of corn crop row detection in complex environments is solved, and more efficient agricultural machinery navigation is achieved.

CN119723110BActive Publication Date: 2025-06-10JILIN AGRICULTURAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411857765.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-06-10
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

In complex field layouts and natural environments, accurate detection of corn crop rows to navigate autonomous vehicles presents great challenges, the accuracy of prior art is limited by the quality of manual labeling data, and the semantic segmentation network has limited feature extraction capabilities for multiple adjacent polygonal regions of interest across the entire image.

Method used

The field route extraction method based on seedling belt segmentation was adopted. By establishing a diversified data set and using edge fitting strategy for data annotation, the seedling belt segmentation was used for local-SegNeXt network, the region of interest was adaptively extracted, and the navigation route was extracted using an improved sampling consistency fitting route method.

Benefits of technology

It improves the accuracy and efficiency of corn crop row detection, enhances the model's adaptability to agricultural machinery navigation in complex environments, reduces the amount of calculation and improves the ability of real-time navigation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119723110B_ABST
    Figure CN119723110B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for extracting field flight paths based on seedling band segmentation, which relates to the technical field of image recognition, and includes: establishing a diversified dataset of corn fields and performing data annotation using an edge-fitting strategy annotation method; using the Local-SegNeXt network to segment the seedling bands, where the Local-SegNeXt network uses multi-scale convolutional attention as the encoder and constructs a Local module to refine local semantic feature extraction and enhance the perception of seedling band image features; adaptively extracting the region of interest, determining the seedling band region according to the crop row instance segmentation result, and using an adaptive algorithm to eliminate redundant labels, only retaining the crop rows required for navigation as the region of interest; using an improved sampling consensus fitting flight path method to extract the navigation line, using the gradient direction to constrain the samples randomly selected in the RANSAC algorithm to find a set of high-quality inliers, and then determining the center line of the current lane. The present invention finds the high-quality center points in the ROI region to fit the navigation line and provides reliable flight path information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and particularly to a method and system for extracting field flight paths based on seedling band segmentation. Background Art

[0002] The planting and management of corn rely on frequent and accurate field reconnaissance to timely provide field information such as crop growth, pests and diseases, and weeds, and to formulate effective management strategies. In modern agriculture, autonomous navigation is a prerequisite for agricultural machinery to autonomously obtain field information. Due to the rapid development of computer vision and the cost-effectiveness of vision sensors, vision-based field autonomous navigation methods have become an alternative to laser or GPS methods and have been widely studied by scholars. However, extracting corn crop rows faces great challenges in various scenarios such as similar colors between weeds and crops, complex field layouts, and the unpredictability of the natural environment. Therefore, accurately detecting crop rows is crucial for guiding autonomous driving vehicles to drive correctly in farmland and completing daily tasks such as spraying pesticides and fertilizing.

[0003] Deep learning methods can accurately identify and extract crop row information, and object detection and semantic segmentation are two commonly used technical means. Although the object detection method performs well in extracting crop row information, the number of crops in each picture is large, and the manual labeling process is quite time-consuming. Moreover, using the center point of the detection box as the feature point required for flight path fitting, its accuracy is largely limited by the quality of the manually labeled data. To alleviate this burden, existing research has explored semantic segmentation methods that only label crop rows to reduce the amount of data annotation required and save time. The center point obtained by extracting the crop row through the mask can provide a greater tolerance for individual deviations. However, the convolutional operation in the semantic segmentation network calculates local regions of the image, which limits the network's ability to extract features of multiple adjacent polygon regions of interest such as seedling bands that span the entire image. Therefore, it needs to be optimized to meet the navigation requirements of agricultural machinery in complex environments.

[0004] After extracting the center point based on the crop row segmentation results, the straight line fitting method is used to obtain the best navigation line for agricultural machinery to track in the field. Common straight line fitting methods include Hough transform, least squares method, random sample consistency, etc. Among them, Hough transform has a large amount of calculation and is not suitable for real-time crop row detection. Least squares method is a commonly used mathematical optimization method, but its accuracy is easily affected in the absence of plants or uneven crop density, and the generated straight line is often close to the area with high planting density. Random sample consistency is a robust parameter estimation method, which is usually used to remove outliers in visual features or point cloud matching. However, this method randomly selects samples, which makes the algorithm have more iterations. In addition, when the proportion of outliers is large, the instability is low, and a model with large errors will be generated, sacrificing the timeliness of the algorithm and failing to meet the real-time requirements of agriculture. Summary of the invention

[0005] The technical solution of the present invention to solve the above technical problem is to provide a field route extraction method based on seedling strip segmentation, comprising the following steps:

[0006] Step 1: Establish a diversified corn field dataset and use the edge fitting strategy annotation method to annotate the data;

[0007] Step 2: Use the Local-SegNeXt network to segment the seedling belt. The Local-SegNeXt network uses multi-scale convolutional attention as an encoder and constructs a Local module to refine the local semantic feature extraction and enhance the perception of the seedling belt image features;

[0008] Step 3: Adaptively extract the region of interest, determine the seedling belt area based on the crop row instance segmentation results, and use an adaptive algorithm to remove redundant labels, leaving only the crop rows required for navigation as the region of interest;

[0009] Step 4: Use the improved sampling consistency fitting route method to extract the navigation line, use the gradient direction to constrain the randomly selected samples in the RANSAC algorithm, find a set of high-quality internal points, and then determine the center line of the current lane.

[0010] Furthermore, in step 1, the edge fitting strategy labeling method is as follows: a polygonal area fitting the edge of the image is drawn based on the center line of the seedling strip, the entire crop row is marked as a whole, and the extended area of ​​the crop row within the field of view is marked in the case of missing seedlings or broken rows.

[0011] Furthermore, in step 2, the Local-SegNeXt network uses multi-scale convolutional attention (MSCA) as the encoder, which mainly consists of three parts: a depth convolution for aggregating local information, a multi-branch depth strip convolution for capturing multi-scale context, and a 1×1 convolution for simulating the relationship between different channels; the strip convolution can effectively extract strip-shaped feature information, making it more suitable for the seedling strip segmentation task.

[0012] Furthermore, in step 3, the specific steps for adaptively extracting the region of interest are as follows:

[0013] Contour scanning: The image obtained after network segmentation is in binary format, and the labels are all closed polygons, which are used to record the boundary information of the seedling strip. Introduce a quantity NBD for recording the boundary hierarchy relationship and initialize it to 1; use a kernel with 0 on the left and 1 on the right, start from the upper left corner of the image, and traverse the entire image from left to right and top to bottom; the first point that meets the kernel during the traversal is the starting point of the outer boundary of the geometric body.

[0014] Boundary tracking: Query the 8-neighborhood clockwise from the starting point of the outer boundary, add the non-zero pixel points found to NBD to determine the tracking direction; then find new boundary points counterclockwise, mark and update the found new boundary points as new boundary points, and repeat this process until returning to the starting boundary point; in each boundary tracking loop, the NBD value is increased by 1 to distinguish different levels of boundaries. For compressing the elements in the horizontal, vertical, and diagonal directions, only keep the end coordinates in that direction, so as to extract all the seedling strip contour information segmented by the Local-SegNeXt network.

[0015] Retain the bottom intersection area: If an edge of the seedling strip contour overlaps with the bottom of the image, retain the label area; mark the label areas that do not intersect with the bottom of the image as the background; according to the collected data, the retained labels in the processed image are {1, 2, 3, 4}. Due to the limitations of the camera shooting angle and height, the number of seedling strips intersecting with the bottom of the picture generally does not exceed 4.

[0016] Determine the region of interest: If the number of labels is 1 or 2, the label area is directly used as the region of interest; if the number of labels is greater than 2, further distinguish: if the number of labels is odd, select the middle label area as the region of interest; if the number of labels is even, select the two middle label areas as the region of interest.

[0017] Furthermore, in step 4, the RANSAC algorithm includes:

[0018] Construct a straight line model of the seedling center line y = ax + b; the initial value of the data set for line fitting is set to 2, that is, only the first two points with the best fitting results are used as the initial value; let the gradient direction of point 1 be G 1 , and the gradient direction of point 2 be G 2 . If two randomly selected points are on the same straight line, the absolute value of the difference in the gradient directions of the two points should be less than the custom threshold T. Use these two points to calculate the straight line model, and use the average value of the gradient directions of these two points as the main direction Y of the gradient direction of the straight line g ;

[0019] Traverse the remaining points. If the following two conditions of the formula are satisfied at the same time, determine it as an inlier:

[0020] |G i - Y g | < T;

[0021]

[0022] where G_i is the gradient direction of a certain point, T is the custom threshold, D_i is the distance from the point (y_i, x_i) to the straight line, and a, b are the slope and intercept of the straight line;;

[0023] Define the threshold k; randomly select 20 samples from each ROI of the data set, and a total of 100 samples are obtained; count the inlier ratio, with an average value of 0.83 and a minimum value of 0.75; set k to 0.78 to balance the samples between the average value and the conservative lower limit of its minimum value;

[0024] Based on the prior probability P, calculate the iteration termination number n to improve the fitting accuracy. The calculation method is as follows:

[0025]

[0026] where the prior probability P is usually set to 0.99, which ensures that the probability of at least one successful sampling is 99%. Therefore, the best model can be obtained in no more than 5 iterations.

[0027] To solve the above technical problems, the present invention also proposes a system for implementing the above method, including:

[0028] A data acquisition and annotation module for establishing a diversified data set of corn fields and performing annotation using an edge fitting strategy;

[0029] A seedling band segmentation module that segments the seedling band using the Local-SegNeXt network;

[0030] A region of interest extraction module for adaptively extracting the crop rows required for navigation as the region of interest;

[0031] The route fitting module uses an improved sampling consensus algorithm to extract the navigation line.

[0032] Compared with the prior art, the advantages of the present invention are as follows:

[0033] (1) This application constructs a corn crop dataset in a multi-stage complex environment, proposes an edge fitting annotation strategy to improve the model segmentation speed, and realizes efficient crop row segmentation in the case of serious crop row breaks.

[0034] (2) This application proposes a crop segmentation method. By introducing strip convolution to extract seedling strip features and constructing local position encoding to eliminate the interference of complex backgrounds and inter-row weeds, the robustness of the model is enhanced.

[0035] (3) This application selects the navigation area by adaptively extracting the region of interest (ROI), eliminating the need to further plan different crop row positioning points in the post-processing step, greatly reducing the computational amount, and making it more suitable for real-time navigation.

[0036] (4) This application uses the gradient direction to constrain the randomly selected samples in the RANSAC algorithm, finds the high-quality center points in the ROI area to fit the navigation line, provides reliable route information, and provides strong guidance for field tillage, fertilization and other operations. Description of the Drawings

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on the structures shown in these drawings.

[0038] Figure 1 It is a schematic structural diagram of the field route extraction method based on seedling strip segmentation according to the present invention;

[0039] Figure 2 It is a dataset construction diagram of the present invention;

[0040] Figure 3 It is a Local-SegNeXt network architecture diagram of the present invention;

[0041] Figure 4 It is a pseudo-code diagram of the adaptive interest algorithm of the present invention;

[0042] Figure 5 It is a diagram of the crop route extraction results at different corn growth stages of the present invention. Detailed Embodiments

[0043] The present invention proposes a field route extraction method based on seedling strip segmentation, aiming to design a field route extraction method based on seedling strip segmentation which can improve reliable route information.

[0044] The field route extraction method based on seedling strip segmentation proposed by the present invention will be described in the following specific embodiments:

[0045] In the technical solution of this embodiment, Figure 1 As shown, a field route extraction method based on seedling strip segmentation includes the following steps:

[0046] Step 1: Establish a diversified corn field dataset and use the edge fitting strategy annotation method to annotate the data;

[0047] Step 2: Use the Local-SegNeXt network to segment the seedling belt. The Local-SegNeXt network uses multi-scale convolutional attention as an encoder and constructs a Local module to refine the local semantic feature extraction and enhance the perception of the seedling belt image features;

[0048] Step 3: Adaptively extract the region of interest, determine the seedling belt area based on the crop row instance segmentation results, and use an adaptive algorithm to remove redundant labels, leaving only the crop rows required for navigation as the region of interest;

[0049] Step 4: Use the improved sampling consistency fitting route method to extract the navigation line, use the gradient direction to constrain the randomly selected samples in the RANSAC algorithm, find a set of high-quality internal points, and then determine the center line of the current lane.

[0050] Furthermore, in step 1, the edge fitting strategy labeling method is as follows: a polygonal area fitting the edge of the image is drawn based on the center line of the seedling strip, the entire crop row is marked as a whole, and the extended area of ​​the crop row within the field of view is marked in the case of missing seedlings or broken rows.

[0051] Specifically, the edge-fitting labeling strategy is to draw a polygonal area that fits the edge of the image based on the center line of the seedling strip, following the general trend of the extension direction of the crop row stripes to achieve overall labeling of the entire crop row. In the case of missing seedlings or broken rows, labeling the extended area of ​​the crop row in the field of view helps the model better understand the continuity of the crop row.

[0052] Furthermore, in step 2, the Local-SegNeXt network uses multi-scale convolutional attention (MSCA) as the encoder, which mainly consists of three parts: deep convolution that aggregates local information, multi-branch deep strip convolution that captures multi-scale context, and 1×1 convolution that simulates the relationship between different channels; strip convolution can effectively extract strip feature information, making it more suitable for seedling segmentation tasks.

[0053] Specifically, the Local module is constructed as a local semantic feature extraction module of the Local-SegNeXt model, and multi-level features are gradually aggregated through the pooling layer to refine the seedling belt contour features.

[0054] Furthermore, in step 3, the specific steps of adaptively extracting the region of interest are:

[0055] Contour scanning: The image obtained after network segmentation is in binary format, and the labels are all closed polygons, which are used to record the boundary information of the seedling belt. A quantity NBD that records the boundary hierarchy relationship is introduced and initialized to 1; a kernel with 0 on the left and 1 on the right is used to traverse the entire image from left to right and from top to bottom starting from the upper left corner of the image; the first point that meets the kernel found during the traversal process is the starting point of the outer boundary of the geometric body;

[0056] Boundary tracing: Query the 8-neighborhood clockwise from the starting point of the outer boundary, and use the non-zero pixel points + NBD found to determine the tracing direction; then search for new boundary points counterclockwise, mark and update the new boundary points found as new boundary points, and repeat this process until returning to the starting boundary point; in each boundary tracing cycle, the NBD value increases by 1 to distinguish boundaries at different levels. For elements in the compressed horizontal, vertical, and diagonal directions, only the end point coordinates in that direction are retained, thereby extracting all the seedling strip contour information segmented by the Local-SegNeXt network;

[0057] Keep the bottom intersection area: If one edge of the seedling strip outline overlaps with the bottom of the image, keep the label area; mark the label area that does not intersect with the bottom of the image as background; according to the collected data, the labels retained in the processed image are {1,2,3,4}. Due to the camera shooting angle and height restrictions, the number of seedling strips that intersect with the bottom of the image is generally no more than 4;

[0058] Determine the region of interest: If the number of labels is 1 or 2, the label region is directly used as the region of interest; if the number of labels is greater than 2, further distinction is made: if the number of labels is an odd number, the middle label region is selected as the region of interest; if the number of labels is an even number, the two middle label regions are selected as the regions of interest.

[0059] Specifically, the adaptive region of interest extraction is based on the edge fitting labeling strategy. It can automatically remove redundant labels according to the position of the camera above the machine, and only retain the crop rows required for navigation as the region of interest. For route extraction based on crop rows, only the seedling belt area needs to be selected as the ROI. For route fitting based on lanes, it is necessary to simultaneously retain two seedling belt segmentation areas adjacent to the lanes for guiding the machine.

[0060] Further, in step 4, the RANSAC algorithm includes:

[0061] Construct a straight line model of the seedling center line y = ax + b; the initial value of the data set for line fitting is set to 2, that is, only the first two points with the best fitting results are used as the initial value; let the gradient direction of point 1 be G 1 , and the gradient direction of point 2 be G 2 , if two randomly selected points are on the same straight line, the absolute value of the difference in the gradient directions of the two points should be less than the custom threshold T, use these two points to calculate the straight line model, and use the average value of the gradient directions of these two points as the main direction Y of the gradient direction of the straight line g ;

[0062] Traverse the remaining points. If the following two conditions of the formula are satisfied at the same time, determine it as an inlier:

[0063] |G i - Y g | < T;

[0064]

[0065] where G_i is the gradient direction of a certain point, T is the custom threshold, D_i is the distance from the point (y_i, x_i) to the straight line, and a and b are the slope and intercept of the straight line;

[0066] Define a threshold k; randomly select 20 samples from each ROI of the data set, and a total of 100 samples are obtained; count the inlier ratio, with an average value of 0.83 and a minimum value of 0.75; set k to 0.78 to balance the samples between the average value and the conservative lower limit of its minimum value;

[0067] Based on the prior probability P, calculate the iteration termination number n to improve the fitting accuracy. The calculation method is as follows:

[0068]

[0069] where the prior probability P is usually set to 0.99, which ensures that the probability of at least one successful sampling is 99%. Therefore, the best model can be obtained in no more than 5 iterations.

[0070] To solve the above technical problems, the present invention also proposes a system for implementing the above method, including:

[0071] A data acquisition and annotation module for establishing a diverse data set of corn fields and performing annotation using an edge fitting strategy;

[0072] A seedling belt segmentation module that uses the Local-SegNeXt network to segment the seedling belt;

[0073] The region of interest extraction module is used to adaptively extract the crop rows required for navigation as the region of interest;

[0074] The route fitting module uses an improved random sample consensus algorithm to extract the navigation line.

[0075] Example 1:

[0076] A method for extracting field routes based on seedling band segmentation, comprising the following steps:

[0077] Step 1: Establish a diversified dataset of corn fields, as Figure 2 shown. In the experiment, a self-made platform with a fixed D435i depth camera was used to take RGB images of corn in the experimental field of Jilin Agricultural University in Changchun, Jilin Province (longitude: 125.41, latitude: 43.81, corn row spacing 60 cm) to establish a corn image database. These images were taken on June 2, 2024 (the first stage, average height 15 cm), June 17, 2024 (the second stage, average height 30 cm), July 1, 2024 (the third stage, average height 45 cm), and July 20, 2024 (the fourth stage, average height 60 cm). The camera was installed at the top of the platform, about 1.5 m above the ground, and the shooting angle range was 45 degrees below the horizontal plane. By optimizing the camera position and angle, it was avoided to capture too many crop rows, which would increase the calculation time, or the crop rows were too short, resulting in too large a deviation of the center line. The platform was pushed forward at a speed of about 0.8 m per second, thus generating a stable video sequence, which was extracted into images at a speed of 5 frames per second. The image resolution was 1920×1080 pixels and saved in JPG format. These images covered various scenarios, times, and different growth stages of corn rows, with a total of 7,200 images.

[0078] Deep learning methods can provide accurate pixel segmentation results. However, the leaves of the crop canopy have characteristics such as divergence, intersection, and asymmetry, which cause great interference to the extraction of the crop canopy row detection line. For irregularly shaped corn plants, a large amount of labeled data is required for training. Therefore, in the process of making the semantic segmentation dataset, polygons were drawn on the images along the upper and lower edges of each crop row to achieve the overall marking of the entire crop row. This method can maintain the continuous annotation of the crop row even in the case of missing seedlings, and solve the problem of inaccurate route extraction in the broken row area. In addition, it is still necessary to manually set the corresponding post-processing algorithm to determine how to plan different crop row regions by detecting the center points of each instance. This strategy can distinguish different crop rows, so that crops from other rows will not interfere with the center line fitting of the current crop row line. The research marked 7,200 images and divided them into three subsets for training, validation, and testing, with the allocated proportions being 0.7, 0.2, and 0.1 respectively.

[0079] In step 2, while performing global airspace information modeling, local coding information is strengthened to improve the perception of seedling belt image features. At the same time, the Attention module is stacked as (2, 1, 3, 2) to have smaller model parameters and floating-point computation amounts. The architecture of the Local-SegNeXt network is as Figure 3 shown. Among them, the Local block is a refined local semantic feature extraction module of the Local-SegNeXt model, which gradually aggregates multi-level features through the pooling layer to refine the seedling belt contour features. First, the features output by the MSCA module are used as the input of the Local block after batch normalization, and the features are dimension-reduced through 1×1 convolution to reduce the computational complexity. Then, parallel max-pooling operations are introduced, and their receptive field sizes are all set to 5×5, avoiding problems such as image distortion caused by image processing operations, and at the same time solving the problem of duplicate features extracted by the convolutional neural network from the picture. Through the bottom-up connection, the pooled feature map is added and fused with the feature map of its upper layer to enhance the local information localization ability of the deep features and alleviate the problem of easy loss of detail information in the deep feature map. In this cross-level connection feature fusion process, 3×3 convolution operations are used for each scale feature map extracted by pooling to provide a more comprehensive and rich feature representation for the network. In addition, skip connection lines are added between the module input and the deep features, and the shallow feature map containing rich semantic information is added and fused with the pooled feature map to further increase the utilization of the bottom layer information, so that the output nodes of the network can retain the important information of the shallow edges to a greater extent. Finally, the output dimension of the module is adjusted through 1×1 convolution. The constructed Local module enhances the complementarity between different feature maps, can capture local detail information at the same time, and helps the network to comprehensively understand the image content, which is crucial for accurate segmentation of the seedling belt in different environments.

[0080] The specific training process of the segmentation network model is explained as follows:

[0081] The constructed dataset is input into the model for training. The learning rate is set to 0.01 and dynamically adjusted using the PolyLR strategy. SGD is used as the optimizer. The training process involves 100 iterations, with a batch size of 4, a momentum of 0.9, and a weight decay of 0.0005. For the actually collected maize seedling belt dataset, there is a problem of uneven data distribution caused by annotation conditions, where the positive sample (seedling belt) area is small while the negative sample (background) area is large. This imbalance may cause the model to be biased towards the more numerous samples during training, thus neglecting the learning of the smaller positive samples. To solve this problem, Focal loss is adopted as the loss function of the model, which can assign higher weights to positive samples during training to enhance the model's attention to positive samples, thereby optimizing the training effect of the model and improving the segmentation ability for minority samples.

[0082] Step 3, an overview of the algorithm process of the adaptive region of interest (ROI) extraction method is as Figure 4 shown. Redundant labels are automatically removed, and only the crop rows required for navigation are retained as the region of interest. Regression fitting is applied to the pixel points within the region of interest to determine the navigation line of the robot. For the extraction of the route based on crop rows, only the seedling belt region needs to be selected as the ROI. For the route fitting based on lanes, two seedling belt segmentation regions adjacent to the lane need to be retained simultaneously to guide the machine to drive. The specific steps of the adaptive ROI extraction scheme are as follows:

[0083] Contour scanning: The image obtained after network segmentation is in binary format, and the labels are all closed polygons. To record the boundary information of the seedling belt, a quantity NBD for recording the boundary hierarchical relationship is introduced and initialized to 1. Using a kernel with 0 on the left and 1 on the right, starting from the upper left corner of the image, the entire image is traversed from left to right and from top to bottom. The first point that meets the kernel during the traversal is the starting point of the outer boundary of the geometric body.

[0084] Boundary tracking: First, query the 8-neighborhood clockwise from the starting point of the outer boundary, add NBD to the non-0 pixel points found to determine the tracking direction. Then, find new boundary points counterclockwise, mark the found new boundary points (+NBD) and update them as new boundary points, and repeat this process until returning to the starting boundary point. In each boundary tracking loop, the NBD value is increased by 1 to distinguish boundaries at different levels. For compressing elements in the horizontal direction, vertical direction, and diagonal direction, only the end coordinates in that direction are retained, so as to extract all the seedling belt contour information segmented by the Local-SegNeXt network.

[0085] Retain the bottom intersection area: If one side of the seedling belt contour overlaps with the bottom of the image, retain the label area. Mark the label areas that do not intersect with the bottom of the image as the background. According to the collected data, the retained labels in the processed image are {1, 2, 3, 4}. Due to the limitations of the camera shooting angle and height, the number of seedling belts intersecting with the bottom of the picture generally does not exceed 4.

[0086] Determine the region of interest: If the number of labels is 1 or 2, these label areas are directly used as the region of interest. If the number of labels is greater than 2, further distinguish: If the number of labels is odd, select the middle label area as the region of interest. If the number of labels is even, select the two middle label areas as the region of interest.

[0087] The adaptive ROI extraction algorithm is based on the edge-fitting annotation strategy and can dynamically change its route fitting area according to the different positions of the camera above the implement. This adaptability helps the implement obtain faster trajectory generation in the visually changing corn fields.

[0088] Step 4, as Figure 5 shown, where (a) original image (b) seedling belt segmentation map of Local-SegNeXt network (c) extraction of adaptive ROI and center point (d) centerline extraction result of G-RANSAC. The detection effects of corn canopy row lines at four different growth stages were explored by comparing with the manually calibrated lines. It can be seen from the figure that the model shows good detection performance when processing corn rows at different growth stages, effectively overcoming the challenges brought by the connection of leaves between different rows during the growth process of corn crops.

[0089] Among them, the center point extraction means cutting the image vertically into 50 pixel strips at equal intervals. Each strip contains a section of ROI feature. Calculate the intersection position of the strip and this feature section, and take the midpoint of the four intersections as the center point of the crop row.

[0090] The centerline extraction algorithm of G-RANSAC mainly uses the gradient direction to constrain the samples randomly selected in the RANSAC algorithm to find a set of high-quality inliers to ensure the reliability of subsequent optimization.

[0091] Construct the straight-line model of the seedling centerline y = ax + b. Since the driving direction of the agricultural machine is parallel to the seedling belt, there is a situation where the seedling centerline is perpendicular in the captured seedling image. Therefore, when such a situation occurs, the slope of the straight line is set to infinity. The initial value of the dataset used for line fitting is usually set to 2, that is, only the first two points with the best fitting results are used as the initial value. Let the gradient direction of point 1 be G 1 , the gradient direction of point 2 be G 2, if the two randomly selected points are on the same straight line, the absolute value of the difference in the gradient directions of the two points should be less than the user-defined threshold T. Use these two points to calculate the straight line estimation model, and use the average value of the gradient directions of these two points as the main direction Y of the gradient direction of the straight line. g . Traverse the remaining points. If both conditions of Equation (1) and (2) are satisfied simultaneously, then determine it as an inlier:

[0092] |G i -Y g |<T (1);

[0093]

[0094] where G_i is the gradient direction of a certain point, T is the user-defined threshold, D_i is the distance from the point (y_i, x_i) to the straight line, and a and b are the slope and intercept of the straight line. Define a threshold k to constrain the number of inliers as one of the stopping conditions of the algorithm. To determine the value of k, randomly select 20 samples from each ROI of the dataset, and a total of 100 samples are obtained. Manually count the inlier ratio, with an average value of 0.83 and a minimum value of 0.75. Set k to 0.78, which balances the samples between the average value and the conservative lower limit of its minimum value. In addition, calculating the number of iteration terminations n based on the prior probability P can also stop the algorithm in advance and improve the fitting accuracy. The calculation method is as follows:

[0095]

[0096] where the prior probability P is usually set to 0.99, which ensures that the probability of at least one successful sampling is 99%. Therefore, the best model is obtained within no more than 5 iterations.

[0097] As described above, only the preferred specific embodiments of the present invention are provided, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims

1. A field route extraction method based on seedling strip segmentation, characterized in that: The following steps are involved: Step 1: Establish a diversified corn field dataset and use the edge fitting strategy annotation method to annotate the data; Step 2: Use the Local-SegNeXt network to segment the seedling belt. The Local-SegNeXt network uses multi-scale convolutional attention as an encoder and constructs a Local module to refine the local semantic feature extraction and enhance the perception of the seedling belt image features; Step 3: Adaptively extract the region of interest, determine the seedling belt area based on the crop row instance segmentation results, use an adaptive algorithm to remove redundant labels, and only retain the crop rows required for navigation as the region of interest; Step 4: Use the improved sampling consistency fitting route method to extract the navigation line, use the gradient direction to constrain the randomly selected samples in the RANSAC algorithm, find a set of high-quality internal points, and then determine the center line of the current lane; In step 1, the edge fitting strategy labeling method includes: drawing a polygonal area fitting the edge of the image based on the center line of the seedling strip as a reference, marking the entire crop row as a whole, and labeling the extended area of ​​the crop row in the field of view in the case of missing seedlings or broken rows; In step 2, the Local-SegNeXt network uses multi-scale convolutional attention as the encoder, which consists of three parts: deep convolution that aggregates local information, multi-branch deep strip convolution that captures multi-scale context, and 1×1 convolution that simulates the relationship between different channels; strip convolution can effectively extract strip feature information, making it more suitable for seedling segmentation tasks.

2. The method for extracting field routes based on seedling strip segmentation according to claim 1, characterized in that: In step 3, the region of interest is adaptively extracted including: Contour scanning: The image obtained after network segmentation is in binary format, and the labels are all closed polygons, which are used to record the boundary information of the seedling belt. A quantity NBD that records the boundary hierarchy relationship is introduced and initialized to 1; a kernel with 0 on the left and 1 on the right is used to traverse the entire image from left to right and from top to bottom starting from the upper left corner of the image; the first point that meets the kernel found during the traversal process is the starting point of the outer boundary of the entire seedling belt image; Boundary tracing: Query the 8-neighborhood clockwise from the starting point of the outer boundary, and use the non-zero pixel points + NBD found to determine the tracing direction; then search for new boundary points counterclockwise, mark and update the new boundary points found as new boundary points, and repeat this process until returning to the starting boundary point; in each boundary tracing cycle, the NBD value increases by 1 to distinguish boundaries at different levels. For elements in the compressed horizontal, vertical, and diagonal directions, only the end point coordinates in that direction are retained, thereby extracting all the seedling strip contour information segmented by the Local-SegNeXt network; Keep the bottom intersection area: if one edge of the seedling strip outline overlaps with the bottom of the image, keep the bottom intersection area; mark the label area that does not intersect with the bottom of the image as background; according to the collected data, the labels retained in the processed image are {1,2,3,4}; Determine the region of interest: If the number of labels is 1 or 2, the label region is directly used as the region of interest; if the number of labels is greater than 2, further distinction is made: if the number of labels is an odd number, the middle label region is selected as the region of interest; if the number of labels is an even number, the two middle label regions are selected as the regions of interest.

3. The field route extraction method based on seedling strip segmentation according to claim 1 is characterized in that: In step 4, the RANSAC algorithm includes: Construct a straight line model of the center line of the seedlings y = ax + b; the initial value of the data set used for line fitting is set to 2, and the first two points with the best fitting results are used as the initial value; the gradient direction of point 1 is set to G1, and the gradient direction of point 2 is set to G2. If the two randomly selected points are on the same straight line, the absolute value of the gradient direction difference between the two points should be less than the custom threshold T. The two-point straight line model is used, and the average value of the gradient direction of the two points is used as the main direction Y of the gradient direction of the straight line g ; Traverse the remaining points, and if they meet both of the following conditions, they are determined to be in-game points: |G i -Y g |<T; Among them, G i is the gradient direction of a point, T is the custom threshold, D i For point (y i ,x i ) is the distance from the straight line, a and b are the slope and intercept of the straight line; Define the threshold k; randomly select 20 samples from each region of interest in the data set, and obtain a total of 100 samples; count the proportion of inliers, with an average of 0.83 and a minimum of 0.75; set k to 0.78 to balance the samples between the average and the conservative lower limit of their minimum values; The number of iteration terminations n is calculated based on the prior probability P to improve the fitting accuracy. The calculation method is as follows:

4. A system for implementing the method according to any one of claims 1 to 3, characterized in that: include: Data collection and annotation module, used to build a diverse dataset of corn fields and annotate them using edge fitting strategy; The seedling strip segmentation module uses the Local-SegNeXt network to segment the seedling strip; An area of ​​interest extraction module is used to adaptively extract crop rows required for navigation as areas of interest; The route fitting module uses an improved sampling consistency algorithm to extract navigation lines.

Citation Information

Patent Citations

  • Circular center detection method based on Gaussian fitting sub-pixel edge detection and improved RANSAC algorithm

    CN108986126A

  • Cotton crop row detection method and device based on computer vision and a storage medium

    CN111727457A