A building boundary segmentation method based on a U-net network model
By constructing boundary-adaptive dilated convolutional units and a high-frequency artifact detection module, and combining them with boundary complexity-aware adaptive adjustment of the receptive field, the problems of boundary blurring and artifacts in traditional remote sensing image building boundary segmentation are solved, achieving high-precision building boundary segmentation, which is suitable for urban planning and disaster assessment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANCHANG HANGKONG UNIVERSITY
- Filing Date
- 2026-01-26
- Publication Date
- 2026-04-17
AI Technical Summary
Traditional remote sensing image building boundary segmentation methods suffer from insufficient boundary feature extraction capabilities, difficulty in resolving artifact interference, and fixed and unbalanced receptive fields, resulting in unclear segmentation results and low accuracy, which are difficult to meet the needs of urban planning and disaster assessment.
Construct boundary-adaptive dilated convolutional units, generate binary boundary masks and boundary gradient magnitude maps using the Sobel operator, adjust the dilated convolutional kernel to a boundary-adaptive kernel, and add residual correction units after the dilated convolutional layers; extract high-frequency components and artifact binary masks using the Laplacian operator, and dynamically adjust the receptive field size based on the boundary complexity score.
It improves the accuracy of building boundary localization and segmentation, removes artifacts while preserving the original image details, solves the problem of global and local feature imbalance caused by fixed receptive field, and outputs high-precision building boundary segmentation results.
Smart Images

Figure CN121582278B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of building boundary segmentation technology, specifically a method for segmenting building boundaries in remote sensing images based on the U-net network model. Background Technology
[0002] Traditional remote sensing image building boundary segmentation methods (including methods based on the traditional U-net network model) suffer from three major performance bottlenecks, making it difficult to meet the requirements of high-precision analysis:
[0003] Insufficient boundary feature extraction capability: It cannot accurately capture the details of building edges, and is prone to boundary blurring problems, resulting in unclear transitions between building edges and backgrounds in the segmentation results, which affects the accuracy of boundary positioning.
[0004] Artifact interference is difficult to solve: When using techniques such as dilated convolution to expand the receptive field, boundary artifacts (such as edge breaks and false edges) are easily generated, and traditional restoration methods are prone to losing the original image details, further reducing the segmentation accuracy.
[0005] Receptive field imbalance: The size of the receptive field cannot be dynamically adjusted according to the actual complexity of the building boundary. When facing a large area with simple texture (such as a flat roof), local details are not captured enough. When facing a complex area with dense details (such as a building with multiple corners), the ability to integrate global contextual information is lacking, resulting in an imbalance between global and local feature capture.
[0006] The aforementioned problems limit the effectiveness of traditional methods in remote sensing image analysis tasks such as urban planning (e.g., building layout statistics) and disaster assessment (e.g., identification of the extent of building damage after a disaster). Therefore, there is an urgent need for a segmentation method that can overcome these bottlenecks.
[0007] Therefore, this invention provides a method for segmenting building boundaries in remote sensing images based on the U-net network model. Summary of the Invention
[0008] In order to overcome the shortcomings of the prior art, at least one technical problem raised in the background art is solved.
[0009] The technical solution adopted by this invention to solve its technical problem is:
[0010] One objective of this invention is to provide a method for building boundary segmentation in remote sensing images based on the U-net network model, comprising:
[0011] S1: Construct a boundary-adaptive dilated convolutional unit, including: obtaining the feature map of the i-th layer of the encoder; extracting the boundary gradient magnitude map of the input image with artifacts using the Sobel operator to generate a binary boundary mask; adjusting the traditional dilated convolutional kernel to a boundary-adaptive kernel based on the gradient of the binary boundary mask and the boundary gradient magnitude map; adding a residual correction unit after the dilated convolutional layer to calculate the boundary region residual between the dilated convolutional output feature and the original feature, and outputting the corrected feature map.
[0012] S2: Input the current layer's corrected feature map, extract single-channel high-frequency components using the Laplacian operator, combine with the boundary mask to generate a binary mask for artifacts; for each point marked as a suspected artifact, extract the feature mean and gradient direction of non-artifact points in its 3×3 neighborhood, and output the artifact removal features;
[0013] S3: Calculate the boundary density of the boundary gradient map of the i-th layer of the encoder and output the boundary complexity score; dynamically adjust the receptive field size using a preset void ratio candidate set.
[0014] As a further improvement of the present invention, the specific process of generating the binary boundary mask is as follows:
[0015] Select the feature map Fi output from the i-th layer and prepare the input image with artifacts to be processed and input it into the encoder;
[0016] The classic Sobel operator is used to operate on the input image with artifacts to calculate the trend of pixel grayscale changes in the input image with artifacts, thereby obtaining the boundary gradient magnitude map G.
[0017] The numerical range of the boundary gradient magnitude map G is scaled to the [0,1] interval for subsequent binarization judgment;
[0018] A threshold is set; when the gradient value of any pixel p in the boundary gradient magnitude map G is greater than the set threshold, the pixel is determined to belong to the boundary region, and a binary boundary mask is used. The corresponding position is marked as 1; otherwise, it is marked as 0.
[0019] As a further improvement of the present invention, the specific process of adjusting the traditional dilated convolution kernel to a boundary-adapting kernel based on the gradient of the binary boundary mask and the boundary gradient magnitude map is as follows:
[0020] Based on the calculated binary boundary mask The gradient ∇G(p) of the boundary gradient magnitude map G is used to modify the original traditional dilated convolution kernel in the U-net encoder to obtain the boundary adaptation kernel.
[0021] The specific improvement process is as follows:
[0022] Introduce the parameter λ, and based on the formula For traditional dilated convolution kernels Each position p is modified, where, To adapt the weight value of the dilated convolution kernel at position p to the modified boundary, This represents the original weight values of the traditional dilated convolution kernel at position p. The value of the binary boundary mask at position p. Let G be the gradient value of the boundary gradient magnitude map G at position p, and ⊙ be the element-wise multiplication operator;
[0023] For non-boundary regions, That is, the kernel weights remain unchanged from the original dilated convolution kernel, without affecting the global receptive field and context modeling capability;
[0024] For the boundary region, .
[0025] As a further improvement of the present invention, the specific process of adjusting the traditional dilated convolution kernel to a boundary-adapting kernel based on the gradient of the binary boundary mask and the boundary gradient magnitude map further includes:
[0026] If the gradient value of the boundary gradient magnitude map G at position p increases, then the weight value of the modified boundary-adapted dilated convolution kernel at position p will also increase.
[0027] If the gradient value of the boundary gradient magnitude map G at position p decreases, then the weight value of the modified boundary-adapted dilated convolution kernel at position p will also decrease.
[0028] As a further improvement of the present invention, the specific process of outputting the corrected feature is as follows:
[0029] Let the features of the input image with artifacts be... (Including: width W, height H, number of channels C), after processing by a dilated convolutional layer, the output features are: ;
[0030] Calculate the boundary region residual between the dilated convolution output feature and the original feature, and generate a high-frequency residual boundary mask using an edge detection algorithm. In high-frequency residual boundary mask In the diagram, boundary positions are marked as 1, and non-boundary positions are marked as 0;
[0031] The boundary region residual between the dilated convolution output feature and the original feature. ;
[0032] in, To calculate the difference between the dilated convolution output features and the original features element by element, For high-frequency residual boundary masks, This is element-wise multiplication;
[0033] By introducing boundary masks Only The residuals are preserved at the boundary locations, while the residuals in the interior regions are set to zero;
[0034] The output features of dilated convolution are scaled by subtracting the residuals in the boundary region. ;
[0035] This is the scaling factor. To correct features.
[0036] As a further improvement of the present invention, the specific process for generating the artifact binary mask is as follows:
[0037] Let the current layer's corrected feature map be... Using the discrete Laplace operator High-frequency details of each channel are extracted, and the classic four-neighbor Laplacian kernel is used to correct the feature map. Each channel is convolutionally processed independently to obtain single-channel high-frequency components;
[0038] The high-frequency components of all channels are fused according to the maximum value per pixel to obtain a single-channel high-frequency component map;
[0039] Introducing artifact detection boundary masks By using semantic segmentation or edge detection algorithms, pixels in the corrected feature map that belong to object boundaries or region edges are labeled.
[0040] Artifact detection boundary mask A pixel with a median value of 1 indicates that high frequencies are allowed at that location; artifact detection boundary mask. Pixels with a median value of 0 represent non-boundary regions and high-frequency anomalies;
[0041] Single-channel high-frequency components Artifact detection boundary mask Perform element-wise multiplication to obtain the high-frequency components in the non-boundary region. ;in, This is element-wise multiplication;
[0042] Set dynamic threshold High-frequency components in non-boundary regions Pixels exceeding the threshold are marked as suspected artifacts. Generate artifact binary mask .
[0043] As a further improvement of the present invention, the specific process of outputting artifact removal features is as follows:
[0044] For each point marked as a suspected artifact Extract suspected artifact points A small, localized area of 3x3 surrounding it;
[0045] Exclude points also marked as suspected artifacts For points, only those not suspected artifacts are retained;
[0046] Calculate suspected artifact points eigenmean And use gradient algorithm to calculate suspected artifact points. gradient direction .
[0047] As a further improvement of the present invention, the specific process of outputting artifact removal features also includes:
[0048] If suspected artifact point It is a boundary: strictly follows the neighborhood gradient direction. repair;
[0049] If suspected artifact point Not a boundary: combined with the mean Filling should prioritize ensuring feature consistency within the region;
[0050] Through formula Output artifact removal features;
[0051] in, The feature map is the original input. The symbol is a mask for suspected artifacts, and ⊙ represents element-wise multiplication. This is a function for artifact repair.
[0052] As a further improvement to the present invention, the specific process for outputting the boundary complexity score is as follows:
[0053] Assuming the output artifact-removed features are layered, the resulting image is the i-th layer with size W×H. The boundary gradient map of this layer is calculated using an edge detection algorithm. :
[0054] Canny operator first checks Perform gradient calculations to obtain the gradient magnitude and direction for each pixel. ;
[0055] Calculate boundary density : ;
[0056] Calculate boundary tortuosity : ;
[0057] Calculate the boundary complexity score : ;
[0058] The number of critical segments at the boundary. This represents the local angular feature at the p-th position.
[0059] As a further improvement of the present invention, the specific process of dynamically adjusting the size of the receptive field is as follows:
[0060] The preset candidate set for dilation rate is R={1,2,3}, and the receptive field of dilated convolution is determined by the dilation rate r; therefore:
[0061] r=1: The receptive field is 3×3;
[0062] r=2: The receptive field is expanded to 5×5;
[0063] r=3: The receptive field is expanded to 7×7;
[0064] Based on boundary complexity score and threshold , Based on the size relationship, the void ratio is selected in three categories:
[0065] Low complexity:
[0066] Choose r=3 and use a 7×7 receptive field;
[0067] Medium complexity:
[0068] Choose r=2 and use a 5×5 receptive field;
[0069] High complexity:
[0070] Choose r=1 and use a 3×3 receptive field.
[0071] The second objective of this invention is to provide a remote sensing image building boundary segmentation system based on the U-net network model, comprising:
[0072] Boundary-adaptive dilated convolution module: Constructs a boundary-adaptive dilated convolution unit, including: obtaining the feature map of the i-th layer of the encoder; extracting the boundary gradient magnitude map of the input image with artifacts using the Sobel operator to generate a binary boundary mask; adjusting the traditional dilated convolution kernel to a boundary-adaptive kernel based on the gradient of the binary boundary mask and the boundary gradient magnitude map; adding a residual correction unit after the dilated convolution layer to calculate the boundary region residual between the dilated convolution output feature and the original feature, and outputting a corrected feature map;
[0073] High-frequency artifact detection and repair module: Input the current layer correction feature map, extract the single-channel high-frequency components through the Laplacian operator, combine with the boundary mask to generate a binary mask for artifacts; for each point marked as a suspected artifact, extract the feature mean and gradient direction of the non-artifact points in its 3×3 neighborhood, and output the artifact removal features;
[0074] The receptive field adaptive module for boundary complexity awareness calculates the boundary density of the boundary gradient map of the i-th layer of the encoder and outputs the boundary complexity score; it dynamically adjusts the receptive field size based on a preset hole rate candidate set.
[0075] The beneficial effects of this invention are as follows:
[0076] The Sobel operator extracts boundary gradient magnitude maps and generates binary boundary masks. The weights of dilated convolution kernels are dynamically adjusted based on the gradient direction: the larger the gradient value in the boundary region, the higher the kernel weight, focusing on key edge features; the original kernel weights are maintained in non-boundary regions, without affecting global context modeling. This design allows the convolution kernel to focus on demand, effectively improving the boundary blurring problem of traditional methods and enhancing boundary localization accuracy. The boundary region residual between the dilated convolution output and the original features is calculated using a high-frequency residual boundary mask, correcting only boundary artifacts and avoiding information distortion in non-boundary regions. High-frequency components are extracted using the Laplacian operator, and artifact points are marked with a dynamic threshold. Then, depending on whether the artifact point is a boundary, neighborhood gradient direction repair or mean filling is used respectively, removing artifacts while preserving the original image details to the greatest extent possible.
[0077] The boundary complexity score is obtained by calculating boundary density and tortuosity. The void ratio is adaptively selected from the preset void ratio candidate set—r=3 (7×7 receptive field) is selected for low complexity regions to capture global information, and r=1 (3×3 receptive field) is selected for high complexity regions to focus on local details. This completely solves the problem of global and local feature imbalance caused by the fixed receptive field of traditional methods. The overall method breaks through the three major performance bottlenecks of traditional methods. The high-precision building boundary segmentation results output can directly serve urban planning and provide reliable data support for subsequent building layout statistics. It has strong practical value and promotion potential. Attached Figure Description
[0078] The invention will now be further described with reference to the accompanying drawings.
[0079] Figure 1 This is a flowchart illustrating the steps of a remote sensing image building boundary segmentation method based on the U-net network model according to the present invention.
[0080] Figure 2 This is a system module diagram of a remote sensing image building boundary segmentation system based on the U-net network model of the present invention. Detailed Implementation
[0081] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below in conjunction with specific embodiments.
[0082] Example 1
[0083] like Figure 1 As shown in the embodiment of the present invention, a method for segmenting building boundaries in remote sensing images based on a U-net network model includes:
[0084] S1: Construct a boundary-adaptive dilated convolutional unit, including: obtaining the feature map of the i-th layer of the encoder; extracting the boundary gradient magnitude map of the input image with artifacts using the Sobel operator to generate a binary boundary mask; adjusting the traditional dilated convolutional kernel to a boundary-adaptive kernel based on the gradient of the binary boundary mask and the boundary gradient magnitude map; adding a residual correction unit after the dilated convolutional layer to calculate the boundary region residual between the dilated convolutional output feature and the original feature, and outputting the corrected feature map.
[0085] In S1, the generation of the binary boundary mask The specific process is as follows:
[0086] Select the feature map Fi output from the i-th layer, and prepare the input image with artifacts to be processed and input it into the encoder (such as building images, as input data for subsequent edge detection).
[0087] The classic Sobel operator is used to operate on the input image with artifacts to calculate the trend of pixel grayscale changes in the input image with artifacts, thereby obtaining the boundary gradient magnitude map G (the value of each pixel in the boundary gradient magnitude map G corresponds to the edge intensity at that location in the original image, and the larger the value, the more likely it is to be a boundary).
[0088] The numerical range of the boundary gradient magnitude map G is scaled to the [0,1] interval for subsequent binarization judgment;
[0089] A threshold is set (in this embodiment, the threshold is set to 0.5); when the gradient value of any pixel p in the boundary gradient magnitude map G is greater than the set threshold, the pixel is determined to belong to the boundary region, and the binary boundary mask is used. The corresponding position is marked as 1; otherwise, it is marked as 0 (when the gradient value of any pixel p in the boundary gradient magnitude map G is less than or equal to the set threshold).
[0090] In S1, the binary boundary mask-based... Gradient of boundary gradient magnitude map G Adjusting the traditional dilated convolution kernel For boundary adaptation kernel The specific process is as follows:
[0091] Based on the calculated binary boundary mask The gradient ∇G(p) of the boundary gradient magnitude map G (i.e., the direction and intensity of the gradient at each pixel) is used to modify the traditional dilated convolution kernel in the U-net encoder to obtain the boundary adaptation kernel.
[0092] The specific improvement process is as follows:
[0093] Introducing the parameter λ (λ=0.3 in this embodiment), and based on the formula... For traditional dilated convolution kernels Each position p is modified, where, To adapt the weight value of the dilated convolution kernel at position p to the modified boundary, This represents the original weight values of the traditional dilated convolution kernel at position p. The value of the binary boundary mask at position p. Let G be the gradient value of the boundary gradient magnitude map G at position p, and ⊙ be the element-wise multiplication operator;
[0094] For non-boundary areas ( (representing non-boundary regions) That is, the kernel weights remain unchanged from the original dilated convolution kernel, without affecting the global receptive field and context modeling capability;
[0095] For the boundary region ( (representing the boundary area) ;
[0096] If the gradient value of the boundary gradient magnitude map G at position p is ( As the value of ) increases, the weight value of the modified boundary-adaptive dilated convolution kernel at position p also increases.
[0097] If the gradient value of the boundary gradient magnitude map G at position p is ( As the value of the modified boundary-adaptive dilated convolution kernel decreases, the weight value of the kernel at position p also decreases.
[0098] Through the above steps, boundary-aware dilated convolutional units are constructed in the dilated convolutional layers of the U-net encoder, which can more accurately capture boundary details and contextual features when processing images containing boundary information.
[0099] In S1, a residual correction unit is added after the dilated convolutional layer to calculate the boundary region residual between the dilated convolutional output feature and the original feature. The specific process of outputting the corrected feature is as follows:
[0100] While dilated convolution can capture more information by expanding the receptive field, it can also easily cause detail distortion in image boundary areas due to pixel jumps. To address this issue, the specific implementation logic of adding a residual correction unit after the dilated convolution layer can be broken down into the following steps:
[0101] Let the features of the input image with artifacts be... (Including: width W, height H, number of channels C), after processing by a dilated convolutional layer, the output features are: ;
[0102] Calculate the boundary region residual between the dilated convolution output feature and the original feature, and generate a high-frequency residual boundary mask using an edge detection algorithm (such as the Sobel operator or the Canny operator). In high-frequency residual boundary mask In the diagram, boundary positions are marked as 1, and non-boundary positions are marked as 0;
[0103] The boundary region residual between the dilated convolution output feature and the original feature. ;
[0104] in, To calculate the difference between the dilated convolution output features and the original features element by element, For high-frequency residual boundary masks, This is element-wise multiplication;
[0105] By introducing boundary masks Only The residuals are preserved at the boundary locations, while the residuals in the interior regions are set to zero;
[0106] To ensure that the boundary features retain both the global information from the dilated convolution and closely approximate the original real-world details, it is necessary to reverse-engineer the residuals. Specifically, this involves subtracting a scaling value from the residuals in the boundary region from the output features of the dilated convolution. ;
[0107] The scaling factor (in this embodiment, let be...) ), To correct features;
[0108] It should be noted that the scaling factor is used to balance the correction strength and information preservation. If the scaling factor is too large, the features will regress excessively to the original state, losing the advantage of the large receptive field of dilated convolution. If the scaling factor is too small, the correction effect will be weak. A learning network model can be preset to learn the scaling factor. This invention does not impose a specific numerical limit on the scaling factor, which can be set according to the specific situation.
[0109] S2: Input the current layer's corrected feature map, extract single-channel high-frequency components using the Laplacian operator, combine with the boundary mask to generate a binary mask for artifacts; for each point marked as a suspected artifact, extract the feature mean and gradient direction of non-artifact points in its 3×3 neighborhood, and output the artifact removal features;
[0110] In S2, the process of inputting the corrected feature map of the current layer, extracting single-channel high-frequency components through the Laplacian operator, and generating an artifact binary mask by combining the boundary mask is as follows:
[0111] Let the current layer's corrected feature map be... (Including: width W, height H, number of channels C), artifacts often manifest as local high-frequency noise, therefore the discrete Laplacian operator is required. High-frequency details of each channel are extracted, and the classic four-neighbor Laplacian kernel is used to correct the feature map. Each channel is convolutionally processed independently to obtain single-channel high-frequency components;
[0112] The high-frequency components of all channels are fused according to the maximum value of each pixel (or the average value or the maximum value of a single channel is taken, depending on the task's requirements for high-frequency sensitivity) to obtain a single-channel high-frequency component map.
[0113] Introducing artifact detection boundary masks By using semantic segmentation or edge detection algorithms, pixels in the corrected feature map that belong to object boundaries or region edges are labeled.
[0114] Artifact detection boundary mask A pixel with a median value of 1 indicates that high frequencies are allowed at that location; artifact detection boundary mask. Pixels with a median value of 0 represent non-boundary regions and high-frequency anomalies;
[0115] Single-channel high-frequency components Artifact detection boundary mask Perform element-wise multiplication to obtain the high-frequency components in the non-boundary region. ;in, This is element-wise multiplication;
[0116] Set dynamic threshold High-frequency components in non-boundary regions Pixels exceeding the threshold are marked as suspected artifacts. Generate artifact binary mask ;
[0117] Dynamic threshold This is a reference value set by those skilled in the art based on their experience. In this embodiment, The value can be between 0.5 and 2.0;
[0118] The specific process of extracting the feature mean and gradient direction of non-artifact points within its 3×3 neighborhood and outputting the artifact-removed features is as follows:
[0119] In S2, for each point marked as a suspected artifact, the mean feature value and gradient direction of the non-artifact points in its 3×3 neighborhood are extracted, and the artifact removal features are output. The specific process is as follows:
[0120] For each point marked as a suspected artifact Extract suspected artifact points A 3×3 local area surrounds p itself and its 8 neighbors in the top, bottom, left, right, front, and back.
[0121] Exclude points also marked as suspected artifacts Only non-artifact points are retained (i.e., pixels in the high-frequency components of non-boundary regions that do not exceed the threshold).
[0122] Calculate suspected artifact points eigenmean And use gradient algorithms (such as the Sobel operator) to calculate suspected artifact points. gradient direction ;
[0123] If suspected artifact point The boundary (Mb(p)=1): strictly follows the neighborhood gradient direction. repair;
[0124] If suspected artifact point Not a boundary: combined with the mean Filling should prioritize ensuring feature consistency within the region;
[0125] Through formula Output artifact removal features;
[0126] in, The feature map is the original input. The symbol is a mask for suspected artifacts, and ⊙ represents element-wise multiplication. This is a function for artifact repair.
[0127] S3: Calculate the boundary density of the boundary gradient map of the i-th layer of the encoder and output the boundary complexity score; dynamically adjust the receptive field size using a preset hole rate candidate set;
[0128] In S3, the specific process of calculating the boundary density of the boundary gradient map of the i-th layer of the encoder and outputting the boundary complexity score is as follows:
[0129] Assuming the output artifact-removed features are layered, the resulting image is the i-th layer with size W×H (total number of pixels W×H). The boundary gradient map of this layer is calculated using an edge detection algorithm (such as the Canny operator). :
[0130] Canny operator first checks Perform gradient calculations (such as using the Sobel operator) to obtain the gradient magnitude and direction for each pixel. (p is the pixel index, and the gradient direction range is normalized to) Radius (to facilitate subsequent angle difference calculations);
[0131] Calculate boundary density : ;
[0132] Calculate boundary tortuosity : ;
[0133] Calculate the boundary complexity score : ;
[0134] The number of critical segments at the boundary. This represents the local angular feature at the p-th position;
[0135] It should be noted that, The key segmentation of a boundary is essentially the total number of segments after extracting key features of the boundary's shape. In image processing, boundaries are composed of continuous pixels, but direct pixel-by-pixel analysis is redundant and inefficient. Therefore, it is necessary to first perform key segmentation on the boundary—identifying feature inflection points on the boundary (such as corners, abrupt changes in direction, curvature extrema, etc.), and treating the line segment between two adjacent inflection points as a key segment. That is, the number of these key segments; This represents the local angular feature at position p, used to quantify the directional information of the boundary at the local position; position p needs to be understood in conjunction with the partitioning logic of the key segments: if If p is the number of key segments, then p corresponds to these segments (or feature points within the segments). It is the tangent direction angle of the boundary at that location; if the boundary is stored as a "polyline segment" (such as being composed of the start-end coordinates of multiple line segments): Defined as the angle between the p-th line segment and a reference axis (such as the horizontal or vertical axis) (the range is usually taken as...). Radius (to avoid periodic ambiguity); if the boundary is stored in pixel chain code (such as Freeman chain code): The angle of the orientation encoding conversion of the p-th pixel in the corresponding chain code;
[0136] In S3, the specific process of dynamically adjusting the receptive field size based on the preset hole rate candidate set is as follows:
[0137] The preset candidate set of dilation rates is R={1,2,3}, and the logic for the corresponding receptive field size is: the receptive field of dilated convolution is determined by the dilation rate r; therefore:
[0138] r=1 (standard convolution): receptive field is 3×3, focusing on extremely local details;
[0139] r=2: The receptive field is expanded to 5×5, balancing details with small-scale context;
[0140] r=3: The receptive field is further expanded to 7×7, capturing a wider range of long-distance associations.
[0141] Dynamic selection rules: Decision logic for three scenarios
[0142] Based on boundary complexity score and threshold , ( The size relationship between the numbers indicates the void ratio r, and three categories are selected based on this relationship:
[0143] Low complexity (boundary complexity score less than the threshold) ):
[0144] When the regional texture is simple and has very little variation (such as a large area of blue sky or flat wasteland), a large receptive field is more important than details. Choose r=3 and use a 7×7 receptive field to integrate global information to avoid losing long-distance connections due to limited field of view.
[0145] Medium complexity (boundary complexity score greater than or equal to the threshold) Less than the threshold ):
[0146] The area has some variations but no extreme details (such as a mixture of grass and shrubs, or a lightly textured wall). A trade-off needs to be made between context and detail. We chose r=2 and used a 5×5 receptive field to balance the two, preserving local features while connecting them to a slightly larger context.
[0147] High complexity (boundary complexity score greater than or equal to the threshold) ):
[0148] The region is extremely detailed, with dense and subtle edges (a difference of one pixel may correspond to a key structure in the real scene). At this time, a small receptive field is crucial. Choosing r=1 (standard convolution) and using a 3×3 receptive field to accurately capture each subtle structure will prevent a large receptive field from blurring small edges or textures.
[0149] It should be noted that the threshold , The determination of the boundary complexity score needs to be based on the statistics of the task dataset. For example, calculate the boundary complexity score of all regions on the training set, divide the quantiles according to the proportion of low, medium and high samples (e.g., each accounting for 1 / 3), or optimize the performance through the validation set.
[0150] Example 2
[0151] like Figure 2 As shown in Example 1, this invention provides a remote sensing image building boundary segmentation system based on the U-net network model, comprising:
[0152] Boundary-adaptive dilated convolution module: Constructs a boundary-adaptive dilated convolution unit, including: obtaining the feature map of the i-th layer of the encoder; extracting the boundary gradient magnitude map of the input image with artifacts using the Sobel operator to generate a binary boundary mask; adjusting the traditional dilated convolution kernel to a boundary-adaptive kernel based on the gradient of the binary boundary mask and the boundary gradient magnitude map; adding a residual correction unit after the dilated convolution layer to calculate the boundary region residual between the dilated convolution output feature and the original feature, and outputting a corrected feature map;
[0153] High-frequency artifact detection and repair module: Input the current layer correction feature map, extract the single-channel high-frequency components through the Laplacian operator, combine with the boundary mask to generate a binary mask for artifacts; for each point marked as a suspected artifact, extract the feature mean and gradient direction of the non-artifact points in its 3×3 neighborhood, and output the artifact removal features;
[0154] The receptive field adaptive module for boundary complexity awareness calculates the boundary density of the boundary gradient map of the i-th layer of the encoder and outputs the boundary complexity score; it dynamically adjusts the receptive field size based on a preset hole rate candidate set.
[0155] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. A building boundary segmentation method based on a U-net network model, characterized in that: include: S1: Construct a boundary-adaptive dilated convolutional unit, including: obtaining the feature map of the i-th layer of the encoder; extracting the boundary gradient magnitude map of the input image with artifacts using the Sobel operator to generate a binary boundary mask; adjusting the dilated convolutional kernel to a boundary-adaptive kernel based on the gradient of the binary boundary mask and the boundary gradient magnitude map; adding a residual correction unit after the dilated convolutional layer to calculate the boundary region residual between the dilated convolutional output feature and the original feature, and outputting a corrected feature map. The specific process of adjusting the dilated convolution kernel to a boundary fitting kernel based on the gradient of the binary boundary mask and the boundary gradient magnitude map is as follows: based on the calculated binary boundary mask and the gradient ∇G(p) of the boundary gradient magnitude map G, the hollow convolution kernel in the U-net encoder is modified to obtain a boundary adaptive kernel; The specific improvement process is as follows: Introduce the parameter λ, and based on the formula For dilated convolution kernels Each position p is modified, where, To adapt the weight value of the dilated convolution kernel at position p to the modified boundary, Here are the original weights of the dilated convolution kernel at position p. The value of the binary boundary mask at position p. Let G be the gradient value of the boundary gradient magnitude map G at position p, and ⊙ be the element-wise multiplication operator; For non-boundary regions, That is, the kernel weights remain unchanged from the original dilated convolution kernel, without affecting the global receptive field and context modeling capability; For the boundary region, ; The specific process of outputting corrected features is as follows: The feature of the input image with artifacts is set as , and the output feature after the treatment of the hole convolution layer is ; Calculate the boundary region residual between the dilated convolution output feature and the original feature, and generate a high-frequency residual boundary mask using an edge detection algorithm. In high-frequency residual boundary mask In the diagram, boundary positions are marked as 1, and non-boundary positions are marked as 0; a residual of a boundary region of the original feature and the hollow convolution output feature ; wherein, is an element-wise difference between the dilated convolution output feature and the original feature, is a high-frequency residual boundary mask, is an element-wise multiplication; By introducing a boundary mask , only the residuals at the boundary positions of are preserved, and the residuals in the interior region are set to zero; Subtracting the proportionally scaled value of the boundary region residual from the output feature of the empty convolution, that is, ; for scaling coefficients, for correction features; S2: Input the current layer's corrected feature map, extract single-channel high-frequency components using the Laplacian operator, combine with the boundary mask to generate a binary mask for artifacts; for each point marked as a suspected artifact, extract the feature mean and gradient direction of non-artifact points in its 3×3 neighborhood, and output the artifact removal features; S3: Calculate the boundary density of the boundary gradient map of the i-th layer of the encoder and output the boundary complexity score; dynamically adjust the receptive field size using a preset hole rate candidate set; The specific process of dynamically adjusting the receptive field size is as follows: The preset candidate set for dilation rate is R={1,2,3}, and the receptive field of dilated convolution is determined by the dilation rate r; therefore: r=1: The receptive field is 3×3; r=2: The receptive field is expanded to 5×5; r=3: The receptive field is expanded to 7×7.
2. The method for building boundary segmentation in remote sensing images based on the U-net network model according to claim 1, characterized in that: The specific process for generating the binary boundary mask is as follows: Select the feature map Fi output from the i-th layer and prepare the input image with artifacts to be processed and input it into the encoder; The Sobel operator is used to perform operations on the input image with artifacts to calculate the trend of pixel grayscale changes in the input image with artifacts, thereby obtaining the boundary gradient magnitude map G. The numerical range of the boundary gradient magnitude map G is scaled to the [0,1] interval for subsequent binarization judgment; A threshold value is set; when the gradient value of any pixel p in the boundary gradient amplitude map G is greater than the set threshold value, it is determined that the pixel belongs to the boundary region, and the corresponding position in the binary boundary mask is marked as 1; otherwise, it is marked as 0. 3.The building boundary segmentation method based on U-net network model according to claim 1, characterized in that: The specific process of adjusting the dilated convolution kernel to a boundary fitting kernel based on the gradient of the binary boundary mask and the boundary gradient magnitude map also includes: If the gradient value of the boundary gradient magnitude map G at position p increases, then the weight value of the modified boundary-adapted dilated convolution kernel at position p will also increase. If the gradient value of the boundary gradient magnitude map G at position p decreases, then the weight value of the modified boundary-adapted dilated convolution kernel at position p will also decrease.
4. The building boundary segmentation method based on the U-net network model according to claim 1, characterized in that: The specific process of generating the artifact binary mask is as follows: Let the current layer's corrected feature map be... Discrete Laplace operator based on four-neighbor Laplace kernel Extract high-frequency details from each channel and correct the feature map. Each channel is convolutionally processed independently to obtain single-channel high-frequency components; The high-frequency components of all channels are fused according to the maximum value per pixel to obtain a single-channel high-frequency component map; Introducing artifact detection boundary masks By using semantic segmentation or edge detection algorithms, pixels in the corrected feature map that belong to object boundaries or region edges are labeled. Artifact detection boundary mask A pixel with a median value of 1 indicates that high frequencies are allowed at that location; artifact detection boundary mask. Pixels with a median value of 0 represent non-boundary regions and high-frequency anomalies; The single channel high frequency component with the artifact detection boundary mask element-wise multiplication to obtain the high frequency component of the non-boundary region ; wherein is an element-wise multiplication Setting a dynamic threshold marking pixels in the non-border region whose high frequency components exceed a threshold as suspected artifact points , generating an artifact binary mask . 5.The building boundary segmentation method based on U-net network model according to claim 1, characterized in that: The specific process of outputting artifact removal features is as follows: For each marked suspected artifact point a 3x3 local neighborhood around the suspected artifact point is extracted; Excluding points that are also labeled as suspected artifact points only keeping non-suspected artifact points; Calculate suspected artifact points eigenmean And use gradient algorithm to calculate suspected artifact points. gradient direction .
6. The method for building boundary segmentation in remote sensing images based on the U-net network model according to claim 5, characterized in that: The specific process of outputting artifact removal features also includes: If suspect artifact point Is boundary: strictly follow neighborhood gradient direction Repair; If suspect artifact point Not border: combine mean Fill, prioritize feature consistency within region; Through formula Output artifact removal features; wherein, is the original input feature map, is the label mask of suspected artifacts, and is the element-wise multiplication, is the artifact repairing function.
7. The building boundary segmentation method based on the U-net network model according to claim 1, characterized in that: The specific process of outputting the boundary complexity score is as follows: Assuming the de-artifacted feature output is layered to obtain an i-th layer image with a size of WxH ; calculate the boundary gradient map of the layer by an edge detection algorithm : Canny operator first checks Perform gradient calculations to obtain the gradient magnitude and direction for each pixel; Computing the boundary density : ; Computing a border tortuosity : ; Computing a boundary complexity score : ; the number of key segments for the boundary, local angular feature for the p-th position. 8.The building boundary segmentation method based on U-net network model according to claim 1, characterized in that: The specific process of dynamically adjusting the size of the receptive field also includes: According to the size relationship between the boundary complexity score and the threshold value , , the hole rate r is selected into three categories: Low complexity: Choose r=3 and use a 7×7 receptive field; Medium complexity: Choose r=2 and use a 5×5 receptive field; High complexity: Choose r=1 and use a 3×3 receptive field.
Citation Information
Patent Citations
Integrated image restoration method and system based on image mask modeling
CN119722531A
MRI medical image correction method and system based on convolutional neural network, and computer readable storage medium
CN119963681A