A Cultivated Land Plot Extraction Method, System and Medium Based on the Fusion of Aerial and Line Data

Through the method of surface and line fusion, combined with SAM model and line model, the regional surface and boundary lines of the plot are extracted and integrated, and the problems of poor mobility and complex operation of plot extraction in the existing technology are solved, and high-precision arable land plot extraction and data support are achieved.

CN119206475BActive Publication Date: 2025-06-10GUANGDONG GUODI TECHNOLOGY CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411137449.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2025-06-10
Estimated Expiration
2044-08-19

AI Technical Summary

Technical Problem

The existing plot extraction model is not very mobile in plot extraction in different regions, and it is difficult to directly perform segmentation and extraction. The operation process of the SAM large model is too complicated, making it difficult to achieve accurate arable land plot extraction.

Method used

The arable land plot extraction method based on surface line fusion is adopted, and the regional surface extraction is performed using the SAM model, the arable land boundary line is extracted using the line model, and the surface line fusion is performed to obtain a higher precision arable land plot area.

Benefits of technology

It has achieved accurate extraction of plots in different regions, solved the problem of segmentation of small fields and provided accurate data support for arable land protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119206475B_ABST
    Figure CN119206475B_ABST
Patent Text Reader

Abstract

The present application discloses a method, system and medium for extracting cultivated land plots based on surface-line fusion. The method includes: classifying the regions of the initial plot data and extracting the plots according to a preset SAM model to obtain plot-surface data; extracting the ridge lines of the initial plot data and connecting the boundaries according to a preset line model to obtain plot-line data; performing surface-line fusion processing on the plot-surface data and the plot-line data to obtain the extraction result of the cultivated land plots. The present application uses the SAM model to extract the regional surfaces of plots with different characteristics for plots in different regions, uses the line model to extract the cultivated land boundary lines, and then performs surface-line fusion to obtain a cultivated land plot area with higher accuracy, providing accurate data support for cultivated land protection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of cultivated land plot extraction, and specifically relates to a method, system, and medium for extracting cultivated land plots based on the fusion of surface and line. Background Art

[0002] Plots, as the basic units of cultivated land, are crucial for relevant tasks such as the hierarchical management of farmland. Therefore, the refined extraction of cultivated land plots has important research significance. However, in reality, there are diverse types of cultivated land, including plain dry land, hilly terraced fields, and various paddy fields. At the same time, the characteristics of plots vary in different regions. In the southern region, there are many plots with small areas and complex structures, while in the northern region, the plots are regular, but there are obvious ridges between plots, and the dividing lines are relatively thin, making it difficult to accurately extract the boundaries. Therefore, how to extract cultivated land plots according to the differences in different regions is crucial.

[0003] Existing plot extraction models have poor migration ability and are difficult to directly segment and extract plots in different regions. Only by rewriting and annotating samples and training models for each region can the accuracy of plot extraction be ensured. Although the SAM large model has good generalization ability, this model requires users to input prompts, and the operation process is too complex. Summary of the Invention

[0004] This application proposes a method, system, and medium for extracting cultivated land plots based on the fusion of surface and line. For plots in different regions, the SAM model is used to extract the regional surfaces of plots with different characteristics, and the line model is used to extract the cultivated land boundary lines. Then, surface-line fusion is performed to obtain a cultivated land plot area with higher accuracy, providing accurate data support for cultivated land protection.

[0005] The first aspect of this application provides a method for extracting cultivated land plots based on the fusion of surface and line, and the method includes:[[]]END]]

[0006] Classify and extract the regional surface of the initial plot data according to a preset SAM model to obtain plot-surface data;

[0007] Extract the ridge lines of the initial plot data and connect the boundaries according to a preset line model to obtain plot-line data;

[0008] Perform surface-line fusion processing on the plot-surface data and the plot-line data to obtain the cultivated land plot extraction result.

[0009] The above solution uses a method combining surface and line. The SAM model is used for surface extraction to obtain the regional surface of the plot. Then, a line model is used to extract the cultivated land boundary lines inside the plot. Through the cultivated land boundary lines, it is easier to divide the fine boundaries in the plot, realizing more accurate extraction of cultivated land plots. Finally, surface-line fusion is performed based on the plot-surface data and plot-line data to obtain a complete and high-precision cultivated land plot area, enabling accurate boundary division for plots in different regions and providing accurate data support for cultivated land protection.

[0010] In a possible implementation method of the first aspect, according to a preset SAM model, the initial plot data is classified and plots are extracted to obtain plot-surface data, specifically:

[0011] The initial plot data is input into the SAM model for shape classification calculation to obtain the shape index of each plot;

[0012] According to the shape index, each plot is prompted and labeled through a preset image prompting generation algorithm to obtain a regional surface prompt;

[0013] According to the regional surface prompt, the initial plot data is extracted and merged to obtain plot-surface data.

[0014] The above solution first calculates the shape index of the initial plot data and completes the classification of plots according to the shape index. Then, different labeling methods are used for plots of different shape types to obtain a regional surface prompt. The regional surface prompt can quickly extract features and divide plots for cultivated land plots with diverse shapes, realizing accurate extraction of the surface data of plots regardless of whether the plot shapes are regular, and completing the division of plots to obtain the regional surface of the plots.

[0015] In a possible implementation method of the first aspect, the shape index is specifically:

[0016] ;

[0017] In the formula, is the shape index, S is the area of the plot, and L is the total length of the plot boundary.

[0018] In a possible implementation method of the first aspect, according to the shape index, each plot is prompted and labeled through a preset image prompting generation algorithm to obtain a regional surface prompt, specifically:

[0019] Judge the plot shape corresponding to each plot according to the shape index and generate a corresponding mask for each plot;

[0020] When the shape of the plot is of the first type, several bounding boxes are generated for the mask through a clustering algorithm and the mask is expanded outward by the first threshold number of pixels based on the bounding boxes to obtain a regional surface hint;

[0021] When the shape of the plot is of the second type, the entropy difference between each point in the mask and the center point of the mask is calculated, the second threshold number of points with the largest entropy differences are selected as feature points, and a regional surface hint is obtained based on the feature points;

[0022] When the shape of the plot is of the third type, perturbations are added to the mask to generate several masks, and then the intersection of the masks is obtained to get a regional surface hint.

[0023] In the above solution, since the regional surface hint can be used to accelerate the extraction of surface data, for plots of different shapes, different hint generation methods are adopted, and regional surface hints applicable to plots of different shapes can be obtained to further improve the accuracy of plot extraction. For plots of different shapes, the methods of generating bounding boxes, generating feature points, and generating masks are used respectively to obtain regional surface hints, so that the extraction of surface data can be applicable to cultivated lands of different types and shapes.

[0024] In a possible implementation method of the first aspect, the entropy difference between each point in the mask and the center point of the mask is specifically:

[0025] The calculation formula for the entropy of each point in the mask is:

[0026] ;

[0027] ;

[0028] In the formula, is the entropy of point p i , is the entropy of point p 0 , C is all points in the mask, is the pixel intensity distribution in the grid centered on point p i , j is the intensity of all pixels in , is the point that maximizes the entropy difference from point p 0 .

[0029] In a possible implementation method of the first aspect, according to a preset line model, the ridge lines of the initial plot data are extracted and the boundaries are connected to obtain plot-line data, specifically:

[0030] The initial plot data is input into the line model for feature extraction to generate the cultivated land boundary lines between the plots;

[0031] Perform breakpoint detection and direction connection on the cultivated land boundary line based on the edge breakpoint connection method to obtain plot-line data.

[0032] The above solution is aimed at the relatively thin and difficult-to-divide dividing lines in the plots. The line extraction method is used to obtain the cultivated land dividing lines inside the plots. First, the cultivated land boundary lines between the plots are initially generated, the directions of the cultivated land dividing lines are determined and connected, and the closed cultivated land dividing lines are obtained for plot segmentation.

[0033] In a possible implementation method of the first aspect, perform surface-line fusion processing on the plot-surface data and the plot-line data to obtain the cultivated land plot extraction result. Specifically:

[0034] Perform cutting and fusion processing on the plot-surface data and the plot-line data in sequence to obtain surface-line fusion plot data;

[0035] Perform plot boundary optimization and vectorization processing on the surface-line fusion plot data to obtain the cultivated land plot extraction result.

[0036] The above solution performs surface-line fusion on the plot-surface data and the plot-line data to obtain cultivated land plots with accurate dividing lines.

[0037] In a possible implementation method of the first aspect, the initial plot data is specifically:

[0038] Obtain the cultivated land image to be extracted;

[0039] Divide the cultivated land image according to the preset road demarcation factors to obtain the initial plot data.

[0040] The above solution preprocesses the cultivated land image to be extracted before feature extraction. Since the reasons for plot demarcation include not only natural factors but also road construction, in order to improve the accuracy of plot extraction, the cultivated land image is initially divided based on road factors to obtain the initial plot data as the basic data for subsequent plot extraction.

[0041] The second aspect of the present application provides a cultivated land plot extraction system based on surface-line fusion. The system includes: a surface data extraction module, a line data extraction module, and a cultivated land plot extraction module;

[0042] Among them, the surface data extraction module is used to classify and extract the regional surface of the initial plot data according to the preset SAM model to obtain plot-surface data;

[0043] The line data extraction module is used to extract the ridge lines and connect the boundaries of the initial plot data according to the preset line model to obtain plot-line data;

[0044] The cultivated land plot extraction module is used to perform surface-line fusion processing on plot-surface data and plot-line data to obtain the cultivated land plot extraction result.

[0045] In the third aspect of the present application, a storage medium is provided. The storage medium stores computer-readable program codes, and when the computer-readable program codes are executed, the steps of a method for extracting cultivated land plots based on surface-line fusion according to any one of the embodiments of the present application are implemented. Description of the Drawings

[0046] To more clearly illustrate the technical solutions of the present application, the drawings required for the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0047] Figure 1 is a specific flowchart of a method for extracting cultivated land plots based on surface-line fusion provided by an embodiment of the present application;

[0048] Figure 2 is a flowchart of cultivated land plot extraction of a method for extracting cultivated land plots based on surface-line fusion provided by an embodiment of the present application;

[0049] Figure 3 is a structural diagram of a system for extracting cultivated land plots based on surface-line fusion provided by an embodiment of the present application. Detailed Embodiments

[0050] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0051] It should be understood that the step numbers used in the text are only for convenient description and are not used to limit the execution order of the steps.

[0052] First Embodiment

[0053] As the basic unit of cultivated land, the plot is crucial for relevant tasks such as the hierarchical management of farmland. Therefore, the refined extraction of cultivated land plots can provide data support for agricultural management. However, due to the diverse types of cultivated land in China, some cultivated land has the characteristics of large quantity, small area, and complex structure. There are obvious ridges between some cultivated land, and the dividing lines are relatively thin, making it difficult to accurately extract the boundaries. In view of the above situation, the embodiment of the present application selects a corresponding prompting method according to the characteristics of the plot to extract the plot area. At the same time, to solve the problem of small ridge segmentation, a line model is introduced to extract the thin cultivated land boundary line. Finally, a more accurate cultivated land plot is obtained under the method of combining surface and line.

[0054] As Figure 1 shown, Figure 1 FIG. is a schematic flow chart of a method for extracting cultivated land plots based on surface-line fusion provided by an embodiment of the present application. The method for extracting cultivated land plots based on surface-line fusion in this embodiment includes steps S1 to S3, which are described in detail as follows:

[0055] Step S1, according to the preset SAM model, classify the area of the initial plot data and extract the plot to obtain plot-surface data.

[0056] In the embodiment of the present application, the obtained cultivated land image is first preprocessed. Because in addition to the natural segmentation of farmland caused by terrain and rivers, the artificially constructed road network also causes the segmentation of farmland. And farmland often naturally forms multiple small regions along with the division of road networks and other blocks. If these influencing factors are ignored and the extraction of cultivated land plots is directly carried out, it will cause greater confusion, and at the same time, the extraction result will span multiple blocks, greatly reducing the extraction accuracy of cultivated land plots. Therefore, before surface extraction and extraction, the cultivated land image is first segmented according to the preset plot demarcation factors to obtain the initial plot data.

[0057] Further, the plot demarcation factors include natural and artificial factors such as roads and rivers. Roads and rivers are extracted from the cultivated land image to generate a mask, and the cultivated land image is segmented through the mask. Then, each segmented area is used as the basic data for subsequent extraction of cultivated land plots, that is, the initial plot data. Among them, the mask is a template of an image filter, which is used to filter pixels of the image to highlight the required ground objects or signs.

[0058] Then, the initial plot data is input into the SAM model to perform shape classification calculation, prompt generation, and plot extraction in sequence. Among them, the SAM model is an image segmentation model that can segment any object in any image without any annotation. The model architecture mainly includes an image encoder, a prompt encoder, and a mask decoder.

[0059] First, because the shapes of the plots are diverse, it is necessary to calculate the shape index of each plot to classify all plots according to their respective shapes. In the embodiments of the present application, the cultivated land plots are divided into three different types, namely plots close to rectangles, relatively long and narrow plots, and plots that are neither long and narrow nor close to rectangles.

[0060] Among them, the specific calculation formula of the shape index is:

[0061] ;

[0062] In the formula, is the shape index, S is the area of the plot, and L is the total length of the plot boundary.

[0063] After calculating the shape index of each plot, classify the plots according to the shape index, and then use the image encoder of the SAM model to generate a mask corresponding to each plot.

[0064] Because it is considered that the interference degree of similar objects around plots of different shapes on plot segmentation is different, so use the image prompt generation algorithm corresponding to each cultivated land plot, and generate area surface prompts for each plot through the prompt encoder of the SAM model to obtain area surface prompts applicable to plots of different shapes to further improve the accuracy of plot extraction.

[0065] If the plot is a plot close to a rectangle, then generate an area surface prompt in the form of a prompt box. The specific process is as follows: first, use the pixel map generated by the clustering algorithm to determine the prompt box for the mask corresponding to the plot, so as to obtain a preliminary prompt box; then, in order to minimize the loss of plot edge information, expand 10 pixels outward based on the preliminary prompt box to obtain an area surface prompt in the form of a prompt box. It is worth mentioning that considering that there may be more holes in the extraction result of the SAM model, so in the embodiments of the present application, opening and closing operations are used to generate area surface prompts for the initial plot data.

[0066] Optionally, the embodiments of the present application use DBSCAN clustering to generate pixel maps.

[0067] It is worth mentioning that for the area surface prompt in the form of a prompt box, in the subsequent decoding process of the mask decoder, it is necessary to encode multiple prompt boxes of an initial plot data together as part of the sparse embedding, which can have an important impact on the optimization of the mask decoder. Specifically, regard the upper left point and the lower right point of each prompt box as two parallel dimensions, first normalize and encode the prompt box, then use Gaussian blur encoding to process the prompt box in turn to obtain high-dimensional features, and finally process multiple high-dimensional features into a high-dimensional feature vector, and this high-dimensional feature vector can be used as part of the sparse embedding.

[0068] If the plot is a relatively long and narrow plot, considering that generating a regional surface hint in the form of a bounding rectangle will increase the area of this shaped plot and reduce the accuracy of cultivated land plot extraction, it is more appropriate to choose to generate a regional surface hint in the form of feature points. The specific process is as follows: find the center point of the mask corresponding to the plot, use the remaining points in the mask as candidate points, first calculate the entropy of all candidate points, then calculate the entropy difference between each candidate point and the center point, select 9 candidate points with the largest entropy difference as feature points, and obtain a regional surface hint in the form of feature points based on the feature points.

[0069] In the embodiment of the present application, in order to calculate the entropy of each candidate point, a 9×9 grid centered on each candidate point is used. The entropy of each candidate point is calculated according to the distribution of pixel intensities within the corresponding grid. The formula for calculating the entropy of each point in the mask is:

[0070] ;

[0071] ;

[0072] In the formula, is the entropy of point p i , is the entropy of point p 0 , C is all points in the mask, is the pixel intensity distribution in the grid centered on point p i , j is the intensity of all pixels in, is the point that maximizes the entropy difference from point p 0 .

[0073] In addition, the embodiment of the present application also adds background points outside the range of the relatively long and narrow plot, which can provide more robust prior knowledge for the feature extraction of the subsequent SAM model to effectively distinguish plot categories with high similarity. In some embodiments, a gradient calculation method is used to select background points.

[0074] If the plot is neither long and narrow nor close to a rectangle, an optimized mask method is used. The specific process is as follows: add perturbations to the mask corresponding to the plot to enhance the hint intensity to generate several slightly different mask hints; then take the intersection of different mask hints in multiple identical regions to obtain a basic region; since these different mask hints may lead to differences in the segmentation results, use the Euclidean distance between pixels of the same category in the mask to determine whether it is an out-of-intersection region to obtain a high-precision basic region, and a mask-form regional surface hint can be obtained based on the basic region.

[0075] Then, according to the regional surface prompt of the initial plot data, use the mask decoder of the SAM model to extract plots from the initial plot data to obtain an extraction result, and obtain plot-surface data according to the extraction result.

[0076] Optionally, if the extraction result contains many fragmented and small plots, merge these small plots, and after merging, remove noise from the merging result according to a preset threshold to further increase data accuracy.

[0077] Step S2: According to a preset line model, extract ridge lines and connect boundaries of the initial plot data to obtain plot-line data.

[0078] In the embodiment of the present application, the obtained plot-surface data can be regarded as a kind of mask data, which is a prediction map without a threshold and with low quality. Because the plot has fine ridge lines, the separate plot-surface data cannot distinguish the fine dividing lines in the cultivated land. Therefore, a line model is needed to extract the cultivated land boundary lines between each plot to further improve the accuracy of the cultivated land plot.

[0079] Exemplarily, the embodiment of the present application adopts a line model based on YOLOv8 with an added OCR mechanism.

[0080] Input the initial plot data into the line model for feature extraction. Considering that adjacent farmland plots have context connectivity, the module of the OCR mechanism is used to sample the initial plot data, strengthening the context aggregation of semantic segmentation and enhancing the representation of the context information of the object-based target area, so as to use the context information to improve the pixel-level classification result and achieve the extraction of the cultivated land boundary lines between each plot.

[0081] At the same time, the features extracted by YOLOv8 output the cultivated land boundary lines between each plot through a convolutional layer. To better integrate the object-based semantic information and the dense spatial context information, the line model also adopts a cross-attention structure to generate weights for the soft object area containing object category information through the Softmax function to obtain the cultivated land boundary lines represented by pixels.

[0082] After obtaining the cultivated land boundary line, edge detection needs to be continued on the cultivated land boundary line. Generally, the edges obtained by edge detection methods based on deep learning are generated by probability mapping, so the connectivity of the boundary line cannot be guaranteed. In the embodiment of the present application, since it is necessary to ensure that the boundary is connected and enclosed into a closed area, an edge break point connection method based on direction information is used to detect break points of the cultivated land boundary line. The specific process is as follows: Add a deep learning extraction module for direction learning and boundary probability to detect break points of the cultivated land boundary line and perform iterative connection, and combine the direction information at the break point and the edge probability map in the neighborhood to determine the connection direction. Through the above process, completely closed plot-line data can be obtained, thereby improving the integrity of the cultivated land plot extraction result.

[0083] Further, in break point detection, a connection graph containing direction information is provided at the break point, and the connection graph provides direction information to guide subsequent break point connection.

[0084] Step S3, perform surface-line fusion processing on the plot-surface data and the plot-line data to obtain the cultivated land plot extraction result.

[0085] In the embodiment of the present application, the plot-surface data and the plot-line data are sequentially subjected to cutting and fusion processing to obtain surface-line fusion plot data. Then, processes such as plot boundary refinement and boundary extension are performed on the surface-line fusion plot data, and finally vectorization processing is performed to obtain the cultivated land plot extraction result.

[0086] To further demonstrate the process of cultivated land plot extraction, Figure 2 An example of the process of plot image through surface extraction, line extraction, and surface-line fusion is given. In the process of surface extraction, frames, points, and masks are marked in the plot image for plots of different shapes respectively, and finally the image obtained by surface-line fusion clearly divides several cultivated land plots.

[0087] Implementing the embodiment of the present application has the following beneficial effects:

[0088] In the embodiments of the present application, the image data to be extracted is first preprocessed, and preliminary segmentation is performed according to the artificial road network to obtain initial plot data composed of small regions; then the SAM model is used to extract the plot area surface. During the surface extraction process, different prompt generation methods are used for plots of different shapes to obtain area surface prompts that can assist in extracting surface data. Since the prompt generation method uses different methods for different terrains, it can ensure that the accuracy of the plot will not decrease during the process of generating prompts, and high-precision plot-surface data is obtained; at the same time, a line model is also used to extract the cultivated land boundary line. During the line extraction process, direction information is also used to make the obtained cultivated land boundary line a complete closed shape, improving the integrity of the cultivated land plot extraction result; finally, surface-line fusion is performed to obtain a cultivated land plot area with higher accuracy. This method can not only be applied to plots with different regional characteristics, but also ensure that these plots contain fine cultivated land boundary lines, and can solve the problem of accurately extracting fine ridges, providing accurate data support for cultivated land protection.

[0089] Second Embodiment

[0090] Furthermore, in order to implement the cultivated land plot extraction system based on surface-line fusion corresponding to the above method embodiments to achieve the corresponding functions and technical effects, Figure 3 A structural diagram of a cultivated land plot extraction system based on surface-line fusion is provided. For the sake of convenience of description, only the parts related to this embodiment are shown. The cultivated land plot extraction system based on surface-line fusion provided by the embodiments of the present application includes:

[0091] A surface data extraction module 201, configured to classify and extract plot areas from the initial plot data according to a preset SAM model to obtain plot-surface data.

[0092] In the embodiments of the present application, before classifying and extracting plot areas, the cultivated land image to be extracted is segmented according to preset road demarcation factors to obtain initial plot data. Because in addition to the natural segmentation of farmland caused by terrain and river impacts, the artificial road network also causes the segmentation of farmland, and farmland often naturally forms multiple small regions along with the division of road network and other blocks. If these influencing factors are ignored and the extraction of cultivated land plots is directly performed, it will cause greater confusion, and at the same time, the extraction result will span multiple blocks, greatly reducing the extraction accuracy of cultivated land plots.

[0093] Exemplarily, in the embodiments of the present application, the plot demarcation factors include natural and artificial factors such as roads and rivers. Roads and rivers are extracted from the cultivated land image to generate a mask, and the cultivated land image is segmented through the mask, and then each segmented region is used as the basic data for subsequent extraction of cultivated land plots, that is, the initial plot data.

[0094] Then, the initial plot data is input into the SAM model for shape classification calculation, prompt generation, and plot extraction in sequence to obtain plot-face data.

[0095] The line data extraction module 202 is used to extract ridge lines and connect boundaries of the initial plot data according to a preset line model to obtain plot-line data.

[0096] In the embodiment of the present application, since the obtained plot-face data is just a prediction map without thresholds and with low quality in cultivated land plots containing fine ridge lines, and cannot clearly distinguish the fine dividing lines in the cultivated land, it is necessary to use a line model to extract the cultivated land boundary lines between each plot to further improve the accuracy of the cultivated land plot. Therefore, the initial plot data is input into the line model for feature extraction to achieve the extraction of the cultivated land boundary lines between each plot, and completely enclosed plot-line data is obtained, thereby improving the integrity of the cultivated land plot extraction result.

[0097] The cultivated land plot extraction module 203 is used to perform surface-line fusion processing on the plot-face data and the plot-line data to obtain the cultivated land plot extraction result.

[0098] In the embodiment of the present application, the plot-face data and the plot-line data are sequentially subjected to cutting and fusion processing to obtain surface-line fusion plot data. Then, the surface-line fusion plot data is processed such as plot boundary refinement and boundary extension, and finally vectorization processing is performed to obtain the final cultivated land plot extraction result.

[0099] In some embodiments, the surface data extraction module 201 further includes:

[0100] The plot-face data acquisition unit is used to input the initial plot data into the SAM model for shape classification calculation to obtain the shape index of each plot; according to the shape index, each plot is prompt-labeled through a preset image prompt generation algorithm to obtain a regional surface prompt; according to the regional surface prompt, the initial plot data is subjected to plot extraction and merging to obtain plot-face data.

[0101] Among them, the SAM model is an image segmentation model that can achieve the segmentation of any object in any image without any annotation, and the model architecture mainly includes an image encoder, a prompt encoder, and a mask decoder.

[0102] The embodiment of the present application classifies all plots according to their respective shapes by calculating the shape index of each plot, mainly dividing the cultivated land plots into three different types, namely, plots close to rectangles, narrow and long plots, and plots that are neither narrow nor close to rectangles. After determining the type of each plot, the image encoder of the SAM model is used to generate a mask corresponding to each plot.

[0103] Taking into account that similar objects around plots of different shapes have different degrees of interference in plot segmentation, an image prompt generation algorithm corresponding to each type of cultivated land plot is used. The prompt encoder of the SAM model is used to generate regional surface prompts for each plot, and regional surface prompts suitable for plots of different shapes are obtained to further improve the accuracy of plot extraction.

[0104] If the plot is a nearly rectangular plot, a regional surface prompt in the form of a prompt box is generated. The specific process is: first, the pixel map generated by the clustering algorithm is used to determine the prompt box for the mask corresponding to the plot, thereby obtaining a preliminary prompt box; then, in order to minimize the loss of plot edge information, the preliminary prompt box is expanded outward by 10 pixels to obtain a regional surface prompt in the form of a prompt box. It is worth mentioning that, considering that the extraction results of the SAM model may have many holes, the opening and closing operations are used in the embodiment of the present application to generate regional surface prompts for the initial plot data.

[0105] Optionally, the embodiment of the present application uses DBSCAN clustering to generate a pixel map.

[0106] It is worth mentioning that for area face hints in the form of hint boxes, in the subsequent decoding process of the mask decoder, multiple hint boxes of an initial plot data need to be encoded together as part of the sparse embedding, which can have an important impact on the optimization of the mask decoder. Specifically, the upper left point and lower right point of each hint box are regarded as two parallel dimensions. First, the hint box is normalized and encoded, and then the hint box is processed in turn with Gaussian fuzzy encoding to obtain high-dimensional features. Finally, multiple high-dimensional features are processed into a high-dimensional feature vector, which can be used as part of the sparse embedding.

[0107] If the plot is a long and narrow plot, considering that generating a regional surface prompt in the form of an outer rectangular prompt box will increase the area of ​​the plot of this shape and reduce the accuracy of arable land extraction, it is more appropriate to choose to generate a regional surface prompt in the form of feature points. The specific process is: find the center point of the mask corresponding to the plot, take the remaining points in the mask as candidate points, first calculate the entropy of all candidate points, and then calculate the entropy difference between each candidate point and the center point, select 9 candidate points with the largest entropy difference as feature points, and obtain the regional surface prompt in the form of feature points based on the feature points.

[0108] In addition, the embodiments of the present application also add background points outside the scope of relatively long and narrow plots, which can provide more robust prior knowledge for the feature extraction of the subsequent SAM model to effectively distinguish plot categories with high similarity. In some embodiments, a gradient calculation method is used to select background points.

[0109] If the plot is neither long and narrow nor close to a rectangle, the optimized mask method is used. The specific process is as follows: Perturbations are added to the mask corresponding to the plot to enhance the prompt intensity to generate several slightly different mask prompts; then the intersections of different mask prompts in multiple identical regions are obtained to get the basic region; Since these different mask prompts may lead to differences in the segmentation results, the Euclidean distance between pixels of the same category in the mask is used to determine whether it is an out-of-intersection region to obtain a high-precision basic region, and a regional surface prompt in the form of a mask can be obtained according to the basic region.

[0110] Therefore, the embodiments of the present application adopt regional surface prompts in the form of prompt boxes, feature points, and masks respectively for plots of different shapes. These different types of regional surface prompts can minimize the influence of similar objects around the plot on the extraction of the plot boundary line and improve the accuracy of plot extraction.

[0111] Then, according to the regional surface prompt of the initial plot data, the mask decoder of the SAM model is used to extract the plot from the initial plot data to obtain an extraction result, and plot-surface data is obtained according to the extraction result.

[0112] Optionally, if the extraction result contains many fragmented and small plots, these small plots are merged, and after merging, noise is removed from the merged result according to a preset threshold to further increase the data accuracy.

[0113] In some embodiments, the line data extraction module 202 further includes:

[0114] A plot-line data acquisition unit, configured to input the initial plot data into the line model for feature extraction to generate the cultivated land boundary lines between plots; perform breakpoint detection and direction connection on the cultivated land boundary lines based on the edge breakpoint connection method to obtain plot-line data.

[0115] Exemplarily, the embodiments of the present application adopt a line model based on YOLOv8 with an added OCR mechanism.

[0116] First, the initial plot data is input into the line model. Considering the contextual connectivity of adjacent farmland plots, the module of the OCR mechanism is used to sample the initial plot data, strengthening the contextual aggregation of semantic segmentation and enhancing the representation of the contextual information of the object-based target area. Thus, the pixel-level classification results are improved using the contextual information, and the extraction of the cultivated land boundary lines between each plot is achieved.

[0117] Meanwhile, the cultivated land boundary lines between each plot are output through the convolutional layer according to the features extracted by YOLOv8. To better integrate the object-based semantic information and the dense spatial contextual information, the line model also adopts a cross-attention structure to generate weights for the soft object area containing object category information through the Softmax function, obtaining the cultivated land boundary lines represented by pixels.

[0118] The cultivated land boundary lines obtained through the line model are actually somewhat unclosed and lack connectivity. Therefore, edge detection needs to be performed on the cultivated land boundary lines to determine the connection direction of the cultivated land boundary lines and connect them, obtaining completely enclosed plot-line data, thereby improving the integrity of the cultivated land plot extraction results.

[0119] Since the edges obtained by the commonly used deep learning-based edge detection methods are generated by probability mapping, the connectivity of the boundary lines cannot be guaranteed. Therefore, in the embodiments of this application, an edge breakpoint connection method based on direction information is adopted to perform breakpoint detection on the cultivated land boundary lines, which can ensure that the boundaries of the cultivated land plots are connected and enclosed into a closed area. The specific process of breakpoint detection is as follows: add a deep learning extraction module for direction learning and boundary probability to perform breakpoint detection on the cultivated land boundary lines and perform iterative connection, combining the direction information at the breakpoints and the edge probability map within the neighborhood to determine the connection direction.

[0120] Implementing the embodiments of this application has the following beneficial effects:

[0121] In the embodiment of the present application, first, artificial road network, rivers and other road demarcation factors are used to preliminarily segment the cultivated land image to be extracted, and initial plot data serving as the basis for extracting cultivated land plots is obtained. Then, for the combined method, regional surface extraction and cultivated land boundary line extraction are simultaneously performed on the initial plot data. First, for regional surface extraction, the SAM model is used to adopt different regional surface prompt generation methods for plots of different shapes, and then the initial plot data is extracted and merged according to the regional surface prompts to obtain plot-surface data, which can preliminarily display the shapes and demarcation lines of each plot; at the same time, for cultivated land boundary line extraction, a line model is used to extract the fine cultivated land boundary lines in the initial plot data, and the cultivated land boundary lines are connected in direction to improve the integrity and accuracy of the cultivated land plots; finally, surface-line fusion processing is performed on the plot-surface data and plot-line data to achieve accurate extraction of cultivated land plots of any type and shape, even those containing numerous fine and difficult-to-segment cultivated land ridge lines, and more accurate cultivated land plots are obtained, providing effective data support for agricultural management.

[0122] The embodiment of the present application also provides a storage medium, which stores computer-readable program code, and when the computer-readable program code is executed, the steps of the above-mentioned method for extracting cultivated land plots based on surface-line fusion are implemented.

[0123] The above specific embodiments have further elaborated in detail the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above are only specific embodiments of the present application and are not used to limit the protection scope of the present application. In particular, it is pointed out that for those skilled in the art, any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for extracting cultivated land based on surface-line fusion, characterized in that: include: According to the preset SAM model, the initial plot data is classified into regional surfaces and plots are extracted to obtain plot-surface data, specifically: the initial plot data is input into the SAM model for shape classification calculation to obtain a shape index of each plot; according to the shape index, each plot is annotated with a prompt by a preset image prompt generation algorithm to obtain a regional surface prompt; According to the regional surface prompt, the initial plot data is extracted and merged to obtain the plot-surface data; Among them, each plot is annotated with a prompt by the image prompt generation algorithm to obtain a regional surface prompt, specifically: the plot shape corresponding to each plot is determined according to the shape index, and a corresponding mask is generated for each plot; when the plot shape is of the first type, a clustering algorithm is used to generate a plurality of prompt boxes for the mask and a first threshold number of pixels are expanded outward based on the prompt box to obtain a regional surface prompt; when the plot shape is of the second type, the entropy difference between each point in the mask and the center point of the mask is calculated, and the point with the largest entropy difference of the second threshold number is selected as a feature point, and a regional surface prompt is obtained according to the feature point; when the plot shape is of the third type, disturbance is added to the mask to generate a plurality of masks, and then the intersection of the masks is obtained to obtain a regional surface prompt; According to the preset line model, the ridge lines of the initial plot data are extracted and the boundaries are connected to obtain the plot-line data; The plot-surface data and plot-line data are fused to obtain the cultivated land plot extraction results.

2. The method for extracting cultivated land based on surface-line fusion according to claim 1, characterized in that: The shape index is specifically: ; In the formula, is the shape index, S is the area of ​​the plot, and L is the total length of the plot boundary.

3. The method for extracting cultivated land based on surface-line fusion according to claim 1, characterized in that: The entropy difference between each point in the mask and the center point of the mask is specifically: The entropy calculation formula for each point in the mask is: ; ; In the formula, For point p i The entropy of is the entropy of point p0, C is all the points in the mask, For point p i The pixel intensity distribution in the grid centered at is, j is The intensity of all pixels in is the point whose entropy difference with point p0 is maximized.

4. The method for extracting cultivated land based on surface-line fusion according to claim 1, characterized in that: According to the preset line model, the initial plot data is subjected to ridge line extraction and boundary connection to obtain plot-line data, specifically: Inputting initial plot data into the line model to extract features and generate cultivated land boundary lines between various plots; Based on the edge breakpoint connection method, the breakpoint detection and direction connection of the cultivated land boundary line are performed to obtain the plot-line data.

5. The method for extracting cultivated land based on surface-line fusion according to claim 1, characterized in that: The surface-line fusion processing is performed on the plot-surface data and the plot-line data to obtain the cultivated land plot extraction result, which is specifically as follows: Cutting and fusing the plot-surface data and the plot-line data in sequence to obtain the surface-line fused plot data; The plot boundary optimization and vectorization processing are performed on the surface-line fused plot data to obtain the cultivated land plot extraction results.

6. The method for extracting cultivated land based on surface-line fusion according to claim 1, characterized in that: The initial plot data is specifically: Acquire the cultivated land image to be extracted; The cultivated land image is divided into blocks according to preset road boundary factors to obtain initial land block data.

7. A system for extracting cultivated land based on surface-line fusion, characterized in that: include: Surface data extraction module, line data extraction module and cultivated land plot extraction module; The surface data extraction module is used to classify and extract the regional surface of the initial plot data according to the preset SAM model to obtain the plot-surface data, specifically: input the initial plot data into the SAM model to perform shape classification calculation to obtain the shape index of each plot; according to the shape index, each plot is marked with a prompt by a preset image prompt generation algorithm to obtain a regional surface prompt; according to the regional surface prompt, the initial plot data is extracted and merged to obtain the plot-surface data; Among them, each plot is annotated with a prompt by the image prompt generation algorithm to obtain a regional surface prompt, specifically: the plot shape corresponding to each plot is determined according to the shape index, and a corresponding mask is generated for each plot; when the plot shape is of the first type, a clustering algorithm is used to generate a plurality of prompt boxes for the mask and a first threshold number of pixels are expanded outward based on the prompt box to obtain a regional surface prompt; when the plot shape is of the second type, the entropy difference between each point in the mask and the center point of the mask is calculated, and the point with the largest entropy difference of the second threshold number is selected as a feature point, and a regional surface prompt is obtained according to the feature point; when the plot shape is of the third type, disturbance is added to the mask to generate a plurality of masks, and then the intersection of the masks is obtained to obtain a regional surface prompt; The line data extraction module is used to extract the ridge lines and connect the boundaries of the initial plot data according to the preset line model to obtain the plot-line data; The farmland plot extraction module is used to perform surface-line fusion processing on the plot-surface data and the plot-line data to obtain the farmland plot extraction result.

8. A storage medium, characterized in that: The storage medium stores computer-readable program codes, which, when executed, implement the steps of a method for extracting cultivated land plots based on surface-line fusion according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Parcel segmentation method based on SAM model

    CN117197450A

  • Cultivated land boundary extraction method and system considering plot edge features and semantic information

    CN118447400A