A building change detection method and system based on twin Unet model
By integrating the differential feature pyramid and attention mechanism into the twin Unet model, the problems of false detection of small targets and rough edge detection in remote sensing image change detection are solved, achieving higher detection accuracy and robustness.
Patent Information
- Application Number
- CN202310987900.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-07
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2043-08-07
AI Technical Summary
Existing semantic segmentation networks have problems with misdetection of small objects and rough edge detection in remote sensing image change detection tasks.
A building change detection method based on the Twin Unet model is adopted. The differential feature pyramid and attention mechanism are integrated to construct the D-Unet model. The differential feature pyramid is used to explicitly emphasize the feature difference information of the dual-temporal images, and the convolutional attention module is used to reduce redundant information.
The accuracy of change detection in remote sensing images is improved, especially the detection accuracy of small targets and target edges, the false detection rate is reduced, and the performance of the model is significantly improved.
Smart Images

Figure CN117036941B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of change detection, and in particular relates to a building change detection method and system based on a twin Unet model. Background Art
[0002] With the continuous development of remote sensing technology, the spatial and spectral resolutions of remote sensing images have significantly increased, providing crucial data support for interpreting ground feature information. With the advancement of urbanization and industrialization, buildings, as a type of ground feature closely associated with human activities, have gradually become a key feature of interest in remote sensing imagery. Building change detection can provide decision-making support for urban planning, disaster warning and emergency response, military reconnaissance, and the updating of basic geographic information, and thus has important practical implications.
[0003] Currently, change detection methods are mainly divided into two categories: traditional change detection methods and deep learning-based change detection methods. Traditional change detection methods mainly include pixel-based and object-based change detection methods. Pixel-based change detection methods ignore the spatial correlation and contextual information between pixels and are easily affected by noise. Object-based change detection methods can only utilize low-level features such as geometric texture and cannot well represent deeper semantic information. In recent years, with the development of artificial intelligence, deep learning has achieved remarkable success in the field of image segmentation. Remote sensing image change detection is essentially a pixel-level binary classification problem. Therefore, it is possible to provide a solution to the change detection problem of remote sensing images by improving semantic segmentation networks such as FCN, Unet, and SegNet. However, the current mainstream semantic segmentation networks have certain errors when applied to remote sensing image change detection tasks, such as misdetection of small objects and rough edge detection.
[0004] Through the above analysis, the problems and defects of the existing technology are: the current mainstream semantic segmentation network has problems such as misdetection of small targets and rough edge detection when applied to remote sensing image change detection tasks. Summary of the Invention
[0005] In response to the problems existing in the prior art, the present invention provides a building change detection method and system based on the twin Unet model.
[0006] The present invention is implemented as follows: a building change detection method based on a twin Unet model, wherein the building change detection method based on the twin Unet model constructs a twin network structure based on Unet, integrates a differential feature pyramid and an attention mechanism, and obtains a change detection model based on D-Unet; based on a publicly available remote sensing dataset, the constructed change detection model is trained and tested to obtain a trained change detection model; remote sensing images of different phases are input into the trained change detection model to obtain the final detection results.
[0007] Furthermore, the building change detection method based on the twin Unet model includes the following steps:
[0008] Step 1: Data preprocessing, which involves cropping the dual-phase images and change labels in the LEVIR-CD dataset into 256×256 pixel blocks to obtain image blocks of uniform size.
[0009] Step 2: Construct a twin network structure based on Unet: Since change detection requires two images as input, the single-input semantic segmentation Unet network needs to be improved into a twin structure with two inputs. The weight values of the left-half encoder are shared between the two inputs, and features are extracted from the two inputs separately. The two extracted feature maps are then concatenated and channel-wise spliced and input to the right-half decoder together. At the same time, the original jump connection of Unet is retained, and the feature maps of each level obtained from the two sub-networks are concatenated and channel-wise spliced, and connected to the corresponding part of the right decoder, and finally the pixel-by-pixel classification change detection results are output.
[0010] Step 3: Optimize the twin Unet structure to build a D-Unet change detection model: Based on the basic twin Unet structure, the feature maps extracted by the encoders of the two branches are used to construct a differential feature pyramid. The convolutional attention module is used to reduce redundant information. Finally, the upsampled differential feature map is fused with the output of the decoder to improve the accuracy of the change detection results using differential features.
[0011] Step 4: Train the D-Unet change detection model: Based on the LEVIR-CD dataset, train and test the D-Unet-based change detection model to obtain a trained D-Unet-based change detection model.
[0012] Step 5: Input remote sensing images of different time phases into the trained D-Unet change detection model to obtain the final detection results.
[0013] Furthermore, the differential feature pyramid in step three is constructed based on the encoder of the Twin U-Net. The differential feature maps at each level of the Twin U-Net encoder contain semantic information of different scales, which are used to represent target features of different scales. The differences of the differential feature maps at each level are calculated and the absolute values are taken to obtain differential feature maps of different sizes, forming a differential feature pyramid.
[0014] Furthermore, the differential feature pyramid in step three is combined with an attention mechanism to reduce redundant information, specifically including: passing differential feature maps of different sizes in the differential feature pyramid through convolutional attention modules respectively.
[0015] Furthermore, the prediction result in step three is fused with the output of the decoder and the differential feature pyramid, and the output result of the last layer of the decoder is concatenated with the four differential feature maps obtained by the operation. Then, a convolution with a size of 1×1 and a convolution kernel of 1 is performed to reduce the number of channels to 1, and finally the convolution is input into the sigmoid function to obtain the final probability result map.
[0016] Furthermore, the loss function of the network training in step 4 uses Focal Loss.
[0017] Another object of the present invention is to provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the building change detection method based on the twin Unet model.
[0018] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to execute the building change detection method based on the twin Unet model.
[0019] Another object of the present invention is to provide an information data processing terminal, which is used to implement the building change detection method based on the twin Unet model.
[0020] Another object of the present invention is to provide a building change detection system based on a twin Unet model based on the building change detection method based on the twin Unet model, wherein the building change detection system based on the twin Unet model comprises:
[0021] The model building module is used to build a twin network structure based on Unet, integrating the differential feature pyramid and attention mechanism to obtain a change detection model based on D-Unet;
[0022] The model training module is used to train and test the constructed change detection model based on the public remote sensing dataset to obtain a trained change detection model;
[0023] The model detection module is used to input remote sensing images of different phases into the trained change detection model to obtain the final detection results.
[0024] In combination with the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solutions to be protected by the present invention are as follows:
[0025] First, this paper proposes a twin UNet building change detection method that integrates differential feature pyramid and attention mechanism. By constructing a differential feature pyramid and introducing the attention mechanism, the accuracy of building change detection is further improved.
[0026] Second, the present invention integrates the differential feature pyramid and convolutional attention module into the twin Unet to establish a D-Unet model. By constructing the differential feature pyramid layer, the change information of the dual-phase image can be explicitly emphasized, improving the model's ability to obtain change features and reducing the loss of shallow information. By introducing the convolutional attention module, redundant change information of non-buildings is reduced, further emphasizing the feature information of the changing target, and improving the accuracy of change detection. Experimental results show that compared with change detection methods such as Unet and FC-Siam-diff, the present invention has higher accuracy, F1 coefficient, and IoU.
[0027] Third, after extracting features from bi-temporal images, some practitioners in this field simply fuse the features directly to extract change information in the encoder, thereby solving the problem of change detection. This approach fails to explicitly emphasize the feature differences between the bi-temporal images. Considering that feature differences also carry change information and contribute to change detection, this failure to explicitly emphasize the feature differences between the bi-temporal images is a technical bias in this field.
[0028] The present invention overcomes this technical bias by constructing a differential feature pyramid based on the twin U-Net, utilizing shallow feature change information, reducing the loss of original change information, and improving the change detection accuracy for small targets and target edges.
[0029] Fourth, the present invention brings about significant technological advancement.
[0030] (1) A building change detection method based on the Twin Unet model is proposed. This method utilizes the powerful segmentation ability of the Unet network and the contrastive learning characteristics of the Twin network structure. At the same time, the accuracy of change detection is further improved by fusing the differential feature pyramid and the attention mechanism. The significant technical progress lies in the proposal of a novel building change detection model for remote sensing images.
[0031] (2) The implementation steps of the above change detection method are described in detail, including data preprocessing, building a twin Unet network structure, optimizing the twin Unet structure to build a D-Unet change detection model, training the D-Unet change detection model, and inputting remote sensing images of different phases into the trained D-Unet change detection model. The significant technical progress is that it provides a complete and feasible change detection method.
[0032] (3) The method of constructing a differential feature pyramid based on the encoder of the twin Unet is clarified. This method can capture target features of different scales, thereby improving the accuracy of change detection. The significant technical progress lies in proposing a novel differential feature pyramid construction method that helps to improve the accuracy of change detection.
[0033] (4) A method of combining the attention mechanism into the differential feature pyramid to reduce redundant information is proposed. This method can further improve the performance of the model. The significant technical advancement lies in introducing the attention mechanism into the differential feature pyramid, which effectively improves the performance of the model.
[0034] (5) The method of how to fuse the prediction results with the output of the decoder and the differential feature pyramid is clarified. This method connects the output results of the last layer of the decoder and the four differential feature maps obtained by the operation, and then performs convolution to reduce the number of channels to 1. Finally, it is input into the sigmoid function to obtain the final probability result map. The significant technical progress lies in proposing a novel prediction result fusion method that helps to improve the accuracy of change detection.
[0035] (6) The method of using Focal Loss as the loss function during network training is clarified. This method can effectively solve the problem of class imbalance and improve the performance of the model. The significant technical progress lies in the use of Focal Loss, which effectively solves the problem of class imbalance and improves the performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a flow chart of a building change detection method based on a twin Unet model provided by an embodiment of the present invention;
[0037] Figure 2 is a schematic structural diagram of a differential feature pyramid provided by an embodiment of the present invention;
[0038] Figure 3 is a schematic diagram of the structure of the convolutional attention module provided by an embodiment of the present invention;
[0039] Figure 4 Schematic diagram of the network structure of D-Unet provided by an embodiment of the present invention;
[0040] Figure 5 2 is a schematic diagram of a change detection result provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0042] like Figure 1 As shown, the building change detection method based on the twin Unet model provided by the embodiment of the present invention includes the following steps:
[0043] S101: Construct a twin network structure based on Unet, integrate the differential feature pyramid and attention mechanism, and obtain a change detection model based on D-Unet. This mainly includes: the construction of twin Unet, the construction of differential feature pyramid, the construction of convolutional attention mechanism, and the construction of D-Unet;
[0044] S102: Based on the publicly available remote sensing dataset, the constructed change detection model is trained and tested to obtain a trained change detection model;
[0045] S103: Inputting remote sensing images of different time phases into the trained change detection model to obtain the final detection results.
[0046] Example 1:
[0047] The building change detection method based on the twin Unet model provided in an embodiment of the present invention includes the following steps:
[0048] Step 1: Data preprocessing, which involves cropping the dual-phase images and change labels in the LEVIR-CD dataset into 256×256 pixel blocks to obtain image blocks of uniform size.
[0049] Step 2: Construct a twin network structure based on Unet: Since change detection requires two images as input, the single-input semantic segmentation Unet network needs to be improved to a twin structure with two inputs. The weight values of the left-half encoder are shared between the two inputs, and features are extracted from the two inputs separately. Then, the two extracted feature maps are spliced through concatenation and input to the right-half decoder together. At the same time, the original jump connection of Unet is retained, and the feature maps of each level obtained from the two sub-networks are connected to the corresponding parts of the right decoder through concatenation channel splicing, and finally the pixel-by-pixel classification change detection results are output;
[0050] Step 3: Optimize the twin Unet structure to build a D-Unet change detection model: Based on the basic twin Unet structure, the feature maps extracted by the encoders of the two branches are used to construct a differential feature pyramid, and the convolutional attention module is used to reduce redundant information. Finally, the upsampled differential feature map is fused with the output of the decoder, thereby using differential features to improve the accuracy of change detection results.
[0051] Step 4: Train the D-Unet change detection model: Based on the LEVIR-CD dataset, train and test the D-Unet-based change detection model to obtain a trained D-Unet-based change detection model.
[0052] Step 5: Input remote sensing images of different time phases into the trained D-Unet change detection model to obtain the final detection results.
[0053] In an embodiment of the present invention, the differential feature pyramid in step 3 is constructed based on the Twin Unet encoder. Because the differential feature maps of each level of the Twin Unet encoder have a pyramid structure from large to small, they themselves contain semantic information of different scales and can be used to represent target features of different scales. Therefore, the differential feature maps at each level naturally have the structure of a feature pyramid. The difference of the differential feature maps at each level is calculated and the absolute value is taken to obtain differential feature maps of different sizes, thereby forming a differential feature pyramid.
[0054] In an embodiment of the present invention, the differential feature pyramid in step three is combined with an attention mechanism to reduce redundant information, specifically comprising: passing differential feature maps of different sizes in the differential feature pyramid through a convolutional attention module respectively, thereby reducing information redundancy in the non-building part of the differential feature map.
[0055] In an embodiment of the present invention, the prediction result in step three fuses the output of the decoder and the differential feature pyramid, and the output result of the last layer of the decoder is concatenated with the four differential feature maps obtained by the above operation. Then, a convolution with a size of 1×1 and a convolution kernel of 1 is performed to reduce the number of channels to 1, and finally the result is input into the sigmoid function to obtain the final probability result map.
[0056] In an embodiment of the present invention, in step 4, to address the problem of a large difference between the number of changed pixels and the number of non-changed pixels and an imbalance in the number of positive and negative samples, the loss function of network training uses Focal Loss to suppress the contribution of a large number of non-changed pixels to the loss and improve the accuracy of change detection.
[0057] Example 2:
[0058] The CPU of the environment server used in the embodiment of the present invention is Intel(R) Core(TM) i5-12500H, the GPU is NVIDIA GeForce GTX 3050, the operating system is Windows 11, and the compilation environment is Tensorflow-gpu2.6.0, Python 3.9, CUDA11.3.1 and CUDNN 8.2.1.
[0059] A building change detection model based on deep learning of the present invention comprises the following steps:
[0060] Step 1: Prepare the dataset and crop the images and labels using a sliding window of 256×256 pixels to obtain image blocks of the same pixel size.
[0061] Step 2: Build a twin network structure based on Unet: To meet the application requirements of remote sensing image change detection, the remote sensing image change detection problem is converted into an image semantic segmentation problem for processing. First, a Unet network is built and then improved into a twin structure based on this.
[0062] Step 2.1: Construct a Unet network: In this embodiment of the present invention, the U-Net network structure has a total of 5 layers, mainly consisting of a decoder and an encoder, each of which contains five convolution blocks. Each convolution block consists of two repeated 3×3 convolution operations (padding = 0), each followed by a rectified linear unit (ReLU) activation function, and the two sets of convolutions are followed by a maximum pooling operation with a stride of 2 for downsampling. The input image of size 256×256×1 is convolved and downsampled layer by layer by the encoder, and the number of channels is doubled while the size is halved, and finally converted into a feature map of size 16×16×512. Then, the feature map is convolved and upsampled layer by layer by the decoder, and the number of channels is reduced while the size is doubled. During the upsampling process, the feature map is spliced with the corresponding feature map of the encoder to fuse the shallow layer information. After obtaining the feature map of size 256×256×32, all channels are fused through 1×1 convolution, and the final output is a classification result map of size 256×256×1.
[0063] Step 2.2: Improved to a Twin U-net Change Detection Model: The Twin U-net model builds on the basic U-net network by adding an input branch and sharing the weights of the left-half encoder between the two inputs. Feature extraction is performed on each input separately, and the two extracted feature maps are then concatenated channel-wise and fed into the right-half decoder. While retaining the original skip connections of the U-net, the feature maps at each level obtained from the two sub-networks are concatenated channel-wise and connected to the corresponding parts of the right decoder, ultimately outputting pixel-by-pixel change detection results.
[0064] Step 3: Optimize the twin Unet structure to build a D-Unet change detection model: The D-Unet change detection network used in the embodiment is as follows: Figure 4 As shown in Figure 2, the two bi-temporal feature maps output by the weight-sharing encoder are differentiated and their absolute values are taken to generate a differential feature pyramid containing change information. The differential feature maps are passed through a convolutional attention module to emphasize features in the changing regions and reduce redundant information. Finally, by upsampling the differential feature maps at each level to the original image size and fusing them with the decoder output, the network's ability to detect changes in small objects and object edges is improved.
[0065] Step 3.1: See attached Figure 2 The construction of the differential feature pyramid includes: using the encoder with shared weights to output two feature maps, calculating the difference between the two and taking the absolute value, and using the result as the differential feature map representing the change feature. Then, the above operation is performed on the feature maps obtained by the first 4 blocks of the encoder part, and the size of the original feature map is obtained. Figure 1Four groups of differential feature maps of / 2, 1 / 4, 1 / 8, and 1 / 16 constitute the differential feature pyramid;
[0066] Step 3.2: Construct channel attention: (1) Generate weight vector: Perform global maximum pooling and global evaluation pooling on the input feature map respectively, and convert the two feature maps of dimension (N, N, C) into two vectors of dimension (1, 1, C). (2) Update weights: First, pass the two weight vectors through a multi-layer perceptron with shared weights. This module includes two superimposed fully connected layers and an activation layer to map the input vector without changing its dimension. Then, the weight vector is normalized to between 0 and 1 through sigmoid activation as the final weight of each channel. (3) Channel weighting: Multiply the above channel weight vector with the input feature map to obtain the channel-weighted feature map;
[0067] Step 3.3: Construct spatial attention: (1) Generate weight vector: Calculate the maximum and average values of all channels for each pixel of the input feature map, and convert the feature map of dimension (N, N, C) into two vector maps of dimension (N, N, 1). (2) Update weight: Concatenate the two feature maps and perform 1×1 convolution, then perform sigmoid activation as the weight value of each channel pixel in the feature map. (3) Spatial weighting: Multiply the weight vector with the input feature map to obtain a feature map with spatial pixel weighting.
[0068] Step 3.4: See attached Figure 3 , cascade channel attention and spatial attention to calculate the distribution of weights from two independent dimensions, channel and space. Then, different weights are assigned to each channel and each pixel of the input feature map to form a convolutional attention module, and the feature map is weighted by the convolutional attention module.
[0069] Step 3.5: Perform a convolution on the feature map output by the convolution attention module with a size of 1×1 and a convolution kernel of 1. After the convolution, use Batch Normalization and ReLU activation function to output four differential feature maps with a channel number of 1. Perform bilinear interpolation upsampling on the four feature maps by 2, 4, 8, and 16 times to obtain the same size as the original. Figure 1 The output of the last layer of the decoder is concatenated with the four differential feature maps obtained by the above operation, and then a convolution with a size of 1×1 and a convolution kernel of 1 is performed. The convolution kernel is input to the sigmoid function to obtain the final probability result map.
[0070] Step 4: Divide the LEVIR-CD dataset into training, validation, and test sets at a ratio of 70%, 10%, and 20%, and train the network model obtained in step 3. Set appropriate batch size, learning rate, and other key hyperparameters. If the hardware allows, generally try to set a larger batch size. The optimizer used for training the network is Adam, and the loss function used is Focal Loss, calculated as shown in (1).
[0071]
[0072] Where y represents the value of the label (0 or 1), p represents the probability of being classified as a changed pixel (between 0 and 1), and α and γ are empirical parameters. By adjusting the values of α and γ, the degree of correction of sample imbalance can be controlled to adapt to the degree of sample imbalance. In this embodiment, α is 0.9 and γ is 1.5.
[0073] In change detection tasks, data imbalance often occurs due to the large difference in the total number of pixels between the changed area and the background. Focal Loss essentially uses binary cross-entropy to weight the predicted values and adjust the contribution of positive and negative samples to the loss function, thereby better addressing the data imbalance and improving the accuracy of farmland extraction.
[0074] Step 5: Change Detection: For the remote sensing image to be detected, a sliding window is used to generate 256×256 pixel image patches. Each image patch is then fed into the network model trained in Step 4, which outputs the change detection results. Finally, the image patches are stitched together to restore the image size.
[0075] After the entire network training is completed and the results converge, select Figure 5 A comparative analysis was conducted in the central experimental area, where the image size was 256×256×3 (H×W×C). Three network models, Unet, FC-Siam-diff, and D-Unet, were used to detect building changes. All three models used Relu as the hidden layer activation function, Focal Loss as the loss function, and the Adam optimizer.
[0076] To ensure comparability, the three training methods have the same hyperparameters such as Epoch, Batch Size, initial learning rate, and neural network input size.
[0077] The building change detection system based on the twin Unet model provided in an embodiment of the present invention includes:
[0078] The model building module is used to build a twin network structure based on Unet, integrating the differential feature pyramid and attention mechanism to obtain a change detection model based on D-Unet;
[0079] The model training module is used to train and test the constructed change detection model based on the public remote sensing dataset to obtain a trained change detection model;
[0080] The model detection module is used to input remote sensing images of different phases into the trained change detection model to obtain the final detection results.
[0081] For remote sensing images from the LEVIR-CD dataset, 256×256 pixel image patches were obtained using a sliding window. Three network models, Unet, FC-Siam-diff, and D-Unet, were iteratively trained on this dataset. To ensure comparability, the three models were trained using the same hyperparameters, including epochs, batch size, initial learning rate, and neural network input size.
[0082] After the entire network training is completed and the results converge, select Figure 5 An experimental comparative analysis was conducted in the experimental area, where the image size of the experimental area is 256×256×3 (H×W×C). Three network models, Unet, FC-Siam-diff and D-Unet, were used to detect building changes. All three models use Relu as the hidden layer activation function, Focal Loss as the loss function, and Adam optimizer. It should be noted that the embodiments of the present invention can be implemented by hardware, software, or a combination of software and hardware. The hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated hardware. A person of ordinary skill in the art will understand that the above-mentioned devices and methods can be implemented using computer-executable instructions and / or contained in a processor control code, for example, such codes are provided on a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. The device and its modules of the present invention can be implemented by hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., or can be implemented by software executed by various types of processors, or can be implemented by a combination of the above hardware circuits and software, such as firmware.
[0083] like Figure 5As shown in the change detection results, the Unet and FC-Siam-diff networks can detect changes in buildings in the experimental area and identify changed areas in the image. However, both methods suffer from the U-Net misclassification problem, resulting in some false changes, such as salt and pepper and isolated points, resulting in low overall accuracy. The D-Unet network, which integrates differential features and an attention mechanism, focuses more on changed areas and emphasizes shallow edge information. This fully utilizes shallow image information, enhancing the network's ability to distinguish between changes and non-changes. It can also largely overcome the influence of noise and has good immunity to "false changes." Compared with the change detection results of the Unet and FC-Siam-diff networks, it reduces the false detection rate and further improves change detection accuracy.
[0084] In order to further verify the advantages of the proposed method, the Unet, FC-Siam-diff and D-Unet networks were used for change detection in four experimental areas, and the average values of the evaluation indicators were compared and analyzed. The prediction accuracy results of the three networks are shown in Table 1:
[0085] Table 1 Comparison of evaluation indicators of different methods
[0086]
[0087] As can be seen from Table 1, compared with the Unet and FC-Siam-diff network models, D-Unet has higher overall change detection accuracy and stronger detection robustness.
[0088] Example 1: Data preprocessing
[0089] Implementation: During the data preprocessing phase, this paper uses the LEVIR-CD dataset, which contains pairs of remote sensing images and corresponding change labels. This paper crops the bi-temporal images and change labels in the dataset into 256×256 pixel blocks, obtaining uniformly sized image patches for subsequent model training and testing.
[0090] Example 2: Building a Twin Unet Network
[0091] Implementation: At this stage, the present invention improves the single-input semantic segmentation Unet network into a twin architecture with two inputs. The weights of the left-half encoder are shared between the two inputs, and features are extracted from each input separately. The two extracted feature maps are then concatenated and fed into the right-half decoder. While retaining the original skip connections of the Unet, the feature maps at each level obtained from the two sub-networks are connected to the corresponding parts of the right decoder through concatenated channel splicing, ultimately outputting pixel-by-pixel change detection results.
[0092] Example 3: Building a D-Unet change detection model
[0093] Implementation: Based on the basic Twin Unet architecture, this method constructs a differential feature pyramid using feature maps extracted by the two-branch encoder. A convolutional attention module is then used to reduce redundant information. The upsampled differential feature map is then fused with the decoder output, leveraging the differential features to improve the accuracy of change detection.
[0094] Example 4: Training the D-Unet change detection model
[0095] Implementation: This paper trains and tests a D-Unet-based change detection model based on the LEVIR-CD dataset. During the training phase, the present invention uses Focal Loss as the loss function to address class imbalance. After several rounds of training, the present invention obtains a trained D-Unet-based change detection model. The present invention then inputs remote sensing images from different time phases into the trained D-Unet change detection model to obtain final detection results.
[0096] The above description is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with this technical field within the technical scope disclosed by the present invention and within the spirit and principles of the present invention should be covered by the scope of protection of the present invention.
Claims
1. A building change detection method based on the twin Unet model, characterized in that: The following steps are involved: Step 1: Data preprocessing, which involves cropping the dual-phase images and change labels in the LEVIR-CD dataset into 256×256 pixel blocks to obtain image blocks of uniform size. Step 2: Construct a twin network structure based on Unet: Since change detection requires two images as input, the single-input semantic segmentation Unet network needs to be improved to a twin structure with two inputs; the weight value of the left half encoder is shared between the two inputs, and features are extracted from the two inputs respectively. Then, the two extracted feature maps are spliced through concatenation and input to the right half decoder together; at the same time, the original skip connection of Unet is retained, and the feature maps of each level obtained by the two sub-networks are connected to the corresponding part of the right decoder through concatenation channel splicing, and finally the pixel-by-pixel classification change detection result is output; Step 3: Optimize the twin Unet structure to build a D-Unet change detection model: Based on the basic twin Unet structure, the feature maps extracted by the encoders of the two branches are used to construct a differential feature pyramid. The convolutional attention module is used to reduce redundant information. Finally, the upsampled differential feature map is fused with the output of the decoder to improve the accuracy of the change detection results using differential features. Step 4: Train the D-Unet change detection model: Based on the LEVIR-CD dataset, train and test the D-Unet-based change detection model to obtain a trained D-Unet-based change detection model. Step 5: Input remote sensing images of different time phases into the trained D-Unet change detection model to obtain the final detection results.
2. The building change detection method based on the twin Unet model according to claim 1, characterized in that: The differential feature pyramid in step three is constructed based on the encoder of the Twin U-Net. The differential feature maps at each level of the Twin U-Net encoder contain semantic information of different scales, which are used to represent target features of different scales. The differences of the differential feature maps at each level are calculated and the absolute values are taken to obtain differential feature maps of different sizes, forming a differential feature pyramid.
3. The building change detection method based on the twin Unet model according to claim 1, characterized in that: In step three, the differential feature pyramid is combined with the attention mechanism to reduce redundant information, specifically including: passing the differential feature maps of different sizes in the differential feature pyramid through the convolution attention module respectively.
4. The building change detection method based on the twin Unet model according to claim 2, characterized in that: The prediction result in step 3 is fused with the output of the decoder and the differential feature pyramid. The output result of the last layer of the decoder is concatenated with the four differential feature maps obtained by the operation, and then a convolution with a size of 1×1 and a convolution kernel of 1 is performed to reduce the number of channels to 1. Finally, the convolution is input into the sigmoid function to obtain the final probability result map.
5. The building change detection method based on the twin Unet model according to claim 1, characterized in that: The loss function of the network training in step 4 uses Focal Loss.
6. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the building change detection method based on the twin Unet model according to any one of claims 1 to 5.
7. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the building change detection method based on the twin Unet model according to any one of claims 1 to 5.
8. An information data processing terminal, characterized in that: The information data processing terminal is used to implement the building change detection method based on the twin Unet model described in any one of claims 1 to 5.
9. A building change detection system based on a twin Unet model based on the building change detection method based on a twin Unet model according to any one of claims 1 to 5, characterized in that: The building change detection system based on the twin Unet model includes: The model building module is used to build a twin network structure based on Unet, integrating the differential feature pyramid and attention mechanism to obtain a change detection model based on D-Unet; The model training module is used to train and test the constructed change detection model based on the public remote sensing dataset to obtain a trained change detection model; The model detection module is used to input remote sensing images of different phases into the trained change detection model to obtain the final detection results.
Citation Information
Patent Citations
Scene change contour detection of twin differential network
CN114399691A
Target re-recognition model training method and device, and target re-recognition method and device
WO2023279935A1