Multi-task plot extraction method and device

Through a multi-task parcel extraction method that combines semantic and edge information, and utilizes a multi-branch structure and a spatial group attention mechanism, the problems of inaccurate boundary and noise influence in parcel extraction in the existing technology are solved, and higher extraction accuracy is achieved. sex and integrity.

CN118628906APending Publication Date: 2024-09-10ZHEJIANG UNIV OF TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410664457.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing land parcel extraction methods based on deep learning have problems such as boundary adhesion, boundary inaccuracy, and salt-and-pepper noise, resulting in poor parcel extraction results.

Method used

A multi-task plot extraction method guided by scale attention is adopted, which combines semantic and edge information, performs collaborative training through a multi-branch structure, and designs a feature compression module and spatial group attention mechanism to improve the comprehensiveness and accuracy of plot extraction.

Benefits of technology

It effectively solves the impact of boundary adhesion and noise, improves the accuracy and completeness of plot extraction, significantly improves the extraction effect of small farmland, and reduces the hole phenomenon in semantic results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FDA00048606783900000411
    Figure FDA00048606783900000411
  • Figure FDA0004860678390000046
    Figure FDA0004860678390000046
  • Figure HDA0004860678410000022
    Figure HDA0004860678410000022
Patent Text Reader

Abstract

The invention discloses a multi-task land parcel extraction method and device. The method comprises the following steps: (1) making a cultivated land parcel data set based on a Gaofen-2 remote sensing image; (2) constructing a feature extraction network, and improving a Swin Transform to obtain an improved network as a feature encoder; (3) designing a semantic and distance decoder and an edge decoder to decode the features extracted by the feature encoder, wherein the encoder and the decoder jointly form a multi-task land parcel extraction model; (4) using a multi-task loss function to supervise and train the multi-task plot extraction model, and processing the performance of a plurality of related task optimization models at the same time; (5) inputting the training set into the multi-task plot extraction model for training, calculating the precision of the model by using the test set, and selecting the model with the highest precision of the test set as a final plot extraction model; and (6) inputting a remote sensing image to be predicted into the trained plot extraction model, and predicting the remote sensing image by adopting a sliding window method to obtain a semantic result, a distance result and an edge result of the plot.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of farmland plot extraction, and in particular relates to a multi-task plot extraction method and device. Background Art

[0002] Cultivated land resources, as the foundation of agricultural production, are crucial to national food security and socio-economic development. Therefore, it is particularly important to use high-tech technologies such as remote sensing to extract cultivated land. This enables relevant departments to formulate or adjust land management policies based on current data to ensure the sustainability of cultivated land use.

[0003] With the gradual improvement of the spatial resolution of remote sensing images and the rapid development of deep learning algorithms, deep learning-based methods have been widely used in the field of land parcel extraction. By learning the feature representations in a large amount of image data, deep learning models can automatically extract the complex features of land parcels, including texture, color, shape, etc., thereby achieving more accurate land parcel extraction without the need for manual feature design. Therefore, compared with traditional methods, deep learning methods have stronger generalization and can effectively handle complex objects and data from different regions. Existing deep learning-based land parcel extraction methods can be divided into semantic-based and edge-based methods according to the different dependent features.

[0004] The semantic-based method uses a deep learning model to classify the pixels on the remote sensing image into plots and non-plots, thereby achieving category discrimination for each pixel. However, since the semantic segmentation method mainly focuses on global features, and the multiple downsampling operations in the encoder may cause the loss of deep feature space position information. Therefore, there are some problems with the semantic-based plot extraction method. The first is the boundary adhesion problem, that is, when multiple plots are similar in shape and close in location, the semantic segmentation algorithm may generate polygonal objects that are adhered together, thereby blurring the accurate boundaries of a single plot. Secondly, the characteristics of shared boundaries may cause the algorithm to produce inaccurate boundary positions when extracting plots. Finally, the presence of salt and pepper noise may have a negative impact on the classification accuracy, thereby reducing the extraction effect of plots.

[0005] The main idea of ​​the edge-based plot extraction method is to strengthen the edge information of the plot, and then generate a plot image with clear boundaries to facilitate the accurate division of the plot. Through the application of deep learning models, the boundaries of the rapidly changing visual features of the image are detected, and the plots are represented by closed boundaries. Compared with the semantic-based method, the edge-based plot extraction reduces the adhesion phenomenon between plots and effectively suppresses the salt and pepper noise. However, since edge information is weak information, using only the edge detection method for plot extraction may result in edge breakage, and unclosed edges containing isolated line segments or missing information will make it impossible to obtain the final plot vector, thereby reducing the accuracy of image plot extraction. Summary of the invention

[0006] The present invention aims to overcome the above-mentioned shortcomings of the prior art and provide a scale-attention-guided multi-task plot extraction method and device.

[0007] Combining edge information with semantic information for land parcel extraction in remote sensing images has significant advantages. Semantic-based methods can capture the global features of images and provide accurate judgments on land parcel categories. Edge detection methods can highlight the boundaries between land parcels, especially those areas where pixel values ​​change significantly. Since features at different levels contain different information, deep semantic information contains rich global features and contextual information, which is very useful for understanding the overall content of the image and helps to accurately determine the semantic information of the objects. Shallow edge information reflects the local changes between pixels and the boundary features of the land parcels, which is crucial to maintaining the boundary integrity and accuracy of the land parcels and helps to accurately identify the boundaries of the land parcels. Combining the two, we can make full use of features at different levels, from global to local, to achieve comprehensiveness and accuracy in land parcel extraction.

[0008] Semantic segmentation and edge detection are two different but related tasks. Since these two tasks focus on different information, it makes sense to use an independent multi-branch structure. The present invention designs a multi-task land parcel extraction method, which realizes the collaborative training of different tasks through a multi-branch structure. (1) Independent semantic and distance decoders and edge decoders are designed for information reconstruction, ensuring the independence of different tasks in the information processing stage. This design enables the model to effectively distinguish and restore their respective high-level semantic information and low-level edge information while sharing features. (2) In view of the problem of feature loss in the downsampling process, a feature compression module FCM is designed to reduce the dimension while retaining more spatial information between features, thereby improving the extraction effect of the method for small plots of cultivated land. (3) The spatial group attention mechanism is introduced to enhance the feature representation at different levels, and the accuracy and completeness of land parcel extraction are improved by dynamically adjusting the degree of attention to different spatial regions. The method of the present invention includes three subtasks: semantic segmentation, edge detection and distance mapping, which respectively improve the understanding of internal features of land parcels, the ability to accurately detect boundaries and the fluency of boundary processing. This multi-task collaborative strategy not only improves the accuracy of single tasks, but also enhances the overall land parcel extraction performance through cross-optimization.

[0009] A first aspect of the present invention relates to a multi-task land parcel extraction method, comprising the following steps:

[0010] (1) Create a cultivated land plot dataset based on GF-2 remote sensing images and divide it into a training set and a test set;

[0011] (2) Construct a feature extraction network, improve the Swin Transformer, and obtain the improved network as a feature encoder;

[0012] (3) Design semantic and distance decoders and edge decoders to decode the features extracted by the feature encoder. The encoder and decoder together form a multi-task land parcel extraction model;

[0013] (4) Use a multi-task loss function to supervise the training of the multi-task land parcel extraction model and simultaneously process multiple related tasks to optimize the performance of the model;

[0014] (5) Input the training set into the multi-task land parcel extraction model for training, use the test set to calculate the accuracy of the model, and select the model with the highest accuracy in the test set as the final land parcel extraction model;

[0015] (6) The remote sensing image to be predicted is input into the trained land parcel extraction model, and the sliding window method is used to predict the remote sensing image to obtain the semantic results, distance results and edge results of the land parcel.

[0016] The step (1) specifically comprises the following steps:

[0017] (1a) Download the Gaofen-2 remote sensing image with a spatial resolution of 1 m;

[0018] (1b) Open the downloaded GF-2 remote sensing image in ArcMap, use the marking tool to select areas with abundant plots and features, mark them, and convert the marks into point vector files;

[0019] (1c) Crop the remote sensing image according to the point vector file obtained in step (1b) to obtain an image to be labeled with a size of 1024*1204, and create a surface vector corresponding to the geographical location of each cropped image;

[0020] (1d) Based on the image obtained in step (1c), use the clipping surface tool in ArcMap to edit the surface vector obtained in step (1c) and draw a polygon of the land parcel;

[0021] (1e) performing raster conversion on the surface vector obtained in step (1d) to convert it into a semantic label and an edge label, and obtaining a distance label based on the semantic label using the distance mapping algorithm in OpenCV;

[0022] (1f) Synchronously crop the remote sensing image obtained in step (1c) and the three labels obtained in step (1e) to obtain 1600 pairs of initial sample sets with a size of 256*256;

[0023] (1g) The initial sample set obtained in step (1f) is divided into training set, test set, and validation set in a ratio of 7:2:1.

[0024] The step (2) specifically comprises the following steps:

[0025] (2a) Swin Transformer is used as the basis of the feature extraction network. Swin Transformer consists of a Patch Partition layer and four Stages. The Patch Partition layer divides the input remote sensing image into blocks and inputs the divided data into subsequent Stages for feature extraction. Except for the first Stage, the other three Stages are composed of a Patch Merging module and several Swin Transformer Blocks.

[0026] (2b) A feature compression module (FCM) is designed to replace the Patch Merging module in the original Swin Transformer to reduce the feature resolution and adjust the number of channels.

[0027] The step (3) specifically comprises the following steps:

[0028] (3a) Building a semantic and distance decoder: The semantic and distance decoder first receives the output features of each stage in the encoder as input. In order to enhance the representation ability of the features, make each level focus on information of different scales, and improve the recognition accuracy of small plots of cultivated land, the semantic and distance decoder uses a scale attention mechanism and introduces a spatial group-wise enhancement module (Spatial Group-wise Enhance Module, SGE). By calculating the weights of different spatial groups and applying them to the feature map, it ensures that important spatial features are fully valued and retained, while reducing the interference of non-critical information. In the semantic distance decoder, the features output by each stage are enhanced by spatial group attention, and then the enhanced features are fused layer by layer using the feature fusion module (Feature Fusion Module, FFM). Finally, the fused features are input into two convolutional layers to obtain the semantic output and distance output.

[0029] (3b) The spatial group attention enhancement module transforms the feature matrix x H×W×C It is divided into k groups, each of which contains a series of feature vectors extracted from x. Specifically, x can be represented as a set {x1,…,x m}, in order to redistribute the weight of each spatial point, the SGE module calculates x i The similarity between the feature vector g and the global feature vector g is obtained by global average pooling of the feature vectors of all spatial points, as shown in formula (2). iThe initial attention mask is obtained by performing a dot multiplication with the global feature vector g, as shown in formula (3). In order to avoid the influence of coefficient size deviation between different samples, c is then i Perform standardization, as shown in formula (4);

[0030]

[0031] c i =g·x i (3)

[0032]

[0033] Where m is the product of H and W; x i represents the feature vector of a specific point in the spatial layout of H times W; u d and c i The mean and variance of

[0034] (3c) The feature fusion module first combines the two enhanced feature sets f i 、f j Merge them and input them into a 1×1 convolution layer, batch normalization layer, and ReLU activation function in sequence to obtain the original fusion feature F c , the calculation formula is shown in (5), for the processed feature F c Perform global average pooling to extract global context information, and generate an attention map F through two 1×1 convolutions, ReLU activation function and Sigmoid function g , the calculation formula is shown in (6), the original fusion feature F c The generated attention map F retains spatial and channel information g Perform element-wise multiplication to get F m This operation effectively combines the fused features with the preserved spatial and channel information, and the final output is F m With the original fusion feature F c The sum of , thus achieving the integration of rich features and the retention of key information, its calculation formula is shown in (7):

[0035] F c =ReLU(BatchNorm(Conv(Concate(f i ,f j )))) (5)

[0036] F g =Sigmoid(ReLU(Conv(Conv(F c )))) (6)

[0037] F out =Add(Mul(F c ,F g ),F c ) (7)

[0038] Among them, BatchNorm is batch normalization, ReLU is the rectified linear unit function, Conv represents the convolution layer with a convolution kernel size of 1x1; Mul is element-by-element multiplication, and Add is element-by-element addition;

[0039] (3d) Building an edge decoder: The edge decoder recovers edge information through a bidirectional feature aggregation strategy, which includes a top-down path and a bottom-up path to enhance the information flow in the decoder. Specifically, the edge decoder takes the output features f1, f2, f3, and f4 of the last block in each stage as input; the top-down path uses convolution and deconvolution operations to process each input feature and generate four output features t i , i∈{1,2,3,4}, the calculation formula is shown in (8); at the same time, the bottom-up path starts from the lowest level feature (i.e., f4), gradually merges upward, and finally generates another four output features b through the convolution layer and deconvolution layer. i , i∈{1,2,3,4}, the calculation formula is shown in (9); the eight upsampled features generated by the bidirectional path are connected into a tensor, and a set of additional convolutional layers are used to aggregate the connected features, the calculation formula is shown in (10); finally, the edge decoder will output {F fuse ,t1,t2,t3,t4,b1,b2,b3,b4}, and perform supervised training on each edge probability map.

[0040]

[0041]

[0042] F fuse =Conv(Concate(t1,t2,t3,t4,b1,b2,b3,b4)) (10)

[0043] Among them, BatchNorm is batch normalization, ReLU is the activation function, Conv represents 3x3 convolution, and Deconv is the deconvolution operation.

[0044] The step (4) specifically comprises the following steps:

[0045] (4a) Using semantic loss function to optimize semantic subtask: The semantic loss function uses binary cross entropy (BCE) and Dice coefficient loss to deal with class imbalance and training stability issues. BCE is also called logarithmic loss function. It is usually used in binary classification tasks. It uses logarithmic transformation to measure the difference between model output and actual label, which can effectively avoid the problem of gradient disappearance. The calculation formula of BCE loss function is as follows, where Represents the value of the corresponding pixel in the label, It represents the value of the corresponding pixel in the prediction result:

[0046]

[0047] The Dice loss function is usually used to calculate the similarity between two samples. Its value range is between 0 and 1. Its calculation formula is shown in (12), where Y m and Represent the label and prediction result respectively, ∈ is a small constant used to avoid the situation where the denominator is 0 during calculation:

[0048]

[0049] The total loss of the semantic task is the weighted sum of the BCE loss and the Dice loss, and the calculation formula is shown in (13):

[0050] l seg =0.5 l bce +l dice (13)

[0051] (4b) Use the distance loss function to optimize the distance subtask: The distance loss function uses the mean square error to measure the difference between the predicted distance distribution map and the label. The calculation formula is shown in (14), where and Represent the labels and prediction results of the distance respectively:

[0052]

[0053] (4c) Using edge loss function to optimize edge subtask: The edge detection loss function improves the binary cross entropy (BCE) loss function by introducing two coefficients α and β to weight the loss of edge (positive samples) and non-edge (negative samples). is the edge pixel in the image Tags, is the predicted edge result, therefore, the edge loss of each edge pixel It can be deduced from formula (15):

[0054]

[0055] α and β are defined as shown in formula (16), where γ is a hyperparameter to balance the number of positive and negative samples, and Y + and Y - Represent edge pixels and non-edge pixels respectively;

[0056]

[0057]

[0058] The final edge loss calculation formula is shown in (18), where is the loss of prediction results and labels for each layer from top to bottom, is the loss of prediction results and labels of each layer from bottom to top, It is the loss of the fusion results and labels of each layer;

[0059]

[0060] The step (5) specifically comprises the following steps:

[0061] (5a) Training and testing were performed on the Ubuntu 22.04 operating system, using Anconda to build and manage the virtual environment, and using an NVIDIA A100 (40GB) graphics card to accelerate training;

[0062] (5b) The Adam optimizer is used to optimize the network model parameters and the initial learning rate is set to 10 -4 , the training batch size is set to 16, the test batch size is set to 16, and the number of iterations is set to 100;

[0063] (5c) The model with the highest accuracy on the test set is selected as the final land parcel extraction model.

[0064] The step (6) specifically comprises the following steps:

[0065] (6a) Select the large-area remote sensing image downloaded in (1a) and input it into the final land parcel extraction model. Use a window size of 512*512 to perform sliding window prediction on the image to obtain the semantic segmentation, distance mapping, and edge detection results of the cultivated land parcels.

[0066] (6b) The semantic segmentation results and edge detection results obtained in (6a) are vectorized to obtain the final land extraction results.

[0067] The second aspect of the present invention relates to a multi-task plot extraction device, comprising a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement a multi-task plot extraction method of the present invention.

[0068] A third aspect of the present invention relates to a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements a multi-task land parcel extraction method of the present invention.

[0069] The present invention combines two different but related tasks, semantic segmentation and edge detection. The present invention designs independent semantic and distance decoders and edge decoders for information reconstruction, ensuring the independence of different tasks in the information processing stage. This design enables the model to effectively distinguish and restore its own high-level semantic information and low-level edge information while sharing features. In view of the problem of feature loss in the downsampling process, a feature compression module FCM is designed to retain more spatial information between features while reducing the dimension, thereby improving the extraction effect of the method for small plots of cultivated land. At the same time, the present invention introduces a spatial group attention mechanism to enhance the feature representation at different levels, and dynamically adjusts the degree of attention to different spatial regions to improve the accuracy and completeness of plot extraction. The method of the present invention includes three subtasks: semantic segmentation, edge detection, and distance mapping, which respectively improve the understanding of internal features of plots, the ability to accurately detect boundaries, and the fluency of boundary processing, and improves the accuracy of overall plot extraction through the synergy of multiple tasks.

[0070] It can be seen from the above technical scheme that the beneficial effects of the present invention are: first, the present invention makes full use of the three subtasks of semantic segmentation, edge detection and distance mapping to respectively improve the understanding of internal features of plots, the ability of accurate boundary detection and the smoothness of boundary processing. The multi-task collaborative strategy not only improves the accuracy of single tasks, but also enhances the overall plot extraction performance through cross-optimization; second, the present invention effectively solves the problem of feature loss in the downsampling process by designing a feature compression module, retains more spatial information between features while reducing the dimension, significantly improves the effect of extracting small plots of cultivated land, and reduces the void phenomenon in the semantic results; third, the present invention introduces a spatial group attention mechanism to enhance the feature representation of different levels, and dynamically adjusts the degree of attention to different spatial regions to improve the accuracy and completeness of plot extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] Figure 1(a) to Figure 1(d) Schematic diagram of the plot label data, Figure 1(a) is the original image, Figure 1(b) is the semantic label, Figure 1(c) is the edge label, and Figure 1(d) is the distance label;

[0072] Figure 2 This is the overall network structure diagram of the present invention;

[0073] Figure 3 This is a structural diagram of the characteristic compression module of the present invention;

[0074] Figure 4 This is a structural diagram of the spatial group attention enhancement module of the present invention;

[0075] Figure 5 This is a structural diagram of the feature fusion module of the present invention;

[0076] Figure 6 FIG. 1 is a structural diagram of an edge decoder of the present invention;

[0077] Figure 7(a) to Figure 7(d) This is a multi-task land parcel extraction prediction map of the embodiment method of the present invention, FIG7(a) is the original image, FIG7(b) is the semantic prediction result, FIG7(c) is the edge prediction result, and FIG7(d) is the distance prediction result. DETAILED DESCRIPTION

[0078] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0079] It should be noted that, in the absence of conflict, the features in the following embodiments and implementations may be combined with each other.

[0080] Example 1

[0081] This embodiment relates to a multi-task land extraction method, which includes the following steps:

[0082] (1) Create a cultivated land plot dataset based on GF-2 remote sensing images and divide it into a training set and a test set;

[0083] (2) Construct a feature extraction network, improve the Swin Transformer, and obtain the improved network as a feature encoder;

[0084] (3) Design semantic and distance decoders and edge decoders to decode the features extracted by the feature encoder. The encoder and decoder together form a multi-task land parcel extraction model;

[0085] (4) Use a multi-task loss function to supervise the training of the multi-task land parcel extraction model and simultaneously process multiple related tasks to optimize the performance of the model;

[0086] (5) Input the training set into the multi-task land parcel extraction model for training, use the test set to calculate the accuracy of the model, and select the model with the highest accuracy in the test set as the final land parcel extraction model;

[0087] (6) Input the remote sensing image to be predicted into the trained land parcel extraction model, use the sliding window method to predict the remote sensing image, and obtain the semantic results, distance results and edge results of the land parcel;

[0088] The step (1) specifically comprises the following steps:

[0089] (1a) Download the Gaofen-2 remote sensing image with a spatial resolution of 1 m;

[0090] (1b) Open the downloaded GF-2 remote sensing image in ArcMap, use the marking tool to select areas with abundant plots and features, mark them, and convert the marks into point vector files;

[0091] (1c) Crop the remote sensing image according to the point vector file obtained in step (1b) to obtain an image to be labeled with a size of 1024*1204, and create a surface vector corresponding to the geographical location of each cropped image;

[0092] (1d) Based on the image obtained in step (1c), use the clipping surface tool in ArcMap to edit the surface vector obtained in step (1c) and draw a polygon of the land parcel;

[0093] (1e) The surface vector obtained in step (1d) is raster-converted into a semantic label and an edge label. According to the semantic label, the distance mapping algorithm in OpenCV is used to obtain the distance label. The image and label are shown in FIG1 .

[0094] (1f) Synchronously crop the remote sensing image obtained in step (1c) and the three labels obtained in step (1e) to obtain 1600 pairs of initial sample sets with a size of 256*256;

[0095] (1g) The initial sample set obtained in step (1f) is divided into training set, test set, and validation set in a ratio of 7:2:1.

[0096] The step (2) specifically comprises the following steps:

[0097] (2a) Swin Transformer is used as the basis of the feature extraction network. Swin Transformer consists of a Patch Partition layer and four Stages. The Patch Partition layer divides the input remote sensing image into blocks and inputs the divided data into subsequent Stages for feature extraction. Except for the first Stage, the other three Stages are composed of a Patch Merging module and several Swin Transformer Blocks.

[0098] (2b) A feature compression module (FCM) is designed to replace the Patch Merging module in the original Swin Transformer to reduce the feature resolution and adjust the number of channels. The FCM model structure is shown in Figure (3).

[0099] The step (3) specifically comprises the following steps:

[0100] (3a) Building a semantic and distance decoder: The semantic and distance decoder first receives the output features of each stage in the encoder as input. In order to enhance the representation ability of the features, make each level focus on information of different scales, and improve the recognition accuracy of small plots of cultivated land, the semantic and distance decoder uses a scale attention mechanism and introduces a spatial group-wise enhancement module (Spatial Group-wise Enhance Module, SGE). By calculating the weights of different spatial groups and applying them to the feature map, it ensures that important spatial features are fully valued and retained, while reducing the interference of non-critical information. In the semantic distance decoder, the features output by each stage are enhanced by spatial group attention, and then the enhanced features are fused layer by layer using the feature fusion module (Feature Fusion Module, FFM). Finally, the fused features are input into two convolutional layers to obtain the semantic output and distance output.

[0101] (3b) The spatial group attention enhancement module is shown in Figure (4), where the feature matrix x H×W×C Divide into k groups, each group contains a series of feature vectors extracted from x. Specifically, x can be represented as a set {x1,…,x m}, in order to redistribute the weight of each spatial point, the SGE module calculates x i The similarity between the feature vector g and the global feature vector g is obtained by global average pooling of the feature vectors of all spatial points, as shown in formula (2). iThe initial attention mask is obtained by performing a dot multiplication with the global feature vector g, as shown in formula (3). In order to avoid the influence of coefficient size deviation between different samples, c is then i Perform standardization, as shown in formula (4);

[0102]

[0103] c i =g·x i (3)

[0104]

[0105] Where m is the product of H and W; x i represents the feature vector of a specific point in the spatial layout of H times W; u d and c i The mean and variance of

[0106] (3c) The feature fusion module is shown in Figure (5). First, the two sets of enhanced features f i 、f j Merge them and input them into a 1×1 convolution layer, batch normalization layer, and ReLU activation function in sequence to obtain the original fusion feature F c , the calculation formula is shown in (5), for the processed feature F c Perform global average pooling to extract global context information, and generate an attention map F through two 1×1 convolutions, ReLU activation function and Sigmoid function g , the calculation formula is shown in (6), the original fusion feature F c The generated attention map F retains spatial and channel information g Perform element-wise multiplication to get F m This operation effectively combines the fused features with the preserved spatial and channel information, and the final output is F m With the original fusion feature F c The sum of , thus achieving the integration of rich features and the retention of key information, its calculation formula is shown in (7):

[0107] F c =ReLU(BatchNorm(Conv(Concate(f i ,f j )))) (5)

[0108] F g =Sigmoid(ReLU(Conv(Conv(F c )))) (6)

[0109] F out =Add(Mul(F c ,F g ),F c ) (7)

[0110] Among them, BatchNorm is batch normalization, ReLU is the rectified linear unit function, Conv represents the convolution layer with a convolution kernel size of 1x1; Mul is element-by-element multiplication, and Add is element-by-element addition;

[0111] (3d) Building an edge decoder: The edge decoder is shown in Figure (6). It recovers edge information through a bidirectional feature aggregation strategy, which includes a top-down path and a bottom-up path to enhance the information flow in the decoder. Specifically, the edge decoder takes the output features f1, f2, f3, and f4 of the last block in each stage as input; the top-down path uses convolution and deconvolution operations to process each input feature and generate four output features t i , i∈{1,2,3,4}, the calculation formula is shown in (8); at the same time, the bottom-up path starts from the lowest level feature (i.e., f4), gradually merges upward, and finally generates another four output features b through the convolution layer and deconvolution layer. i , i∈{1,2,3,4}, the calculation formula is shown in (9); the eight upsampled features generated by the bidirectional path are connected into a tensor, and a set of additional convolutional layers are used to aggregate the connected features, the calculation formula is shown in (10); finally, the edge decoder will output {F fuse ,t1,t2,t3,t4,b1,b2,b3,b4}, and perform supervised training on each edge probability map.

[0112]

[0113]

[0114] F fuse =Conv(Concate(t1,t2,t3,t4,b1,b2,b3,b4)) (10)

[0115] Among them, BatchNorm is batch normalization, ReLU is the activation function, Conv represents 3x3 convolution, and Deconv is the deconvolution operation.

[0116] The step (4) specifically comprises the following steps:

[0117] (4a) Using semantic loss function to optimize semantic subtask: The semantic loss function uses binary cross entropy (BCE) and Dice coefficient loss to deal with class imbalance and training stability issues. BCE is also called logarithmic loss function. It is usually used in binary classification tasks. It uses logarithmic transformation to measure the difference between model output and actual label, which can effectively avoid the problem of gradient disappearance. The calculation formula of BCE loss function is as follows, where Represents the value of the corresponding pixel in the label, It represents the value of the corresponding pixel in the prediction result:

[0118]

[0119] The Dice loss function is usually used to calculate the similarity between two samples. Its value range is between 0 and 1. Its calculation formula is shown in (12), where Y m and Represents the label and prediction result respectively, ∈ is set to 10 -5 , used to avoid the situation where the denominator is 0 during calculation:

[0120]

[0121] The total loss of the semantic task is the weighted sum of the BCE loss and the Dice loss, and the calculation formula is shown in (13):

[0122] l seg =0.5 l bce +l dice (13)

[0123] (4b) Use the distance loss function to optimize the distance subtask: The distance loss function uses the mean square error to measure the difference between the predicted distance distribution map and the label. The calculation formula is shown in (14), where and Represent the labels and prediction results of the distance respectively:

[0124]

[0125] (4c) Using edge loss function to optimize edge subtask: The edge detection loss function improves the binary cross entropy (BCE) loss function by introducing two coefficients α and β to weight the loss of edge (positive samples) and non-edge (negative samples). is the edge pixel in the image Tags, is the predicted edge result, therefore, the edge loss of each edge pixel It can be deduced from formula (15):

[0126]

[0127] α and β are defined as shown in formula (16), where γ is a hyperparameter for balancing the number of positive and negative samples and is set to 0.5. + and Y - Represent edge pixels and non-edge pixels respectively;

[0128]

[0129]

[0130] The final edge loss calculation formula is shown in (18), where is the loss of prediction results and labels for each layer from top to bottom, is the loss of prediction results and labels of each layer from bottom to top, It is the loss of the fusion results and labels of each layer;

[0131]

[0132] The step (5) specifically comprises the following steps:

[0133] (5a) Training and testing were performed on the Ubuntu 22.04 operating system, using Anconda to build and manage the virtual environment, and using an NVIDIA A100 (40GB) graphics card to accelerate training;

[0134] (5b) The Adam optimizer is used to optimize the network model parameters and the initial learning rate is set to 10 -4 , the training batch size is set to 16, the test batch size is set to 16, and the number of iterations is set to 100;

[0135] (5c) The model with the highest accuracy on the test set is selected as the final land parcel extraction model.

[0136] The step (6) specifically comprises the following steps:

[0137] (6a) Select the large-area remote sensing image downloaded in (1a) and input it into the final land parcel extraction model. Use a window size of 512*512 to perform sliding window prediction on the image to obtain the semantic segmentation, distance mapping, and edge detection results of the cultivated land parcels.

[0138] (6b) The semantic segmentation results and edge detection results obtained in (6a) are vectorized to obtain the final land extraction results.

[0139] like Figure 2As shown in the figure, the multi-task land parcel extraction model consists of the following key parts: (1) Feature encoder: The feature encoder is the basic component of the entire multi-task network. Its function is to extract meaningful feature representations from the input data. The feature extraction network used here is improved based on the Swin Transformer. (2) Semantic and distance decoder: In the semantic and distance decoder, the features obtained by the Transformer Block are first input into the Spatial Group-wise Attention Module (SGE) to enhance its spatial context information. Then, the multi-layer features in the encoder are fused layer by layer through the Feature Fusion Module (FFM) to restore the resolution to the same size as the original image. Finally, two output heads are used to output the semantic results and distance results respectively. (3) Edge decoder: The edge decoder adopts a multi-scale bidirectional supervision method to guide the edge. It not only aggregates from low-level features to high-level features (bottom-up), but also transfers context information from high-level features to low-level features (top-down). This method can enable effective information exchange between different layers to improve the detection ability of small land parcel edges.

[0140] like Figure 7(a) to Figure 7(d) As shown, an image with more cultivated land in the test set is selected to demonstrate the multi-task land parcel extraction model of the present invention. The semantic results extracted by the model have few holes, the land parcels are relatively complete, the edge results fit the real boundaries of the land parcels, and there are fewer breaks. The distance mapping results are close to the real labels.

[0141] In summary, the present invention makes full use of the three subtasks of semantic segmentation, edge detection and distance mapping, which respectively improve the understanding of internal features of plots, the ability of accurate boundary detection and the fluency of boundary processing, and enhance the overall plot extraction performance; the feature compression module of the present invention effectively solves the problem of feature loss in the downsampling process, retains more spatial information between features while reducing the dimension, significantly improves the effect of small plots of cultivated land extraction, and reduces the void phenomenon in the semantic results; the spatial group attention mechanism introduced in the present invention enhances the feature representation at different levels, and improves the accuracy and completeness of plot extraction by dynamically adjusting the degree of attention to different spatial areas.

[0142] Example 2

[0143] The present embodiment relates to a multi-task plot extraction device, comprising a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement a multi-task plot extraction method of embodiment 1.

[0144] Example 3

[0145] This embodiment relates to a computer-readable storage medium on which a program is stored. When the program is executed by a processor, a multi-task land parcel extraction method of embodiment 1 is implemented.

[0146] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims

1. A multi-task land parcel extraction method, characterized in that: The following steps are involved: (1) Create a cultivated land plot dataset based on GF-2 remote sensing images and divide it into a training set and a test set; (2) Construct a feature extraction network, improve the Swin Transformer, and obtain the improved network as a feature encoder; (3) Design semantic and distance decoders and edge decoders to decode the features extracted by the feature encoder. The encoder and decoder together form a multi-task land parcel extraction model; (4) Use a multi-task loss function to supervise the training of the multi-task land parcel extraction model and simultaneously process multiple related tasks to optimize the performance of the model; (5) Input the training set into the multi-task land parcel extraction model for training, use the test set to calculate the accuracy of the model, and select the model with the highest accuracy in the test set as the final land parcel extraction model; (6) The remote sensing image to be predicted is input into the trained land parcel extraction model, and the sliding window method is used to predict the remote sensing image to obtain the semantic results, distance results and edge results of the land parcel.

2. A multi-task land parcel extraction method according to claim 1, characterized in that: The step (1) specifically comprises the following steps: (1a) Download the Gaofen-2 remote sensing image with a spatial resolution of 1 m; (1b) Open the downloaded GF-2 remote sensing image in ArcMap, use the marking tool to select areas with abundant plots and features, mark them, and convert the marks into point vector files; (1c) Crop the remote sensing image according to the point vector file obtained in step (1b) to obtain an image to be labeled with a size of 1024*1204, and create a surface vector corresponding to the geographical location of each cropped image; (1d) Based on the image obtained in step (1c), use the clipping surface tool in ArcMap to edit the surface vector obtained in step (1c) and draw a polygon of the land parcel; (1e) performing raster conversion on the surface vector obtained in step (1d) to convert it into a semantic label and an edge label, and obtaining a distance label based on the semantic label using the distance mapping algorithm in OpenCV; (1f) Synchronously crop the remote sensing image obtained in step (1c) and the three labels obtained in step (1e) to obtain 1600 pairs of initial sample sets with a size of 256*256; (1g) The initial sample set obtained in step (1f) is divided into training set, test set, and validation set in a ratio of 7:2:

1.

3. A multi-task land parcel extraction method according to claim 1, characterized in that: The step (2) specifically comprises the following steps: (2a) Swin Transformer is used as the basis of the feature extraction network. Swin Transformer consists of a Patch Partition layer and four Stages. The Patch Partition layer divides the input remote sensing image into blocks and inputs the divided data into subsequent Stages for feature extraction. Except for the first Stage, the other three Stages are composed of a Patch Merging module and several Swin Transformer Blocks. (2b) A feature compression module (FCM) is designed to replace the Patch Merging module in the original Swin Transformer to reduce the feature resolution and adjust the number of channels.

4. The multi-task land parcel extraction method according to claim 1, characterized in that: The step (3) specifically comprises the following steps: (3a) Building a semantic and distance decoder: The semantic and distance decoder first receives the output features of each stage in the encoder as input. In order to enhance the representation ability of the features, make each level focus on information of different scales, and improve the recognition accuracy of small plots of cultivated land, the semantic and distance decoder uses a scale attention mechanism and introduces a spatial group-wise enhancement module (Spatial Group-wise Enhance Module, SGE). By calculating the weights of different spatial groups and applying them to the feature map, it ensures that important spatial features are fully valued and retained, while reducing the interference of non-critical information. In the semantic distance decoder, the features output by each stage are enhanced by spatial group attention, and then the enhanced features are fused layer by layer using the feature fusion module (Feature Fusion Module, FFM). Finally, the fused features are input into two convolutional layers to obtain the semantic output and distance output. (3b) The spatial group attention enhancement module transforms the feature matrix x H×W×C It is divided into k groups, each of which contains a series of feature vectors extracted from x. Specifically, x can be represented as a set {x1,…,x m }, in order to redistribute the weight of each spatial point, the SGE module calculates x i The similarity between the feature vector xi and the global feature vector g is obtained by global average pooling of the feature vectors of all spatial points, as shown in formula (2). Each set of features xi is multiplied by the global feature vector g to obtain the initial attention mask, as shown in formula (3). In order to avoid the influence of coefficient size deviation between different samples, c is then i Perform standardization, as shown in formula (4); c i =g·x i (3) Where m is the product of H and W; x i represents the feature vector of a specific point in the spatial layout of H times W; u d and c i The mean and variance of (3c) The feature fusion module first combines the two enhanced feature sets f i 、f j Merge them and input them into a 1×1 convolution layer, batch normalization layer, and ReLU activation function in sequence to obtain the original fusion feature F c , the calculation formula is shown in (5), for the processed feature F c Perform global average pooling to extract global context information, and generate an attention map F through two 1×1 convolutions, ReLU activation function and Sigmoid function g , the calculation formula is shown in (6), the original fusion feature F c The generated attention map F retains spatial and channel information g Perform element-wise multiplication to get F m This operation effectively combines the fused features with the preserved spatial and channel information, and the final output is F m With the original fusion feature F c The sum of , thus achieving the integration of rich features and the retention of key information, its calculation formula is shown in (7): F c =ReLU(BatchNorm(Conv(Concate(f i ,f j )))) (5) F g =Sigmoid(ReLU(Conv(Conv(F c )))) (6) F out =Add(Mul(F c ,F g ),F c ) (7) Among them, BatchNorm is batch normalization, ReLU is the rectified linear unit function, Conv represents the convolution layer with a convolution kernel size of 1x1; Mul is element-by-element multiplication, and Add is element-by-element addition; (3d) Building an edge decoder: The edge decoder recovers edge information through a bidirectional feature aggregation strategy, which includes a top-down path and a bottom-up path to enhance the information flow in the decoder. Specifically, the edge decoder takes the output features f1, f2, f3, and f4 of the last block in each stage as input; the top-down path uses convolution and deconvolution operations to process each input feature and generate four output features t i , i∈{1,2,3,4}, the calculation formula is shown in (8); at the same time, the bottom-up path starts from the lowest level feature (i.e., f4), gradually merges upward, and finally generates another four output features b through the convolution layer and deconvolution layer. i , i∈{1,2,3,4}, the calculation formula is shown in (9); the eight upsampled features generated by the bidirectional path are connected into a tensor, and a set of additional convolutional layers are used to aggregate the connected features, the calculation formula is shown in (10); finally, the edge decoder will output {F fuse ,t1,t2,t3,t4,b1,b2,b3,b4}, and perform supervised training on each edge probability map. F fuse =Conv(Concate(t1,t2,t3,t4,b1,b2,b3,b4)) (10) Among them, BatchNorm is batch normalization, ReLU is the activation function, Conv represents 3x3 convolution, and Deconv is the deconvolution operation.

5. The multi-task land parcel extraction method according to claim 1, characterized in that: The step (4) specifically comprises the following steps: (4a) Using semantic loss function to optimize semantic subtask: The semantic loss function uses binary cross entropy (BCE) and Dice coefficient loss to deal with class imbalance and training stability issues. BCE is also called logarithmic loss function. It is usually used in binary classification tasks. It uses logarithmic transformation to measure the difference between model output and actual label, which can effectively avoid the problem of gradient disappearance. The calculation formula of BCE loss function is as follows, where Represents the value of the corresponding pixel in the label, It represents the value of the corresponding pixel in the prediction result: The Dice loss function is usually used to calculate the similarity between two samples. Its value range is between 0 and 1. Its calculation formula is shown in (12), where Y m and Represent the label and prediction result respectively, ∈ is a small constant used to avoid the situation where the denominator is 0 during calculation: The total loss of the semantic task is the weighted sum of the BCE loss and the Dice loss, and the calculation formula is shown in (13): l seg =0.5·l bce +l dice (13) (4b) Use the distance loss function to optimize the distance subtask: The distance loss function uses the mean square error to measure the difference between the predicted distance distribution map and the label. The calculation formula is shown in (14), where and Represent the labels and prediction results of the distance respectively: (4c) Using edge loss function to optimize edge subtask: The edge detection loss function improves the binary cross entropy (BCE) loss function by introducing two coefficients α and β to weight the loss of edge (positive samples) and non-edge (negative samples). is the edge pixel in the image Tags, is the predicted edge result, therefore, the edge loss of each edge pixel It can be deduced from formula (15): α and β are defined as shown in formula (16), where γ is a hyperparameter to balance the number of positive and negative samples, and Y + and Y - Represent edge pixels and non-edge pixels respectively; The final edge loss calculation formula is shown in (18), where is the loss of prediction results and labels for each layer from top to bottom, is the loss of prediction results and labels of each layer from bottom to top, It is the loss of the fusion results and labels of each layer; 6. A multi-task land parcel extraction method according to claim 1, characterized in that: The step (5) specifically comprises the following steps: (5a) Training and testing were performed on the Ubuntu 22.04 operating system, using Anconda to build and manage the virtual environment, and using an NVIDIA A100 (40GB) graphics card to accelerate training; (5b) The Adam optimizer is used to optimize the network model parameters and the initial learning rate is set to 10 -4 , the training batch size is set to 16, the test batch size is set to 16, and the number of iterations is set to 100; (5c) The model with the highest accuracy on the test set is selected as the final land parcel extraction model.

7. The multi-task land parcel extraction method according to claim 1, characterized in that: The step (6) specifically comprises the following steps: (6a) Select the large-area remote sensing image downloaded in (1a) and input it into the final land parcel extraction model. Use a window size of 512*512 to perform sliding window prediction on the image to obtain the semantic segmentation, distance mapping, and edge detection results of the cultivated land parcels. (6b) The semantic segmentation results and edge detection results obtained in (6a) are vectorized to obtain the final land extraction results.

8. A multi-task land extraction device, characterized in that: It comprises a memory and one or more processors, wherein the memory stores executable codes, and when the one or more processors execute the executable codes, they are used to implement a multi-task land parcel extraction method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: A program is stored thereon, and when the program is executed by a processor, a multi-task land parcel extraction method according to any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Seawater buoyant raft cultivation information extraction method based on interpretable polarization deep learning network

    CN119851158A