Building extraction method and system of unified grid vector, and electronic equipment
By using the target query learning framework and spatial binary division technology in remote sensing image processing, unifying raster and vector predictions solves the problems of poor robustness and generalization ability of building extraction in the existing technology, and achieves high resolution Stable and accurate extraction of buildings in remote sensing images.
Patent Information
- Application Number
- CN202410716163.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-08-30
AI Technical Summary
When existing technology extracts buildings from high-resolution remote sensing images, its robustness and generalization capabilities are poor, and the multi-stage processing method cannot achieve global optimization, or does not consider surface information, resulting in unstable results.
It adopts a learning framework based on target query, combines binary space partitioning (BSP) and Transformer decoder, unifies raster and vector prediction, and predicts categories, segmentation masks and straight line parameters through multi-layer perceptrons to construct the vector outline of the building. .
It achieves the accuracy and regularity of building extraction in high-resolution remote sensing images, while improving the robustness and generalization capabilities to obtain stable end-to-end extraction results.
Smart Images

Figure CN118570641A
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of deep learning technology, remote sensing image processing and computer vision technology, and in particular to a unified raster vector building extraction method, system and electronic equipment. Background Art
[0002] As the most important type of man-made objects, extracting buildings from high-resolution remote sensing images has always been a hot topic in academia and industry. With the development of deep learning technology, the effect of building extraction has been continuously improved. The current mainstream method is pixel-by-pixel classification, that is, pixel classification is achieved based on semantic segmentation technology in the field of computer vision combined with remote sensing characteristics, and then supplemented with necessary post-processing algorithms such as vectorization and regularization. Many scholars have also studied the extraction of key points on the building outline and the connection relationship between key points to achieve end-to-end vector outline extraction. This type of method can obtain more accurate contour lines while retaining the regularity of the building, but the robustness and generalization ability are poor.
[0003] The pixel-by-pixel classification algorithm based on surface information can achieve stable extraction of buildings from high-resolution remote sensing images, but generally requires post-processing such as vectorization and regularization. This type of multi-stage processing method cannot achieve global optimization. Another type of method that extracts key points and predicts the connection relationship between points is often unstable because it does not consider surface information. To this end, the present invention proposes a unified remote sensing image building raster and vector extraction using a learning framework based on object query. Summary of the invention
[0004] In view of the technical problems existing in the prior art, the present invention proposes a unified raster vector building extraction method, system and electronic equipment. The present invention constructs the building vector outline based on BSP, and uses a target query-based framework to unify the remote sensing image raster prediction and vector prediction, so that the extraction result remains accurate and regular.
[0005] According to a first aspect of the present invention, the present invention provides a unified grid vector building extraction method, comprising the following steps:
[0006] Step S1. Collect image data similar to the training data and pre-process the sample images;
[0007] Step S2. Extracting features from the preprocessed image;
[0008] Step S3. Pixel decoding is performed on the image data after feature extraction to obtain a feature pyramid;
[0009] Step S4. Input the feature pyramid and the target query device into the Transformer decoder, and use the Transformer decoder to update the target query device;
[0010] Step S5. Use a multi-layer perceptron to perform category prediction and segmentation mask prediction on queries at each level, and combine with BSPNet to extract building vectors to obtain a loss function; the loss function is cross entropy, Dice loss, and L1 loss;
[0011] Step S6: Count the loss function, perform back-propagation iteration to update the model parameters, and output the model.
[0012] Based on the above technical solution, the present invention can also make the following improvements.
[0013] Optionally, the preprocessing of the sample image includes:
[0014] The mean and variance of the pixel RGB values in the sample image data are respectively counted as prior information. Based on the prior mean and variance, the pixel values of the three-band images are normalized and enhanced in different ways.
[0015] Optionally, the feature extraction of the preprocessed image includes:
[0016] Feature extraction is performed on the preprocessed image based on the SwinTransformer backbone network.
[0017] Optionally, the pixel decoding of the image data after feature extraction includes:
[0018] Drawing on the Mask2former approach, a multi-scale convolutional pixel decoder is used to decode the features of the previous step to obtain feature pyramids at four scales.
[0019] Optionally, inputting the feature pyramid and the target query device into a Transformer decoder, and updating the target query device using the Transformer decoder includes:
[0020] The feature pyramid and target query are input into the Transformer decoder, and the object queries are updated using the mask-based attention mechanism.
[0021] Optionally, updating the target query device by using a Transformer decoder includes:
[0022] The cross-attention calculation is limited to the foreground area of the predicted mask to extract local features and reduce the amount of computation. The multi-scale strategy and Transformer decoder are combined to cyclically perform self-attention and cross-attention calculations at different network levels, so that each query accurately corresponds to a target building.
[0023] Optionally, the using of a multi-layer perceptron to perform category prediction and segmentation mask prediction on queries at each level, and combining with BSPNet to perform vector extraction of buildings includes:
[0024] First, a multi-layer perceptron is used to predict the category of queries at each level. At this time, the loss function is cross entropy.
[0025] Secondly, a multi-layer perceptron is used to predict the straight line parameter group. Each group of straight lines is composed of multiple convex polygons. Multiple convex polygons are superimposed as the outline of the target building. The vector of the building is extracted by combining BSPNet. At this time, the loss function is L1 loss.
[0026] Finally, a multi-layer perceptron is used to predict the segmentation mask for each level of query. At this time, the loss function is cross entropy and Dice loss.
[0027] Optionally, the loss function is expressed as:
[0028] loss=Cls ce +Mask ce +ask dice +Line l1
[0029] Among them, loss is the total loss, Cls ce Expressed as category cross entropy loss, Mask ce Expressed as segmentation mask cross entropy loss, ask dice Represented as segmentation mask Dice loss,ine l1 It is represented as a straight line L1 loss.
[0030] According to a second aspect of the present invention, there is provided a unified grid vector building extraction system, comprising:
[0031] The first processing module is used to collect image data similar to the training data, and pre-process the sample images; and extract features from the pre-processed images;
[0032] The second processing module is used to decode the image data after feature extraction to obtain a feature pyramid; and input the feature pyramid and the target query device into the Transformer decoder, and update the target query device using the Transformer decoder;
[0033] The third processing module is used to use a multi-layer perceptron to perform category prediction and segmentation mask prediction on the query of each level, and combine BSPNet to extract the vector of the building to obtain a loss function; the loss function is cross entropy, Dice loss and L1 loss;
[0034] The fourth processing module is used to count the loss function, perform back-propagation iteration to update the model parameters, and output the model.
[0035] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a unified grid vector building extraction method as described in any one of the above is implemented.
[0036] Technical effects and advantages of the present invention:
[0037] The present invention proposes a unified raster vector building extraction method, system and electronic device, which models the building vector outline as a combination of multiple convex polygons based on spatial binary partitioning (BSP), uses a learning framework based on object query, unifies raster classification and vector prediction into one framework, obtains pixel-by-pixel classification results and extracts vector boundary lines that constitute the building at the same time, calculates multiple convex polygons through topological processing between straight lines, and then combines them to obtain vectorized building outlines, thereby realizing end-to-end high-resolution remote sensing image building extraction.
[0038] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a flow chart of a building extraction method of unified raster vectors provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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.
[0041] It is understandable that based on the defects in the background technology, the embodiment of the present invention proposes a building extraction method of unified raster vectors, specifically as follows: Figure 1As shown, the method comprises the following steps:
[0042] Step S1, collecting image data similar to the training data, and preprocessing the sample images;
[0043] The preprocessing of the sample image comprises:
[0044] The mean and variance of the pixel RGB values in the sample image data are respectively counted as prior information. Based on the prior mean and variance, the pixel values of the three-band images are normalized and enhanced in different ways.
[0045] In the embodiment of the present invention, the sample image is three-band eight-bit. The normalization of the three-band image pixel values based on the prior mean and variance specifically includes:
[0046] First, a large amount of image data similar to the training data is collected, and the mean and variance var of the pixel RGB values are counted as prior information. The sample images are standardized based on the prior mean and variance, that is, y uj =x ij -mean) / var, where x ij Represents the pixel value of the pixel in the i-th row and j-th column of the original image, y ij Represents the normalized pixel value. Then, different image enhancement methods are used to achieve sample augmentation.
[0047] Different enhancement methods include: random flipping, random scaling (scaling factor is 0.5-2.0), random cropping, spectral randomization and other enhancement methods.
[0048] Step S2, inputting the preprocessed image into the backbone network for feature extraction;
[0049] In this embodiment, feature extraction is performed on the preprocessed image based on the SwinTransformer backbone network. Feature extraction here means inputting the image into the backbone network, and the calculation result is the corresponding feature. The SwinTransformer backbone network constructs a hierarchical feature map of the image based on linear computational complexity through the design of mobile panes and hierarchical expression.
[0050] Step S3, performing pixel decoding on the image data after feature extraction to obtain a feature pyramid;
[0051] The pixel decoding of the image data after feature extraction comprises:
[0052] Drawing on the Mask2former approach, a multi-scale convolutional pixel decoder is used to decode the features of the previous step to obtain feature pyramids at four scales.
[0053] In this embodiment, if the width and height of the original image are W and H, the feature maps of four scales extracted are recorded as: 256*W / 4*H / 4, 256*W / 8*H / 8, 256*W / 16*H / 16, and 256*W / 32*H / 32.
[0054] Step S4: input the feature pyramid and the target query device into the Transformer decoder, and use the Transformer decoder to update the target query device;
[0055] It should be noted that Object queries are a set of learnable vectors, each of which represents a potential building object.
[0056] In this embodiment, the feature pyramid and object queries are input into the Transformer decoder, and the mask-based attention mechanism is used to update the object queries. By limiting the cross-attention calculation to the foreground area of the predicted mask, more accurate local features are extracted and the amount of calculation is reduced; the multi-scale strategy and the Transformer decoder are combined to perform self-attention and cross-attention calculations in different network layers, so that each query accurately corresponds to a target building.
[0057] The goal of the Transformer decoder is to predict the next output element (such as the next word in a translation) based on the output of the encoder and the previously generated output sequence. The decoder also contains multiple identical layers, but each layer has three main sublayers. In addition to the two sublayers in the encoder (multi-head self-attention and feedforward network), the decoder adds a third sublayer in between the two, the Encoder-Decoder Attention layer (Encoder-DecoderAttention). In this layer, the decoder queries the encoder's output with its own output so far, so that the previous context information can be aligned with the part that needs to be predicted at the moment.
[0058] Step S5, using a multi-layer perceptron to perform category prediction and segmentation mask prediction on queries at each level, and combining BSPNet to extract building vectors to obtain a loss function; the loss function is cross entropy, Dice loss and L1 loss;
[0059] The multi-layer perceptron is used to predict the category and segmentation mask of each level of query, and combined with BSPNet to extract the vector of the building, and the loss function obtained includes:
[0060] First, a multi-layer perceptron (MLP) is used to predict the category of the query at each level. At this time, the loss function is the cross entropy, and the loss is recorded as Clsce ;
[0061] Then, a multi-layer perceptron is used to predict the straight line parameter group. Each group of straight lines forms multiple convex polygons. Multiple convex polygons are superimposed as the target building outline. Building vectors are extracted in combination with BSPNet. At this time, the loss function is L1 loss. The steps specifically include:
[0062] Based on each query, an MLP is used to predict the line parameter (group), and the line parameter is represented by L l*3 , random sampling of point coordinates is performed in the plane space (sample), and the point coordinates are represented by homogeneous coordinates, denoted by X n*3 , the signed distance from the point to the line is D n*l =L T , each group of straight lines forms multiple convex polygons, and the corresponding weight is recorded as T l*c ; then the sum of the distances from the point to the convex polygon is defined as C n*c =elu(XL T ), multiple convex polygons are superimposed as the outline of the target building, and the distance from the point to the polygon is defined as
[0063] That is, if the point is inside the polygon, the value is 0, otherwise it is positive. The loss function is recorded as Line l1 =GT X *max((),0)+(1-GT X )*min(S(X),1), where GT X is the true value (label) of the sampling point.
[0064] Finally, a multi-layer perceptron (MLP) is used to predict the segmentation mask of each level of query. At this time, the loss function is cross entropy and Dice loss, denoted as Mask ce 、Mask dice .
[0065] Finally, after the above operations, the final loss function is obtained; the loss function includes cross entropy, Dice loss and L1 loss.
[0066] Step S6: Count the loss function, perform back-propagation iteration to update model parameters, and output the model.
[0067] Specifically, the loss function of the present invention is loss=Cls ce +Mask ce +ask dice +Line l1 , where loss is the total loss, Cls ce Expressed as category cross entropy loss, Mask ceExpressed as segmentation mask cross entropy loss, ask dice Represented as segmentation mask Dice loss,ine l1 It is expressed as a linear L1 loss. Through the above technical solution, 200 queries are set by default, each query dimension is 256, and n=10240, l=256, and c=64 are taken in polygon prediction.
[0068] The embodiment of the present invention proposes a unified raster vector building extraction method, introduces the idea of spatial binary division into deep learning building contour extraction, obtains multiple convex polygons through straight line prediction and combines them into building contours, combines boundary and surface information, and improves robustness; uses a target query-based learning framework to unify multiple subtasks and jointly perform building raster and vector extraction. The core idea of the present invention is to use SwinTransfomer to extract image features and perform pixel decoding to obtain a multi-scale feature map, then perform Transformer decoding in conjunction with a learnable target query, and finally use a multi-layer perceptron (MLP) to perform category, vector, and segmentation mask prediction respectively, unifying multiple subtasks into a framework to improve detection robustness. The present invention has been fully verified in actual experiments and has obtained stable and reliable results.
[0069] According to a second aspect of the present invention, an embodiment of the present invention provides a unified grid vector building extraction system, comprising:
[0070] The first processing module is used to collect image data similar to the training data, and pre-process the sample images; and extract features from the pre-processed images;
[0071] The second processing module is used to decode the image data after feature extraction to obtain a feature pyramid; and input the feature pyramid and the target query device into the Transformer decoder, and update the target query device using the Transformer decoder;
[0072] The third processing module is used to use a multi-layer perceptron to perform category prediction and segmentation mask prediction on the query of each level, and combine BSPNet to extract the vector of the building to obtain a loss function; the loss function is cross entropy, Dice loss and L1 loss;
[0073] The fourth processing module is used to count the loss function, perform back-propagation iteration to update the model parameters, and output the model.
[0074] It can be understood that a unified raster vector building extraction system provided in an embodiment of the present invention corresponds to a unified raster vector building extraction method provided in the aforementioned embodiments. The relevant technical features of a unified raster vector building extraction system can refer to the relevant technical features of a unified raster vector building extraction method, which will not be repeated here.
[0075] According to a third aspect of the present invention, an embodiment of the present invention further provides an electronic device, which may include: a processor, a communications interface, a memory, and a communication bus, wherein the processor, the communications interface, and the memory communicate with each other via the communication bus. The processor may call logic instructions in the memory to execute the steps of the above-mentioned unified grid vector building extraction method, including:
[0076] Step S1. Collect image data similar to the training data and pre-process the sample images;
[0077] Step S2. Extracting features from the preprocessed image;
[0078] Step S3. Pixel decoding is performed on the image data after feature extraction to obtain a feature pyramid;
[0079] Step S4. Input the feature pyramid and the target query device into the Transformer decoder, and use the Transformer decoder to update the target query device;
[0080] Step S5. Use a multi-layer perceptron to perform category prediction and segmentation mask prediction on queries at each level, and combine with BSPNet to extract building vectors to obtain a loss function; the loss function is cross entropy, Dice loss, and L1 loss;
[0081] Step S6: Count the loss function, perform back-propagation iteration to update the model parameters, and output the model.
[0082] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0083] In summary, the embodiments of the present invention propose a unified raster vector building extraction method, system and electronic device, which models the building vector outline as a combination of multiple convex polygons based on spatial binary partitioning (BSP), uses a learning framework based on object query, unifies raster classification and vector prediction into one framework, obtains pixel-by-pixel classification results and extracts vector boundary lines that constitute the building, calculates multiple convex polygons through topological processing between straight lines, and then combines them to obtain vectorized building outlines, thereby realizing end-to-end high-resolution remote sensing image building extraction.
[0084] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0085] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A building extraction method of unified raster vector, characterized in that: The following steps are involved: Step S1. Collect image data similar to the training data and pre-process the sample images; Step S2. Extracting features from the preprocessed image; Step S3. Pixel decoding is performed on the image data after feature extraction to obtain a feature pyramid; Step S4. Input the feature pyramid and the target query device into the Transformer decoder, and use the Transformer decoder to update the target query device; Step S5. Use a multi-layer perceptron to perform category prediction and segmentation mask prediction on queries at each level, and combine with BSPNet to extract building vectors to obtain a loss function; the loss function is cross entropy, Dice loss, and L1 loss; Step S6: Count the loss function, perform back-propagation iteration to update the model parameters, and output the model.
2. The building extraction method of unified grid vector according to claim 1, characterized in that: The preprocessing of the sample image comprises: The mean and variance of the pixel RGB values in the sample image data are respectively counted as prior information. Based on the prior mean and variance, the pixel values of the three-band images are normalized and enhanced in different ways.
3. The building extraction method of unified grid vector according to claim 1, characterized in that: The feature extraction of the preprocessed image comprises: Feature extraction is performed on the preprocessed image based on the SwinTransformer backbone network.
4. The building extraction method of unified grid vector according to claim 1, characterized in that: The pixel decoding of the image data after feature extraction comprises: Drawing on the Mask2former approach, a multi-scale convolutional pixel decoder is used to perform pixel decoding on the extracted features to obtain feature pyramids at multiple scales.
5. The building extraction method of unified grid vector according to claim 1, characterized in that: The feature pyramid and the target query are input into the Transformer decoder, and the target query is updated using the Transformer decoder. include: The feature pyramid and target query are input into the Transformer decoder, and the object queries are updated using the mask-based attention mechanism.
6. A building extraction method of unified grid vector according to claim 5, characterized in that: The updating of the target query device by using the Transformer decoder includes: The cross-attention calculation is limited to the foreground area of the predicted mask to extract local features and reduce the amount of computation. The multi-scale strategy and Transformer decoder are combined to cyclically perform self-attention and cross-attention calculations at different network levels, so that each query accurately corresponds to a target building.
7. The building extraction method of unified grid vector according to claim 1, characterized in that: The method of using a multi-layer perceptron to predict categories and segmentation masks for queries at each level and combining BSPNet to extract vectors of buildings includes: First, a multi-layer perceptron is used to predict the category of queries at each level. At this time, the loss function is cross entropy. Secondly, a multi-layer perceptron is used to predict the straight line parameter group. Each group of straight lines is composed of multiple convex polygons. Multiple convex polygons are superimposed as the outline of the target building. The building vector is extracted by combining BSPNet. At this time, the loss function is L1 loss. Finally, a multi-layer perceptron is used to predict the segmentation mask for each level of query. At this time, the loss function is cross entropy and Dice loss.
8. The building extraction method of unified grid vector according to claim 1, characterized in that: The loss function is expressed as: loss=Cls ce +Mask ce +Mask dice +Line l1 Among them, loss is the total loss, Cls ce Expressed as category cross entropy loss, Mask ce Expressed as segmentation mask cross entropy loss, Mask dice Represented as segmentation mask Dice loss, Line l1 It is represented as a straight line L1 loss.
9. A unified raster vector building extraction system, characterized in that: include: The first processing module is used to collect image data similar to the training data, and pre-process the sample images; and extract features from the pre-processed images; The second processing module is used to decode the image data after feature extraction to obtain a feature pyramid; and input the feature pyramid and the target query device into the Transformer decoder, and update the target query device using the Transformer decoder; The third processing module is used to use a multi-layer perceptron to perform category prediction and segmentation mask prediction on the query of each level, and combine BSPNet to extract the vector of the building to obtain a loss function; the loss function is cross entropy, Dice loss and L1 loss; The fourth processing module is used to count the loss function, perform back-propagation iteration to update the model parameters, and output the model.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the building extraction method of the unified grid vector as described in any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Completed drawing multi-element extraction and vectorization method, device and equipment and storage medium
CN120656201A
