Remote sensing image classification network training method, remote sensing image classification method and product
By combining the feature extraction of Transformer and CNN, the sliding window residual network SWINT-RESNet is designed, which solves the shortcomings of global feature and detailed information extraction in remote sensing image classification, improves classification accuracy and reduces the computational complexity, and realizes efficient remote sensing Image classification.
Patent Information
- Application Number
- CN202410910226.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-11-01
AI Technical Summary
The existing deep neural networks are not perfect for global feature extraction in remote sensing image classification, and Transformer is difficult to effectively model the detailed information of image changes, and the computational complexity increases quadratically with the image resolution, resulting in classification accuracy and computing efficiency. question.
Combining the global features extracted by Transformer and the local features extracted by CNN network, a multi-feature fusion semantic classification network SWINT-RESNet is designed through sliding window calculations, and feature maps of different sizes are extracted using the SWINT module and the RESENT module, and the feature maps of different sizes are extracted through The fusion and upsampling modules generate output feature maps and train remote sensing image classification models.
The accuracy of remote sensing image classification is improved, and the calculation complexity is reduced through separate window calculations, achieving more efficient feature extraction and classification performance.
Smart Images

Figure CN118887449A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image classification, and in particular to a remote sensing image classification network training method, a remote sensing image classification method and a product. Background Art
[0002] Deep neural networks have been widely used in remote sensing image classification, and more and more artificial intelligence methods are being applied to remote sensing object classification. CNN networks have excellent results in extracting local features and are currently widely used in image classification tasks. However, with the increase in image samples, their extraction of global features is not perfect. At the same time, transformers, which have developed rapidly in the field of natural language processing, have made great progress in computer vision in recent years. However, although transformers can capture the global information of remote sensing images, they cannot model the detailed information of image changes well, and their computational complexity increases quadratically with the resolution of the image. Summary of the invention
[0003] The purpose of the present invention is to provide a remote sensing image classification network training method, a remote sensing image classification method and a product, which combine the global features extracted by Transformer and the local features extracted by CNN network, so as to improve the accuracy of remote sensing image classification and reduce the computational complexity by means of separate window calculation.
[0004] To achieve the above object, the present invention provides the following solutions:
[0005] In a first aspect, the present invention provides a method for training a remote sensing image classification network, the method comprising:
[0006] Acquire a remote sensing image; the remote sensing image has a category label;
[0007] Using the SWINT module, extracting a plurality of first feature maps of different sizes of the remote sensing image; in the extraction process, dividing the feature map of the remote sensing image into a plurality of non-intersecting areas, and performing calculations in separate windows;
[0008] Using the RESENT module, extracting a plurality of second feature maps of different sizes from the remote sensing image; the number of the second feature maps is the same as the number of the first feature maps;
[0009] Using a fusion module, a plurality of first feature maps and a plurality of second feature maps are fused to obtain a fused feature map;
[0010] Using an upsampling module, upsampling the fused feature map to obtain an output feature map;
[0011] The SWINT module and the RESNET module are trained according to the output feature map and the category label to obtain a remote sensing image classification model; the remote sensing image classification model includes a SWINT module, a RESENT module, a fusion module and an upsampling module.
[0012] Optionally, the SWINT module includes:
[0013] The splitting layer is used to split the input remote sensing image into non-overlapping image blocks of equal size;
[0014] A linear embedding layer, used for projecting the image block to obtain a projection result;
[0015] A Swin Transformer layer is used to calculate the self-attention of the projection results in non-overlapping windows to obtain attention features;
[0016] The MLP layer is used to extract feature maps of different sizes according to the attention features.
[0017] Optionally, the SWINT module package also includes:
[0018] The residual layer is used to connect the Swin Transformer layer and the MLP layer.
[0019] Optionally, the RESENT module includes:
[0020] A convolutional pooling layer, used to extract features of the remote sensing image using convolution and maximum pooling operations to obtain convolutional pooling features;
[0021] The feature extraction layer is used to extract the feature map of the convolutional pooling feature layer by layer to obtain feature maps of different sizes.
[0022] Optionally, the category labels include six categories: impervious surface, building, low vegetation, tree, car and background.
[0023] Optionally, the background includes: a body of water, a container, a tennis court and a swimming pool.
[0024] In a second aspect, the present invention provides a remote sensing image classification method, the method comprising:
[0025] Obtain remote sensing images to be classified;
[0026] The remote sensing image to be classified is input into a remote sensing image classification model to obtain a classification result; the remote sensing image classification model is trained using the remote sensing image classification network training method as described in any of the above items.
[0027] In a third aspect, the present invention provides a computer device comprising: a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the above-mentioned methods for training a remote sensing image classification network or the steps of implementing the above-mentioned remote sensing image classification method.
[0028] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the training method of the remote sensing image classification network described in any one of the above items or implements the steps of the above remote sensing image classification method.
[0029] In a fifth aspect, the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the training method of the remote sensing image classification network described in any one of the above items or the steps of implementing the above remote sensing image classification method.
[0030] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0031] The present invention provides a remote sensing image classification network training method, a remote sensing image classification method and a product. First, a remote sensing image is obtained; the remote sensing image has a category label; a SWINT module is used to extract a plurality of first feature maps of different sizes of the remote sensing image; the feature map of the remote sensing image is divided into a plurality of non-intersecting areas during the extraction process, and is calculated in a separate window; a RESENT module is used to extract a plurality of second feature maps of different sizes of the remote sensing image; the number of the second feature maps is the same as the number of the first feature maps; a fusion module is used to fuse a plurality of first feature maps and a plurality of second feature maps to obtain a fusion feature map; an upsampling module is used to upsample the fusion feature map to obtain an output feature map; the SWINT module and the RESNET module are trained according to the output feature map and the category label to obtain a remote sensing image classification model; the remote sensing image classification model includes a SWINT module, a RESENT module, a fusion module and an upsampling module. The present invention combines the advantages of the SWINT module in extracting global features with the advantages of the RESENT module in extracting local features, thereby improving the accuracy of remote sensing image classification and reducing the computational complexity by means of separate window calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 A schematic diagram of the flow chart of the training method for the remote sensing image classification network provided in Example 1 of the present invention.
[0034] Figure 2 Schematic diagram of the ISPRS Vaihingen 2D semantic classification dataset provided in Example 1 of the present invention.
[0035] Figure 3 This is a schematic diagram of the main structure of the SWINT module provided in Example 1 of the present invention.
[0036] Figure 4 This is a schematic diagram of the structure of the Swin Transformerblock provided in Example 1 of the present invention.
[0037] Figure 5 This is a schematic diagram of the main structure of the ResNet module provided in Example 1 of the present invention.
[0038] Figure 6 This is a schematic diagram of the overall structure of the remote sensing image classification model provided in Example 1 of the present invention.
[0039] Figure 7 This is a schematic diagram of the visualization results of remote sensing image classification using the SWINT-RESNet model provided in Example 1 of the present invention.
[0040] Figure 8 A schematic diagram for visual comparison of classification results provided in Example 1 of the present invention.
[0041] Fig. 9 This is a diagram of the internal structure of a computer device provided in Example 3 of the present invention. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] In order to comprehensively make up for the defects of CNN network and Transformer network in feature extraction, the present invention proposes a semantic classification network (SWINT-RESNet) with multi-feature fusion. The present invention combines the global feature extraction of Transformer and the local feature extraction of residual network, and proposes a semantic classification network with multi-feature fusion, called sliding window residual network (SWINT-RESNet), to improve the accuracy of remote sensing image classification. The algorithm combines the sliding window SwinTransformer network and the residual network RESNet, combines the global features extracted by Transformer and the local features extracted by CNN network, makes up for the defects of these two networks in feature extraction, and thus improves the accuracy of remote sensing image classification. Multiple features are extracted in different network structures for fusion. The present invention is verified in the Potsdam area in the ISPRS Vahingen 2D semantic labeling dataset, and the performance of the model is comprehensively evaluated.
[0044] The purpose of the present invention is to provide a remote sensing image classification network training method, a remote sensing image classification method and a product, which combine the global features extracted by Transformer and the local features extracted by CNN network, so as to improve the accuracy of remote sensing image classification and reduce the computational complexity by means of separate window calculation.
[0045] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0046] Example 1
[0047] like Figure 1 As shown, this embodiment provides a training method for a remote sensing image classification network, the method comprising:
[0048] S1. Acquire a remote sensing image; the remote sensing image has a category label. The category label includes six categories: impermeable surface, building, low vegetation, tree, car and background. The background includes water body, container, tennis court and swimming pool.
[0049] ISPRS Vaihingen 2D semantic labeling is an ultra-high-resolution airborne remote sensing semantic labeling dataset, from which the Potsdam regional dataset was selected for model evaluation in this example (https: / / www.isprs.org / education / benchmarks / UrbanSemLab / default.aspx; accessed on April 20, 2023). The dataset mainly consists of near-infrared, red, and green channels, as well as the corresponding surface elevation model and standardized surface elevation data. The dataset includes six feature types: six categories / classes are defined, such as Figure 2 As shown, Figure 2 The six categories are impervious surfaces, buildings, low vegetation, trees, cars, and clutter / background. The clutter / background class includes water bodies (there is a part of a river in the image) and other parts that look different from other objects (for example: containers, tennis courts, swimming pools) and usually have little effect on the classification of semantic objects in urban scenes.
[0050] The ISPRS Vaihingen 2D semantic label dataset has the advantages of moderate data volume and rich semantic content, which is suitable for training and testing models in this study. The two areas selected in this embodiment cover urban scenes. Potsdam shows a typical historical city with large buildings, narrow streets and dense settlement structures.
[0051] S2. Using the SWINT module, extracting a plurality of first feature maps of different sizes of the remote sensing image; in the extraction process, dividing the feature map of the remote sensing image into a plurality of non-overlapping areas, and performing calculations in separate windows.
[0052] Among them, the SWINT module includes:
[0053] The splitting layer is used to split the input remote sensing image into non-overlapping image blocks of equal size;
[0054] A linear embedding layer, used for projecting the image block to obtain a projection result;
[0055] A SwinTransformer layer is used to calculate the self-attention of the projection results in non-overlapping windows to obtain attention features;
[0056] The MLP layer is used to extract feature maps of different sizes according to the attention features.
[0057] A residual layer is used to connect the SwinTransformer layer and the MLP layer.
[0058] Specifically, the main architecture of the SWINT module in this embodiment is as follows: Figure 3 As shown, Figure 3 After the input image is passed into the SWINT module, it passes through PatchPartition and generates a feature map in the Swin Transformerblock, and generates an output feature map through convolution and normalization operations. In addition, the large-scale feature map is gradually refined to obtain feature maps of three scales.
[0059] It first splits the input H×W×3 RGB image (i.e. the remote sensing image mentioned above) into non-overlapping patches of equal size (in this embodiment, patches are interpreted as image blocks) through the Patch Partition module. The number of patches is calculated as:
[0060] n=N×(P 2 ×3)#(4-1)
[0061] Per P 2 Each ×3 patch is considered as a patchtoken (image block marker), and a total of N effective input sequence lengths of Transformer are split. H and W are the height and width of the input remote sensing image and feature map, and P is the height and width of each patch. The linear embedding layer converts the dimension at this time into The tensor of is projected to any dimension C, and the dimension is These patchtokens (which are now Linear Embeddings) are then fed into several SwinTransformerblocks with improved self-attention. The first Swin Transformerblock keeps the number of input and output tokens constant. constant.
[0062] Swin Transformer introduces hierarchical feature calculation, and the number of tokens is gradually reduced through the Patch Merging layer. The first Patch Merging layer concatenates each group of 2×2 adjacent patches, and the number of patch tokens becomes The dimension of patchtoken is expanded by 4 times to 4C. Then, a linear layer is used on the 4C-dimensional patch concatenation feature to reduce the output dimension to 2C. Then, SwinTransformerblocks is used to transform the feature, and its resolution is maintained. The first Patch merging layer and the feature transformation Swin Transformerblock are designated as Stage. Repeating the same process, each Stage will change the dimension of the tensor, thus forming a hierarchical representation. After each module, the residual direct connection is applied and the input MLP module gradually generates feature maps of different sizes.
[0063] Among them, SwinTransformer replaces the standard multi-head self-attention module (MSA) in VisionTransformer (Vit) with a shift window-based multi-head self-attention module (W-MSA / SW-MSA) and keeps other parts unchanged. Figure 4 As shown in Figure 1, a Swin Transformerblock consists of a shifted window-based MSA module followed by a 2-layer MLP with a GeLU nonlinearity in the middle. A LayerNorm (LN) layer is applied before each MSA module and each MLP, and a residual connection is applied after each module.
[0064] The standard Transformer architecture and its adaptation for image classification both perform global self-attention, which computes the relationship between each token and all other tokens. The global self-attention computation has a quadratic computational complexity O(N) with respect to the number of tokens. 2 D), where N is the token (sequence length) and D is the token vector length (embedding dimension), making it unsuitable for many computationally intensive visual problems such as high-resolution image representation that require a large number of tokens.
[0065] In order to improve computational efficiency, SwinTransformer calculates self-attention in non-overlapping local windows instead of global self-attention. The image is evenly divided in a non-overlapping manner to obtain each window. Given D = 2C, then each non-overlapping local window contains N = M × M patch tokens, then based on N = h × w patchtokens. The computational complexity of the MSA module of the image window and the W-MSA module based on the non-overlapping local window are:
[0066] Ω(MSA)=4hwC 2 +2(hw) 2 ;
[0067] Ω(W-MSA)=4hwC 2 +2M 2 hw.
[0068] S3. Using a RESENT (residual network) module, extract a plurality of second feature maps of different sizes from the remote sensing image; the number of the second feature maps is the same as the number of the first feature maps.
[0069] Among them, the RESENT module includes:
[0070] A convolutional pooling layer, used to extract features of the remote sensing image using convolution and maximum pooling operations to obtain convolutional pooling features;
[0071] The feature extraction layer is used to extract the feature map of the convolutional pooling feature layer by layer to obtain feature maps of different sizes.
[0072] Specifically, ResNET is mainly used to extract local features. At the same time, in order to fully combine with the features of the SWINT part, after the remote sensing image is input into this module, it first undergoes convolution and maximum pooling operations to obtain the preliminary feature extraction result Stage1. Then, based on Stage1, features are extracted layer by layer in the network, and feature maps of different sizes are output and combined with the feature maps of the SWINT part. The overall structure of ResNet is as follows Figure 5 As shown, Figure 5 This is the structural diagram of the ResNet module in this model. The image is input into the ResNet network, and after convolution and normalization operations, it is put into the maximum pooling, and then the feature map is generated through feature extraction inside ResNet. In addition, the small-scale feature map is passed to generate a large-scale feature map, and finally the ResNet module generates feature maps of three scales.
[0073] ResNet has outstanding performance in image classification. It uses shortcuts to solve the problem of model degradation in deep networks. Compared with ordinary networks, a short-circuit mechanism is added between every two or three layers, and residual learning is used to make the deep network work. And as a type of convolutional neural network (CNN), ResNet has excellent performance in extracting local features. This advantage can make up for the problem that transformer extracts global features but does not refine local edges sufficiently.
[0074] For a stacking layer structure, when the input is x, the learned feature is recorded as H(x). If it is hoped that the residual F(x) = H(x)-x can be learned, then the original learned feature is F(x). When the residual is 0, the stacking layer only performs an identity mapping, at least the network performance will not decrease. In fact, the residual will not be 0, which will also enable the stacking layer to learn new features based on the input features, thereby having better performance. The structure of residual learning is shown as a shortcut connection. The residual unit can be expressed as:
[0075]
[0076] Among them, W1 represents all weights in the residual block, x l and x l+1 They represent the input and output of the lth residual unit respectively. Each residual unit generally contains a multi-layer structure. F is the residual function, which represents the learned residual, and h(x l )=x l represents the identity mapping, and f is the ReLU activation function. Based on the above formula, the learning features from the shallow layer l to the deep layer L are obtained as follows:
[0077]
[0078] Among them, i represents the layer number, x i This is the input of this layer, W i That is, all the weights of this layer. When the feature map is input into the Resnet module, a 3x3 convolution kernel is used to perform a two-dimensional convolution operation to initially extract features, and then it is transferred to the two-dimensional batch normalization layer class for normalization operation, which is used to reduce the internal covariate shift (Internal Covariate Shift) during the deep neural network training process. It normalizes the input on each channel dimension and accelerates the training of the model by reducing the changes in the input distribution between different layers.
[0079] The calculation formula of the batch normalization layer is as follows:
[0080]
[0081] Among them, x is the input tensor, y is the normalized output tensor, γ and β represent the learnable parameters of the skin normalization layer, scale parameter, and shift parameter, respectively. E[x] represents the mean of the input tensor x in each channel dimension, Var[x] represents the variance of the input tensor x in each channel dimension, and ∈ is a small constant added for numerical stability. Then, the ReLU activation function is used on the linear tensor, and it is put into MaxPool to implement the maximum pooling operation. Finally, the feature map is used to construct a four-layer residual block. The four-layer residual block is constructed layer by layer from the input features of the previous layer, and finally outputs three layers of residual feature maps of different sizes.
[0082] S4. Using a fusion module, a plurality of first feature maps and a plurality of second feature maps are fused to obtain a fused feature map.
[0083] S5. Use an upsampling module to upsample the fused feature map to obtain an output feature map.
[0084] S6. Train the SWINT module and the RESNET module according to the output feature map and the category label to obtain a remote sensing image classification model; the remote sensing image classification model includes a SWINT module, a RESENT module, a fusion module and an upsampling module.
[0085] In general, the SWINT-RESNET model (the remote sensing image classification model in this embodiment) combines the SWINT module and the RESNET module (such as Figure 6 As shown, Figure 6 The overall structure diagram of SWINT-RESNET includes SWINT module and RESNet module. After the remote sensing image is input into the two modules, two feature maps of different scales are obtained. The classification result is obtained by fusing the feature maps of different scales). After the remote sensing image is input into the model, it enters the two modules respectively. The SWINT module is improved from swintiny, a variant of swintransformer. It produces a hierarchical feature output in the decoding part. Feature maps of different levels have different sizes. High-size feature maps are reconstructed by inputting low-size feature maps. Different from the huge amount of calculation and numerous parameter transfer of visiontransformer, swintiny adopts the concept of Windows Multi-Head Self-Attention (W-MSA), divides the feature map into multiple non-intersecting areas (Window), and Multi-Head Self-Attention is only performed in each window (Window). In short, the hierarchical feature output of the SWINT module can be fully integrated with the CNN network, and Windows Multi-Head Self-Attention can reduce the amount of calculation and ensure the computational efficiency of the model.
[0086] The RESENT module is a classic convolutional neural network ResNet. It uses residual connections to retain the original features, making the network learning smoother and more stable, further improving the accuracy and generalization ability of the model; at the same time, it can avoid the gradient disappearance and gradient explosion problems during training and accelerate network convergence. The image is extracted by these two modules to generate three feature maps of different scales. After the SwinLayers generated by the SWINT module and the Reslayers features of the same scale generated by the RESNET module are fused, the features are upsampled and restored, and then fused with the large-scale features. After the multi-scale module features are fused, the output feature map is finally obtained.
[0087] Experimental design:
[0088] In this embodiment, the remote sensing images in the Potsdam dataset are cut into 1094 images of 512x512 size, of which 712 are used for training set, 288 are used for verification, and 94 are used for testing. In order to enrich the semantic information, simple data enhancement is performed on the training set and the verification set in the data preprocessing stage.
[0089] This experiment was conducted on a workstation equipped with an NVIDIA 3090 graphics card, using the pytorch framework, with patch_size set to 4, the learning rate set to 1e-4, and the cross entropy loss function used as the loss function.
[0090] On this basis, six groups of experiments were designed, mainly including:
[0091] (1) SWINT-RESNet: The multi-scale fusion transformer improved network proposed in this study.
[0092] (2) Unet: unet network using Mix Vision Transformer encoder mit_b1.
[0093] (3) SETR: Transformer for semantic classification, which uses a pure transformer structure to encode an image as a set of patches. Through the global context modeled by each layer in the transformer, the encoder is connected to a simple decoder to form a powerful semantic classification model.
[0094] (4) PSPNet: Pyramid Scene Parseing Network, a scene analysis network built using the pyramid pooling module.
[0095] (5) Deeplabv3+: It uses the mobilenetv2 encoder and introduces the spatial pyramid pooling (SPP) module and encoder-decoder structure into the deep neural network.
[0096] (6) Swin: The network with the ResNet module removed from the SWINT-RESNet network structure is used for ablation in this experiment.
[0097] Accuracy Assessment:
[0098] In this embodiment, pixel accuracy (PixelAccuracy, PA), category average pixel accuracy (MeanPixelAccuracy, MPA), kappa coefficient, recall rate (Recall), F1 score (F1), and frequency weighted intersection over union (FWIoU) are used to evaluate the accuracy. At the same time, some images are compared to intuitively demonstrate the accuracy of the model.
[0099] Pixel accuracy is the ratio of the number of correct samples to the total number of samples. In remote sensing image classification tasks, it refers to the ratio of the number of correctly classified pixels to the total number of pixels. Pixel accuracy is defined as:
[0100]
[0101] Where PA represents pixel accuracy, P represents the number of positive samples, and N represents the number of negative samples. True positives (TP) represent the number of positive samples correctly classified by the model, true negatives (TN) represent the number of negative samples correctly classified by the classification model, FP represents the number of false positive samples (the number of positive samples that should be negative), and FN represents the number of false negative samples (the number of negative samples that should be positive).
[0102] Mean pixel accuracy (MPA) is the ratio of correctly classified pixels in each category, and then the average is calculated. The formula is as follows:
[0103]
[0104] The Kappa coefficient is an indicator used for consistency testing and can also be used to measure the effectiveness of classification. Because for classification problems, the so-called consistency refers to whether the model prediction results are consistent with the actual classification results. The calculation of the Kappa coefficient is based on the confusion matrix, and the value is between -1 and 1, usually greater than 0. The calculation formula of the Kappa coefficient based on the confusion matrix is as follows:
[0105]
[0106] Among them, is the sum of the number of correctly classified samples in each category divided by the total number of samples, that is, the overall classification accuracy.
[0107] Assume that the number of real samples of each class is a1, a2, ..., aC, and the number of predicted samples of each class is b1, b2, ..., bC, and the total number of samples is n, then:
[0108]
[0109] Recall is used to evaluate the detection coverage of the detector for all targets to be detected. For all positive examples in the data set (TP+FN), the proportion of positive examples (TP) correctly identified by the model to all positive examples in the data set. FN represents data that is mistakenly considered as negative examples by the model but is actually positive. Recall is also called the recall rate, and the formula is defined as:
[0110]
[0111] F1 score is an indicator used in statistics to measure the accuracy of a binary classification model. It takes into account both the precision and recall of the classification model. The F1 score can be regarded as a harmonic average of the model's precision and recall, with a maximum value of 1 and a minimum value of 0. The formula for F1 is:
[0112]
[0113] Frequency Weighted Intersection over Union (FWIoU) is an important measure of classification accuracy in image classification. It is based on the frequency of each class and multiplied by the Intersection over Union (IoU) of each class and summed. FWIoU is defined as:
[0114]
[0115] Experimental results and analysis:
[0116] In order to evaluate the overall performance of SWINT-RESNet, the network was used to iterate the data set for 200 times, and the trained model was tested and analyzed. The SWINT-RESNet method proposed in this study was evaluated from two aspects: visualization results and accuracy analysis.
[0117] Classification results:
[0118] In order to further compare the classification results of different models, eight cropped images were selected for analysis. Figure 7 shown.
[0119] Overall, the classification results of the Potsdam area by SWINT-RESNet are very close to the original labels. The outlines of different areas are roughly the same, and the transitions between different categories are relatively natural and smooth. At the same time, there is no missing category in the eight images captured, and the overall distribution pattern of land objects is very complete.
[0120] Classification accuracy:
[0121] The results obtained by the SWINT-RESNet semantic classification model in the test set are statistically compared, see Table 1.
[0122] Table 1 Accuracy results of SWINT-RESNet model for remote sensing image classification
[0123]
[0124] The overall performance of SWINT-RESNet classification is good, with an overall accuracy of 83.66%, which is a good result in the classification study of the ISPRSVaihingen 2D semantic label dataset. The classification accuracy of impervious surfaces is the highest, reaching 95.71%, while the classification accuracy of buildings, low vegetation areas and cars reached 86.70%, 81.73% and 89.55% respectively, which shows that SWINT-RESNet has excellent recognition capabilities for large-area buildings and small-sized cars. However, SWINT-RESNet has poor recognition capabilities for trees and miscellaneous items, only 68.58% and 65.51% respectively. In terms of other data, SWINT-RESNet has a Kappa coefficient of 79.42% and a FWIoU of 72.75%, which are also very good performances. Therefore, the model shows certain superiority in the classification of small sample remote sensing image datasets.
[0125] SWINT-RESNet mainly includes SWINT submodule and ResNet submodule. ResNet module is a supplement to the transformer sampling feature in SWINT module. This section focuses on the contribution of ResNet submodule to the model, and compares it with Unet, Deeplabv3+, PSPNet, and STER to compare and evaluate the classification accuracy of SWINT-RESNet.
[0126] This example extracts four groups of results, namely the original image, the original label, the SWINT-RESNet classification result, the Swin classification result without the ResNet module, the unet network classification result using the Mix Vision Transformer encoder mit_b1, and the SETR classification result. Figure 8 shown.
[0127] Overall, the classification results of SWINT-RESNet are better and closer to the classification results of the original label.
[0128] In the first group: low vegetation areas show obvious holes in the SWIN classification results. Most of these areas are identified as trees, while this category remains more complete in the SWINT-RESNet classification results. UNet and SETR also accurately identify low vegetation areas, but spots appear in building areas. SWINT-RESNet does not have this problem.
[0129] In the second group: All four models made some mistakes in classifying building areas, misidentifying some areas as low vegetation areas, but SWINT-RESNet retained the integrity of building areas to a greater extent, while UNet classified buildings too incompletely. In the classification of small categories such as cars, SWIN and SETR made mistakes in classification, while SWINT-RESNet classified small objects more completely.
[0130] In the third group: All four models have some misclassifications of impervious surfaces, identifying some areas as buildings. However, SWINT-RESNet's classification of low vegetation areas is very complete, and it retains the integrity of tree areas to the greatest extent. SWIN directly loses low vegetation areas, and the edges of SWINT-RESNet's classification results are smoother.
[0131] In the fourth group: SWINT-RESNet retains the general spatial distribution pattern of objects, while SWIN and SETR lose the tiny car category, and UNet recognizes too many cars. In general, SWINT-RESNet has better classification performance and accuracy, and the network can supplement more local details for the original transformer.
[0132] In this embodiment, a precision comparison experiment with other models is also carried out.
[0133] In order to more accurately evaluate the remote sensing image classification level of SWINT-RESNet, the experimental results are compared with other baseline models, as shown in Table 2.
[0134] Table 2 Comparison of classification results accuracy
[0135] Method Imprevious surfaces Building Low vegetation Tree Car Clutter / background OA swin 99.34% 70.09% 81.53% 62.17% 75.01% 46.30% 75.96% Setr 99.64% 63.17% 69.01% 54.77% 72.19% 0.00% 69.93% Unet 98.98% 80.86% 89.30% 70.15% 81.32% 65.81% 83.02% Pspnet 97.86% 82.48% 84.78% 76.83% 79.83% 70.53% 83.28% Deeplabv3+ 97.46% 80.82% 90.48% 67.51% 80.72% 68.11% 82.39% Swin-Resnet 95.71% 86.70% 81.73% 65.58% 89.55% 65.61% 83.66%
[0136] In the accuracy comparison of impervious surfaces, the SETR model has the highest recognition accuracy, thanks to the powerful global feature extraction capability of transformer. PSPnet has the highest recognition accuracy for trees, and the deeplabv3+ model has the highest recognition accuracy for low vegetation areas, reaching 90.48%. SWINT-RESNet performs best in terms of buildings, cars, and overall accuracy. As can be seen from the previous comparison chart, SWINT-RESNet has a particularly complete classification of the overall outline and edge details of buildings, and is also very accurate in the classification of other small sample categories.
[0137] When compared with other models, the method proposed in this embodiment shows significant advantages in overall verification accuracy, which is mainly due to the effective fusion of the model in combining local features and global features. Specifically, considering the particularity of the dataset used in the experiment - the sample size is relatively small and the local details are extremely rich while the global features are relatively limited, this embodiment found that the traditional Transformer model does not perform as well as the CNN model on such datasets. This phenomenon highlights the limitations of the Transformer when dealing with local features with rich details.
[0138] However, it is worth noting that Transformer is still a key component of the model architecture proposed in this embodiment. Although the Transformer model has certain deficiencies in extracting details, this embodiment effectively overcomes this challenge by combining it with the ResNet module. The introduction of the ResNet module greatly enhances the model's ability to capture complex local features, thereby significantly improving the model's performance in detail processing. This combination not only makes up for the shortcomings of Transformer in local feature extraction, but also enhances the performance of the overall model in precise semantic classification tasks.
[0139] Furthermore, the feature extraction capability of the ResNet module is combined with the global information processing capability of the Transformer module, which brings dual advantages to the method of this embodiment. This unique fusion strategy not only retains the high efficiency of CNN in capturing delicate local features, but also utilizes the powerful ability of Transformer in understanding global context. Therefore, compared with the traditional CNN method, the method of this embodiment achieves a significant improvement in overall semantic classification accuracy.
[0140] In summary, by cleverly combining the unique advantages of ResNet and Transformer, the model developed in this embodiment not only overcomes their respective limitations, but also achieves superior performance in semantic classification tasks. This achievement not only provides a new perspective for solving complex image classification problems, but also lays a solid foundation for future research and application of deep learning in the field of image processing.
[0141] This embodiment proposes a SWINT-RESNet network for high-resolution remote sensing image change detection tasks. The proposed SWINT-RESNet combines CNN and Transformer models in series, which can comprehensively extract local and global features of remote sensing image data. After conducting semantic classification experiments on the Potsdam area in the ISPRS Vaihingen 2D semantic label dataset, it is found that:
[0142] (1) SWINT-RESNet performs very well for buildings, low vegetation areas, cars, and impervious surfaces. The classification accuracy of each category remains above 80%, which is the most balanced among the several baseline methods compared.
[0143] (2) The classification results of SWINT-RESNet between edges of different categories are very smooth and closest to the original labels, which can preserve the integrity of the recognition target to the greatest extent.
[0144] (3) Thanks to the ResNet module’s supplementation of local details, SWINT-RESNet also shows excellent classification results for small objects in remote sensing images, avoiding the problem of small sample category loss in the original transformer.
[0145] Example 2
[0146] This embodiment provides a remote sensing image classification method, the method comprising:
[0147] A1. Obtain the remote sensing image to be classified.
[0148] A2. Inputting the remote sensing image to be classified into a remote sensing image classification model to obtain a classification result; the remote sensing image classification model is trained using the remote sensing image classification network training method described in Example 1.
[0149] Example 3
[0150] This embodiment provides a computer device, which may be a database, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store pending transactions. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements the training method of the remote sensing image classification network described in Example 1 or implements the remote sensing image classification method described in Example 2.
[0151] Example 4
[0152] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the training method of the remote sensing image classification network described in Embodiment 1 or the steps of the remote sensing image classification method described in Embodiment 2 are implemented.
[0153] Example 5
[0154] This embodiment provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the training method of the remote sensing image classification network described in Example 1 or the steps of the remote sensing image classification method described in Example 2.
[0155] It should be noted that the object information (including but not limited to object device information, object personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the object or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0156] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided by the present invention may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processor involved in each embodiment provided by the present invention may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited thereto.
[0157] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0158] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A training method for a remote sensing image classification network, characterized in that: The method comprises: Acquire a remote sensing image; the remote sensing image has a category label; Using the SWINT module, extracting a plurality of first feature maps of different sizes of the remote sensing image; in the extraction process, dividing the feature map of the remote sensing image into a plurality of non-intersecting areas, and performing calculations in separate windows; Using the RESENT module, extracting a plurality of second feature maps of different sizes from the remote sensing image; the number of the second feature maps is the same as the number of the first feature maps; Using a fusion module, a plurality of first feature maps and a plurality of second feature maps are fused to obtain a fused feature map; Using an upsampling module, upsampling the fused feature map to obtain an output feature map; The SWINT module and the RESNET module are trained according to the output feature map and the category label to obtain a remote sensing image classification model; the remote sensing image classification model includes a SWINT module, a RESENT module, a fusion module and an upsampling module.
2. The remote sensing image classification network training method according to claim 1, characterized in that: The SWINT module includes: The splitting layer is used to split the input remote sensing image into non-overlapping image blocks of equal size; A linear embedding layer, used for projecting the image block to obtain a projection result; A Swin Transformer layer is used to calculate the self-attention of the projection results in non-overlapping windows to obtain attention features; The MLP layer is used to extract feature maps of different sizes according to the attention features.
3. The training method of a remote sensing image classification network according to claim 2, characterized in that: The SWINT module package also includes: The residual layer is used to connect the Swin Transformer layer and the MLP layer.
4. The remote sensing image classification network training method according to claim 1, characterized in that: The RESENT module includes: A convolutional pooling layer, used to extract features of the remote sensing image using convolution and maximum pooling operations to obtain convolutional pooling features; The feature extraction layer is used to extract the feature map of the convolutional pooling feature layer by layer to obtain feature maps of different sizes.
5. The remote sensing image classification network training method according to claim 1, characterized in that: The category labels include six categories: impervious surface, building, low vegetation, tree, car and background.
6. The remote sensing image classification network training method according to claim 5, characterized in that: Said backgrounds include: bodies of water, containers, tennis courts, and swimming pools.
7. A remote sensing image classification method, characterized in that: The method comprises: Obtain remote sensing images to be classified; The remote sensing image to be classified is input into a remote sensing image classification model to obtain a classification result; the remote sensing image classification model is trained using the remote sensing image classification network training method as described in any one of claims 1-6.
8. A computer device comprising: A memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the training method of the remote sensing image classification network described in any one of claims 1 to 6 or the steps of the remote sensing image classification method described in claim 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the steps of the remote sensing image classification network training method described in any one of claims 1 to 6 or the remote sensing image classification method described in claim 7.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the steps of the remote sensing image classification network training method described in any one of claims 1 to 6 or the remote sensing image classification method described in claim 7.
