Field route extraction method and system based on seedling strip segmentation
Through the field route extraction method based on seedling belt segmentation, the accuracy and efficiency of corn crop row detection in complex environments are solved, and efficient navigation route extraction and real-time navigation capabilities are achieved.
Patent Information
- Application Number
- CN202411857765.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-17
AI Technical Summary
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 spanning the entire image.
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 was segmented using the Local-SegNeXt network, the region of interest was extracted adaptively, and the navigation route was extracted using the improved sampling consistency fitting route method.
It improves the accuracy and efficiency of corn crop row detection, enhances the model's perception of the seedling belt image characteristics, reduces the amount of calculation, makes it more suitable for real-time navigation, and provides reliable route information.
Smart Images

Figure CN119723110A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition, and in particular to a method and system for extracting field routes based on seedling strip segmentation. Background Art
[0002] Corn planting and management rely on frequent and accurate field reconnaissance to provide timely 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 achieve autonomous acquisition of field information. Due to the rapid development of computer vision and the cost-effectiveness of visual 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 weeds and crops with similar colors, complex field layouts, and the unpredictability of the natural environment. Therefore, accurate detection of crop rows is crucial to guide autonomous driving vehicles to drive correctly in farmland and complete daily tasks such as spraying pesticides and fertilizing.
[0003] Deep learning methods can accurately identify and extract crop row information, among which 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 contained in each image is large, and the manual labeling process is quite time-consuming. In addition, the accuracy of using the center point of the detection box as the feature point required for route fitting is largely limited by the quality of manually labeled data. To alleviate this burden, existing studies have 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 crop rows through masks can provide greater tolerance for individual deviations. However, the convolution operation in the semantic segmentation network calculates local areas of the image, which limits the network's ability to extract features from multiple adjacent polygonal areas of interest such as seedling strips that span the entire image. Therefore, it needs to be optimized to meet the needs of agricultural machinery navigation 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: 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.
[0012] Furthermore, in step 3, the specific steps of adaptively extracting the region of interest are:
[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 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;
[0014] 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;
[0015] 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;
[0016] 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.
[0017] Further, in step 4, the RANSAC algorithm includes:
[0018] Construct a straight line model y=ax+b for the center line of the seedlings; the initial value of the data set used 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; the gradient direction of point 1 is set to G1, and the gradient direction of point 2 is set to G2. If 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 straight line model is calculated using these two points, and the average value of the gradient direction of the two points is taken as the main direction Y of the gradient direction of the straight line g ;
[0019] Traverse the remaining points, and if they meet both of the following conditions, they are determined to be in-game points:
[0020] |G i -Y g | <T;
[0021]
[0022] Where G_i is the gradient direction of a 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;
[0023] Define the threshold k; randomly select 20 samples from each ROI of the dataset, and obtain a total of 100 samples; calculate 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;
[0024] 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:
[0025]
[0026] Among them, 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] In order to solve the above technical problem, the present invention further proposes a system for implementing the above method, comprising:
[0028] Data collection and annotation module, used to build a diverse dataset of corn fields and annotate them using edge fitting strategy;
[0029] The seedling strip segmentation module uses the Local-SegNeXt network to segment the seedling strip;
[0030] An area of interest extraction module is used to adaptively extract crop rows required for navigation as areas of interest;
[0031] The route fitting module uses an improved sampling consistency algorithm to extract navigation lines.
[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 achieves efficient crop row segmentation when crop row breakage is severe.
[0034] (2) This application proposes a crop segmentation method, which introduces strip convolution to extract seedling strip features and constructs local position coding to eliminate the interference of complex background and inter-row weeds, thereby enhancing the robustness of the model.
[0035] (3) The present application selects the navigation area by adaptively extracting the region of interest (ROI), eliminating the need to further plan the positioning points of different crop rows in the post-processing step, greatly reducing the amount of calculation, 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 point fitting navigation line in the ROI area, provides reliable route information, and provides powerful guidance for field farming, fertilization and other operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0038] Figure 1 It is a structural schematic diagram of the field route extraction method based on seedling strip segmentation according to the present invention;
[0039] Figure 2 Constructing a graph for the dataset of the present invention;
[0040] Figure 3 This is the Local-SegNeXt network architecture diagram of the present invention;
[0041] Figure 4 It is the pseudo code diagram of the adaptive algorithm of interest of the present invention;
[0042] Figure 5 This is a diagram showing the crop route extraction results at different corn growth stages of the present invention. DETAILED DESCRIPTION
[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 y=ax+b for the center line of the seedlings; the initial value of the data set used 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; the gradient direction of point 1 is set to G1, and the gradient direction of point 2 is set to G2. If 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 straight line model is calculated using these two points, and the average value of the gradient direction of the two points is taken as the main direction Y of the gradient direction of the straight line g ;
[0062] Traverse the remaining points, and if they meet both of the following conditions, they are determined to be in-game points:
[0063] |G i -Y g | <T;
[0064]
[0065] Where G_i is the gradient direction of a 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 the threshold k; randomly select 20 samples from each ROI of the dataset, and obtain a total of 100 samples; calculate 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;
[0067] 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:
[0068]
[0069] Among them, 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] In order to solve the above technical problem, the present invention further proposes a system for implementing the above method, comprising:
[0071] Data collection and annotation module, used to build a diverse dataset of corn fields and annotate them using edge fitting strategy;
[0072] The seedling strip segmentation module uses the Local-SegNeXt network to segment the seedling strip;
[0073] An area of interest extraction module is used to adaptively extract crop rows required for navigation as areas of interest;
[0074] The route fitting module uses an improved sampling consistency algorithm to extract navigation lines.
[0075] Embodiment 1:
[0076] A method for extracting field routes based on seedling strip segmentation comprises the following steps:
[0077] Step 1: Create a corn field diversity dataset, such as Figure 2 As shown in the figure, the experiment used a self-made platform with a fixed D435i depth camera to take RGB images of corn in the experimental field of Jilin Agricultural University in Changchun City, Jilin Province (longitude: 125.41 latitude: 43.81 corn row spacing 60cm) to establish a corn image database. These images were taken on June 2, 2024 (first phase, average height 15 cm), June 17, 2024 (second phase, average height 30cm), July 1, 2024 (third phase, average height 45cm) and July 20, 2024 (fourth phase, average height 60cm). The camera was installed on the top of the platform about 1.5m above the ground, and the shooting angle range was 45 degrees below the horizontal plane. By optimizing the camera position and angle, it is avoided to capture too many crop rows to increase the calculation time or the crop rows are too short to cause excessive deviation of the center line. The platform was propelled at a speed of about 0.8 meters per second, producing a stable video sequence that was extracted into images at a rate of 5 frames per second, with a resolution of 1920×1080 pixels and saved in JPG format. These images cover various scenes, times, and different growth stages of corn rows, totaling 7,200 images.
[0078] Deep learning methods can provide accurate pixel segmentation results, but the leaves of crop canopies have the characteristics of divergence, crossing, and asymmetry, which greatly interfere with the extraction of crop canopy row detection lines. For irregularly shaped corn plants, a large amount of labeled data is required for training. Therefore, in the process of making a semantic segmentation dataset, a polygonal box close to the upper and lower edges is drawn on the image for each crop row to achieve overall labeling of the entire crop row. This method can maintain continuous labeling of crop rows even in the absence of seedlings, solving the problem of inaccurate route extraction in broken row areas. In addition, it is still necessary to manually set the corresponding post-processing algorithm to determine how to plan different crop row areas by detecting the center point of each instance. This strategy can distinguish different crop rows so that crops from other rows will not interfere with the centerline fitting of the current crop row line. The study labeled 7,200 images and divided them into three subsets for training, validation, and testing, with allocation ratios of 0.7, 0.2, and 0.1, respectively.
[0079] Step 2: While modeling the global spatial information, strengthen the local coding information to improve the perception of the seedling image features. At the same time, set the Attention module stack to (2, 1, 3, 2) to have smaller model parameters and floating point calculations. The architecture of the Local-SegNeXt network is as follows: Figure 3 As shown in the figure. The Local block is the 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 output features of the MSCA module are batch normalized as the input of the Local block, and the features are reduced in dimension through 1×1 convolution to reduce the computational complexity. Then, the parallel maximum pooling operation is introduced, and its receptive field size is set to 5×5, which avoids problems such as image distortion caused by image processing operations, and solves the problem of repeated features extracted from the image by the convolutional neural network. Through the bottom-up connection, the pooled feature map is added and fused with the feature map of the previous layer to enhance the local information positioning ability of the deep features and alleviate the problem of easy loss of detail information in the deep feature map. In this cross-level feature fusion process, a 3×3 convolution operation is used for each scale feature map extracted by pooling to provide a more comprehensive and rich feature representation for the network. In addition, a jump connection line is added between the module input and the deep features to add and fuse the shallow feature map containing rich semantic information with the pooled feature map, further increasing the utilization of the underlying information and allowing the network's output nodes to retain important information on the shallow edges to a greater extent. Finally, the module output dimension 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 understand the overall image content, which is crucial for accurate segmentation of seedling strips in different environments.
[0080] The specific training process of the segmentation network model is explained as follows:
[0081] The constructed dataset was input into the model for training. The learning rate was set to 0.01 and dynamically adjusted using the PolyLR strategy. SGD was used as the optimizer. The training process involved 100 iterations, a batch size of 4, a momentum of 0.9, and a weight decay of 0.0005. For the actual corn seedling strip dataset collected, there is an imbalanced data distribution problem caused by the labeling conditions, in which the positive sample (seedling strip) area is small, while the negative sample (background) area is large. This imbalance may cause the model to favor a larger number of samples during training, thereby ignoring the learning of positive samples with a smaller range. In order to solve this problem, Focal loss is used as the loss function of the model. This loss function can give higher weights to positive samples during training to enhance the model's attention to positive samples, thereby optimizing the model's training effect and improving the segmentation ability of a small number of samples.
[0082] Step 3, the algorithm process of the adaptive region of interest (ROI) extraction method is summarized as follows Figure 4 As 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 pixels in the region of interest to determine the robot's navigation line. 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 retain two seedling belt segmentation areas adjacent to the lanes at the same time to guide the machine. 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. In order to record the boundary information of the seedling belt, a quantity NBD that records the boundary hierarchy relationship is introduced and initialized to 1. Use a kernel with 0 on the left and 1 on the right 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 found in the traversal process that meets the kernel is the starting point of the outer boundary of the geometric body.
[0084] Boundary tracing: First, query the 8-neighborhood clockwise from the starting point of the outer boundary, and add the non-zero pixel points found to NBD to determine the tracing direction. Then, search for new boundary points counterclockwise, mark the new boundary points found (+NBD) and update them as new boundary points, and repeat this process until you return 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.
[0085] Keep the bottom intersection area: If one edge of the seedling strip outline overlaps with the bottom of the image, keep the label area. The label area that does not intersect with the bottom of the image is marked 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, there are generally no more than 4 seedling strips that intersect with the bottom of the image.
[0086] Determine the region of interest: If the number of labels is 1 or 2, these label regions are 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 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 machine. This adaptation helps the machine to achieve faster trajectory generation in the visually changing cornfield.
[0088] Step 4, such as Figure 5 As shown in the figure, (a) original image (b) Local-SegNeXt network seedling strip segmentation image (c) adaptive ROI and center point extraction (d) G-RANSAC centerline extraction result. By comparing with the manual calibration line, the detection effect of corn canopy row lines at four different growth stages was explored. 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 of corn crops.
[0089] The center point extraction refers to cutting the image into 50 pixel strips at equal intervals in the vertical direction. Each strip contains a segment of ROI features, and the intersection position of the strip and the feature segment is calculated, and the midpoint of the four intersections is taken as the center point of the crop row.
[0090] The main idea of the centerline extraction algorithm of G-RANSAC is to use the gradient direction to constrain the randomly selected samples in the RANSAC algorithm and find a set of high-quality internal points to ensure the reliability of subsequent optimization.
[0091] Construct a straight line model y=ax+b for the centerline of the seedlings. Since the driving direction of the agricultural machinery is parallel to the seedling belt, there are cases where the centerline of the seedlings is vertical in the captured seedling images. Therefore, when such a situation occurs, the slope of the straight line is set to infinity. The initial value of the data set 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 G1 and the gradient direction of point 2 be G2. If 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. Use these two points to calculate the straight line estimation model, and use the average value of the gradient direction of the two points as the main direction Y of the gradient direction of the straight line. g Traverse the remaining points. If they satisfy both conditions (1) and (2), they are considered to be internal points:
[0092] |G i -Y g | <T (1);
[0093]
[0094] Among them, G_i is the gradient direction of a 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. The number of internal points is constrained by defining the threshold k as one of the stopping conditions of the algorithm. In order to determine the value of k, 20 samples are randomly selected from each ROI of the data set, and a total of 100 samples are obtained. The proportion of internal points is manually counted, with an average value of 0.83 and a minimum value of 0.75. Set k to 0.78, which balances the sample between the conservative lower limit of the average value and its minimum value. In addition, the algorithm can be stopped early by calculating the number of iteration terminations n based on the prior probability P to improve the fitting accuracy. The calculation method is as follows:
[0095]
[0096] Among them, the prior probability P is usually set to 0.99, which ensures that there is a 99% probability of at least one successful sampling. Therefore, the best model is obtained in no more than 5 iterations.
[0097] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on 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.
2. The method for extracting field routes based on seedling strip segmentation according to claim 1, characterized in that: 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, marking the entire crop row as a whole, and marking the extended area of the crop row in the field of view in the case of missing seedlings or broken rows.
3. The field route extraction method based on seedling strip segmentation according to claim 1 is characterized in that: 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.
4. 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 geometric body; 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 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}; 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.
5. The method for extracting field routes based on seedling strip segmentation according to claim 1, characterized in that: In step 4, the RANSAC algorithm includes: Construct a straight line model y=ax+b for the center line of the seedlings; 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 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 straight line model is calculated using the two points, 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:
6. A system for implementing the method according to any one of claims 1 to 5, 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
Field navigation line extraction method based on semantic segmentation
CN111950349A
Robust palm region-of-interest positioning method in natural scene
CN115661872A
Attention scheme and stripe convolution semantic line detection method based on deep Hough network
CN116563682A