Building post-disaster trace segmentation method based on clear boundary detection
By combining the EfficientNetV2 lightweight encoder, multi-scale context enhancement module, and boundary refinement module, the accuracy and clarity issues of edge detection in post-disaster damage area segmentation of buildings are solved, achieving high-precision post-disaster trace segmentation of buildings.
Patent Information
- Application Number
- CN202511255956.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-04
- Publication Date
- 2025-12-12
AI Technical Summary
Existing edge detection methods lack sufficient segmentation accuracy and boundary clarity in post-disaster building damage assessment, and lack the utilization of prior knowledge about image edges, resulting in an imbalance in the distribution of edge pixels and non-edge pixels.
A method based on clear boundary detection is adopted, which uses a modified EfficientNetV2 lightweight encoder for multi-level feature extraction. It combines a second-derivative multi-scale context enhancement module and a boundary refinement module, performs adaptive feature processing through conditional parameterized convolution, and uses a hybrid focus loss function for training to achieve a balance between edge pixels and non-edge pixels.
It improves the accuracy and boundary clarity of post-disaster trace segmentation of buildings, enabling rapid and accurate identification and segmentation of damaged areas of buildings to meet practical needs.
Smart Images

Figure CN121121109A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of computer vision and deep learning, specifically relating to a method for segmenting post-disaster traces in buildings based on clear boundary detection. Essentially, it is a problem combining edge detection and image segmentation. Background Technology
[0002] Damage assessment of buildings caused by natural disasters such as fires, earthquakes, floods, and typhoons is a crucial aspect of post-disaster relief and reconstruction, and is of great significance for protecting people's lives and property. In post-disaster emergency response, how to quickly and accurately identify and delineate damaged areas of buildings to provide a reliable basis for rescue decisions is a research topic of significant practical importance and challenge.
[0003] In addition, the boundaries of damaged areas of buildings after a disaster are often blurred, the shapes are irregular, the degree of damage is difficult to define, and the background is complex and diverse. These characteristics bring great technical difficulties to the task of accurately segmenting the damaged area.
[0004] In recent years, with the rapid development of deep learning technology, many edge detection and image segmentation methods based on deep convolutional neural networks have made significant progress in the field of computer vision, with some of these methods achieving quite excellent performance levels.
[0005] However, existing edge detection methods often produce thick, noisy edge lines, lack prior knowledge about image edges, and suffer from an imbalance in the distribution of edge and non-edge pixels. These technical bottlenecks mean that the segmentation accuracy and boundary sharpness cannot meet the practical requirements in the specific application scenario of building post-disaster damage assessment. Therefore, how to effectively integrate edge prior knowledge into a deep learning framework to improve the accuracy and boundary sharpness of building post-disaster trace segmentation is an urgent problem to be solved. Summary of the Invention
[0006] This invention provides a method for segmenting post-disaster traces in buildings based on clear boundary detection. The technical solution is as follows:
[0007] A method for segmenting post-disaster traces of buildings based on clear boundary detection includes the following steps:
[0008] Step 1: Acquisition and preprocessing of post-disaster building images;
[0009] Step 2, Encoder Feature Extraction: The preprocessed image is subjected to multi-level feature extraction through the modified EfficientNetV2 lightweight encoder to obtain rich feature representations from details to semantics;
[0010] Step 3, Second-derivative multi-scale context enhancement: Construct a second-derivative multi-scale context enhancement module SDMCM as a skip connection component, and use the features extracted by the encoder in Step 2 to locate edge pixels through the multi-scale context enhancement module SDMCM;
[0011] Step 4, Boundary Refinement Decoding Output: The features enhanced by SDMCM are processed through the Boundary Refinement Module (BRM). Adaptive feature processing is achieved using Conditional Parameterized Convolution (CondConv). The decoder uses dense connections to fuse features at different scales, gradually upsampling to restore the original image resolution, and finally outputs a clear prediction image.
[0012] Step 5: Hybrid focus loss training and segmentation output.
[0013] Furthermore, the preprocessing in step 1 includes denoising, scaling, and normalization.
[0014] Furthermore, in step 2, the modified EfficientNetV2 lightweight encoder is divided into 5 stages, each stage extracting feature representations at different scales: stage 1 extracts shallow detail features, stage 2 extracts local texture features, stage 3 extracts mid-level semantic features, stage 4 extracts high-level semantic features, and stage 5 extracts the highest level abstract features.
[0015] Furthermore, in step 3, SDMCM includes two parallel branches: the second derivative path and the multi-scale context path. The second derivative path uses the Laplacian operator to accurately locate edge pixels, while the multi-scale context path uses dilated convolutions with different dilation rates to capture long-distance semantic information, effectively combining edge prior knowledge with context information.
[0016] Furthermore, the multi-scale context path employs a parallel dilated convolution structure, comprising four branches: branch 1 uses a 3×3 convolution with a dilation rate of 1; branch 2 uses a 3×3 convolution with a dilation rate of 3; branch 3 uses a cascaded combination of convolutions with dilation rates of 1 and 3; and branch 4 uses a cascaded combination of convolutions with dilation rates of 1, 2, and 3, compressing the input features to 1 / 4 of their original size through a 1×1 convolution. Finally, the outputs of each branch are residually concatenated with the input features to obtain the SDMCM-enhanced features.
[0017] Furthermore, in step 4, the upsampling is achieved using bilinear interpolation combined with depthwise separable convolution.
[0018] Furthermore, in step 5, the hybrid focus loss function L HFL Loss of L due to focus Tversky FT and focus loss L FL It consists of two parts.
[0019] LHFL =L FT +λL FL
[0020] In the formula, L FT By introducing the Tversky index to consider global structural information, while L... FL λ represents the focus loss, which is reduced by introducing an adjustment factor γ to decrease the loss contribution to correctly classified pixels; λ is a parameter that balances the weights of FL and FTL.
[0021] This invention proposes a post-disaster building trace segmentation method based on clear boundary detection, which organically combines second-order derivative prior knowledge with deep learning technology, featuring high segmentation accuracy, clear boundaries, and fast processing speed. Experimental verification has shown that it can be effectively applied to real-world scenarios of post-disaster building damage assessment. The loss function of this invention no longer uses a single focal Tversky loss (FTL), but instead employs a hybrid focal loss function (HFL), effectively solving the problem of imbalanced distribution between edge and non-edge pixels. Attached Figure Description
[0022] Figure 1 This is a flowchart of the method of the present invention;
[0023] Figure 2 This is a network structure diagram of the multi-scale context enhancement module (SDMCM) based on the second derivative proposed in this invention;
[0024] Figure 3 This is a network structure diagram of the boundary refinement module (BRM) constructed in this invention;
[0025] Figure 4 This is a diagram showing the detection results of the method of the present invention; Detailed Implementation
[0026] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0027] This embodiment provides a method for segmenting post-disaster traces of buildings based on clear boundary detection. The specific steps are as follows: Figure 1 As shown, it includes the following steps:
[0028] (1) Obtain post-disaster building image files from the local disk to complete data acquisition. Then, perform denoising, scaling, and normalization operations on the acquired images. Assuming the input image is I and the output image is I', the image preprocessing process can be described by the following formula:
[0029] I'=Normalize(Resize(Denoise(I)))
[0030] In the above formula, *Denoise* indicates that median filtering is used for denoising. Specifically, the median of neighboring pixels is used to replace the current pixel value for denoising, eliminating noise interference in the image. *Resize* indicates that the image size is adjusted, uniformly scaling the input image to the target size for batch processing. *Normalize* indicates image normalization, adjusting the pixel value range to the [0,1] interval. Preprocessing reduces image noise, unifies image size, and normalizes the image, which is beneficial for subsequent network processing.
[0031] (2) The lightweight pre-trained model EfficientNetV2, after being pruned, is used as the backbone network. During feature extraction, the image is first converted into a 4-dimensional tensor tensor = [N, C, H, W], where N represents the batch size; C represents the number of image channels, and since the input is an RGB image, C = 3; H and W represent the height and width of the image, respectively.
[0032] The EfficientNetV2 encoder boasts advantages such as low parameter count and high computational efficiency, effectively extracting multi-level features from images. Specifically, the encoder consists of five stages, each extracting feature representations at different scales: Stage 1 extracts shallow detail features (24 channels), Stage 2 extracts local texture features (48 channels), Stage 3 extracts mid-level semantic features (320 channels), Stage 4 extracts high-level semantic features (1056 channels), and Stage 5 extracts the highest-level abstract features (512 channels). Through this hierarchical feature extraction mechanism, the encoder obtains rich feature representations ranging from details to semantics.
[0033] (3) Construct a second-derivative-based multi-scale context enhancement module (SDMCM) as a skip connection component. This module integrates the edge enhancement module (EEM) and the multi-scale context module (MCE). The network structure is as follows: Figure 2 As shown.
[0034] The edge enhancement module uses a fixed Laplacian operator to extract second-order derivative information. This operator can detect zero-crossing points in the image and accurately locate edge pixel positions. In the specific implementation, the output of the Laplacian convolution is activated by the Sigmoid function and then multiplied element-wise with the original features to enhance the edge response.
[0035] The multi-scale context module employs a parallel dilated convolutional structure with four branches: Branch 1 uses a 3×3 convolution with a dilation rate of 1; Branch 2 uses a 3×3 convolution with a dilation rate of 3; Branch 3 uses a cascaded combination of convolutions with dilation rates of 1 and 3; and Branch 4 uses a cascaded combination of convolutions with dilation rates of 1, 2, and 3. The input features are compressed to one-quarter of their original size through 1×1 convolutions. Finally, the outputs of each branch are residually concatenated with the input features.
[0036] This design can capture contextual information within different receptive field ranges, enhancing the model's ability to model long-distance dependencies.
[0037] (4) Construct a boundary refinement module (BRM) and use conditional parameterized convolution (CondConv) for adaptive feature processing. The network structure is as follows: Figure 3 As shown.
[0038] The boundary correction module uses conditional convolution to achieve adaptive convolution operation. This module can dynamically adjust the convolution kernel parameters according to the different characteristics of the input features, thereby further refining the features.
[0039] The decoder employs a densely connected structure to fuse features at different scales. Specifically, it progressively upsamples features starting from the deepest layer and fuses them with the encoder features from the corresponding layer.
[0040] The upsampling operation is implemented using bilinear interpolation combined with depthwise separable convolution, which ensures the restoration of feature resolution while controlling computational complexity.
[0041] (5) The Hybrid Focus Loss Function (HFL) is adopted, which effectively solves the problem of imbalance between edge pixels and non-edge pixels.
[0042] The hybrid focus loss function consists of two parts: focus Tversky loss (FTL) and focus loss (FL), as shown in the following formula:
[0043]
[0044] L HFL =L FT +λL FL
[0045] Among them, L FT This refers to Focal Tversky Loss, which incorporates the Tversky index to account for global structural information, while L... FL λ represents Focal Loss, which reduces the loss contribution to correctly classified pixels by introducing an adjustment factor γ, thus focusing more on minority class pixels that are difficult to classify. In the HFL loss function, λ is a parameter that balances the weights of FL and FTL.
[0046] The overall training process uses the PyTorch deep learning framework, with AdamW as the optimization method. The batch size is set to 8, the number of training epochs is 100, and the initial learning rate is 1e-4. Cosine annealing is used to adjust the learning rate. Data augmentation strategies include random flipping, rotation, and scaling.
[0047] After training, the network can directly output clear building boundaries and accurate damage area segmentation results without post-processing steps, achieving accurate segmentation of post-disaster traces in buildings. The segmentation results are as follows: Figure 4 As shown.
Claims
1. A method for segmenting post-disaster traces of buildings based on clear boundary detection, comprising the following steps: Step 1: Acquisition and preprocessing of post-disaster building images; Step 2, Encoder Feature Extraction: The preprocessed image is subjected to multi-level feature extraction through the modified EfficientNetV2 lightweight encoder to obtain rich feature representations from details to semantics; Step 3, Second-derivative multi-scale context enhancement: Construct a second-derivative multi-scale context enhancement module SDMCM as a skip connection component, and use the features extracted by the encoder in Step 2 to locate edge pixels through the multi-scale context enhancement module SDMCM; Step 4, Boundary Refinement Decoding Output: The features enhanced by SDMCM are processed through the Boundary Refinement Module (BRM). Adaptive feature processing is achieved using Conditional Parameterized Convolution (CondConv). The decoder uses dense connections to fuse features at different scales, gradually upsampling to restore the original image resolution, and finally outputs a clear prediction image. Step 5: Hybrid focus loss training and segmentation output.
2. The method for segmenting post-disaster traces of buildings based on clear boundary detection according to claim 1, characterized in that, The preprocessing in step 1 includes denoising, scaling, and normalization.
3. The method for segmenting post-disaster traces of buildings based on clear boundary detection according to claim 1, characterized in that, In step 2, the modified lightweight encoder of EfficientNetV2 is divided into 5 stages, each stage extracting feature representations at different scales: stage 1 extracts shallow detail features, stage 2 extracts local texture features, stage 3 extracts mid-level semantic features, stage 4 extracts high-level semantic features, and stage 5 extracts the highest level abstract features.
4. The method for segmenting post-disaster traces of buildings based on clear boundary detection according to claim 1, characterized in that, In step 3, SDMCM includes two parallel branches: the second derivative path and the multi-scale context path. The second derivative path uses the Laplacian operator to accurately locate edge pixels, while the multi-scale context path uses dilated convolutions with different dilation rates to capture long-distance semantic information, effectively combining edge prior knowledge with context information.
5. The method for segmenting post-disaster traces of buildings based on clear boundary detection according to claim 4, characterized in that, The multi-scale context path employs a parallel dilated convolutional structure with four branches: branch 1 uses a 3×3 convolution with a dilation rate of 1; branch 2 uses a 3×3 convolution with a dilation rate of 3; branch 3 uses a cascaded combination of convolutions with dilation rates of 1 and 3; and branch 4 uses a cascaded combination of convolutions with dilation rates of 1, 2, and 3, compressing the input features to 1 / 4 of their original size through a 1×1 convolution. Finally, the outputs of each branch are residually concatenated with the input features to obtain the SDMCM-enhanced features.
6. The method for segmenting post-disaster traces of buildings based on clear boundary detection according to claim 1, characterized in that, In step 4, the upsampling is achieved using bilinear interpolation combined with depthwise separable convolution.
7. The method for segmenting post-disaster traces of buildings based on clear boundary detection according to claim 1, characterized in that, In step 5, the hybrid focus loss function L HFL Loss of L due to focus Tversky FT and focus loss L FL Two parts composition: THE HFL =L FT +λL FL In the formula, L FT By introducing the Tversky index to consider global structural information, while L... FL λ represents the focus loss, which is reduced by introducing an adjustment factor γ to decrease the loss contribution to correctly classified pixels; λ is a parameter that balances the weights of FL and FTL.
