Remote sensing image semantic segmentation method based on category interactive attention and perception fusion

By using category interactive attention and perceptual fusion technology in semantic segmentation of remote sensing images to reconstruct and optimize the features of each category, the problem of insufficient category sensitivity and balance in the existing technology is solved, and the semantic segmentation performance of remote sensing images is improved. It meets the needs of urban remote sensing image interpretation.

CN118736231APending Publication Date: 2024-10-01XINJIANG UNIVERSITY

Patent Information

Application Number
CN202410885325.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing remote sensing image semantic segmentation methods lack sensitivity and balance to categories when processing high-resolution remote sensing images, and are difficult to effectively utilize shallow detail features, resulting in poor model generalization capabilities and inability to meet the needs of urban remote sensing image interpretation. .

Method used

A remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion is used to reconstruct and optimize the features of each category through the category grouping attention module, interactive foreground-background relationship optimization module, detail-aware fusion module and multi-scale representation module. Represent, enhance the model’s learning and representation capabilities for different ground object categories.

Benefits of technology

The model achieves balanced learning of each category and clear feature representation, improves the learning ability of few-sample categories, enhances the semantic segmentation performance of high-resolution remote sensing images, and meets the needs of urban remote sensing image interpretation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118736231A_ABST
    Figure CN118736231A_ABST
Patent Text Reader

Abstract

The invention discloses a category-based interactive attention and perception fusion remote sensing image semantic segmentation method, and mainly relates to the field of remote sensing image semantic segmentation. Comprising the following steps: S1, collecting a high-resolution remote sensing image data set, and dividing the data set into a training set, a verification set and a test set; s2, preprocessing the remote sensing images, and cutting the remote sensing images into the same pixel size; s3, constructing a remote sensing image semantic segmentation model based on category interactive attention and perception fusion; s4, training the model by using the training set, verifying the training effect by using the verification set, and storing the best model; s5, testing and storing the best model weight in the remote sensing image in the test set, and obtaining a semantic segmentation prediction result of the test image; according to the method, while the remote sensing image is accurately segmented, the learning and expression capability of the model for each category is balanced, enough learning resources can be obtained with few sample categories, and the features are more clearly expressed according to the categories.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of remote sensing image semantic segmentation, and in particular to a remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion. Background Art

[0002] With the development of remote sensing imaging technology, semantic segmentation of high-quality remote sensing images has become one of the most basic and popular tasks in remote sensing image processing. It is crucial in urban planning, land planning, environmental protection, disaster assessment and prediction, traffic navigation, military security and other fields.

[0003] Due to the large spatial scale and complex background of high-resolution remote sensing images, the segmentation targets not only vary on a large scale, but also show the characteristics of large intra-class variance and small inter-class variance. Traditional semantic segmentation methods such as random forest (RF) and support vector machine (SVM) extract low-level features from images to segment them. The results lack semantic annotations and are not applicable to high-dimensional visual tasks such as urban remote sensing image interpretation. In addition, in the process of establishing the corresponding semantic segmentation model, the manually selected features essentially limit the overall segmentation performance. The accuracy is lower than that of the visual interpretation method. The established model has poor generalization ability and it is difficult to extract the key semantic features of objects of different land object categories from the image, which cannot meet the current needs of urban remote sensing image interpretation. After introducing convolutional neural networks, encoder-decoder networks, attention mechanisms, and Transformers in semantic segmentation, although the above problems have been solved to a certain extent, there are still the following shortcomings:

[0004] 1) The model lacks sensitivity and balance to categories;

[0005] 2) The model lacks full utilization of shallow detail features. Summary of the invention

[0006] The purpose of the present invention is to solve the problems existing in the prior art and to provide a remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion, which balances the model's learning and representation capabilities for each category while making the features more clearly represented by category, ensuring that even categories with few samples can obtain sufficient resources for learning.

[0007] In order to achieve the above object, the present invention is implemented through the following technical solutions:

[0008] A remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion includes the following steps:

[0009] S1. Collect high-resolution remote sensing image datasets and ensure that each remote sensing image has pixel-level annotations. Divide the high-resolution remote sensing image datasets into training sets, validation sets, and test sets.

[0010] S2, preprocessing the remote sensing images and cropping the remote sensing images into the same pixel size;

[0011] S3. Construct a remote sensing image semantic segmentation model based on category-based interactive attention and perceptual fusion. The model includes a high-resolution network encoder, a category-based interactive decoder and a loss function. The category-based interactive decoder includes a category grouping attention module, an interactive foreground-background relationship optimization module, a detail-perceptual fusion module and a multi-scale representation module deployed by category grouping on the channel. The loss function includes a main loss and a category-based auxiliary loss.

[0012] S4. Use the training set to train the model, adjust the model parameters through the back propagation algorithm, use the validation set to verify the training effect and save the best model;

[0013] S5. Take the best model weight saved in the remote sensing image test in the test set to obtain the semantic segmentation prediction result of the test image.

[0014] Preferably, in step S2, the remote sensing image is preprocessed, the remote sensing image is cropped to a size of 1024×1024 pixels, and then random horizontal flipping, random scaling and random cropping are used to obtain a training image of size 512×512.

[0015] Preferably, in step S3, the high-resolution network encoder uses a high-resolution network as a backbone network of the encoder.

[0016] Preferably, in step S3, the RGB high-resolution remote sensing image X∈R 3×H×W After inputting the remote sensing image semantic segmentation model based on category-based interactive attention and perceptual fusion, the specific steps are as follows:

[0017] First, a high-resolution network is used to extract multi-scale feature information C i ∈{32,64,128,256}, i∈{1,2,3,4};

[0018] Then use 3×3 convolution to unify the channel size to 32×N, where N is the number of categories;

[0019] Then the feature F i Divided into category features F with channel size of 32 ii , j∈{1,…,N};

[0020] F ij The features are input into the category grouping attention module, and the self-attention is used to reconstruct the features of each category and connect them with the residual. Then the features enter the multi-scale representation module according to each category to obtain the output of the category-based Transformer.

[0021] Then, through the fusion module and F i -1 features, and use 3×3 convolution to unify the feature channels of each category from 64 to 32 to obtain the input F′ of the category grouping attention module of the next layer. i-1 , the specific operation can be expressed as:

[0022] FA i =F i +CGA(F i )

[0023] FT i =Group MSR(FA i )

[0024] F′ i-1,i =Conv(Cat(F i-1,j , Upsample(FT i,j )))

[0025] Among them, F i is the feature of the i-th layer of the backbone network, FA i is the output of the category grouping attention module, FT i is the output feature of the category-based transformer, F′ i-1,j is the fusion F′ i-1 The j-th category feature of , Cat(·) represents the concatenation operation, Upsample(·) represents double upsampling, Conv(·) represents the convolution function with a kernel size of 3×3, and F′ i-1 Represents the fused features;

[0026] Then, FT2 is sent to the detail perception fusion module to be fused with the shallow feature F1 of the backbone network, and the representation of each category after fusion is optimized through the multi-scale representation module;

[0027] Finally, a 1×1 convolution is used to convert the number of channels to the number of categories and bilinear interpolation is used to upsample to the same size as the input image to obtain the final predicted segmentation mask.

[0028] Preferably, in step S3, an auxiliary loss is introduced to supervise the features of each category of the category-based transformer output respectively, so as to enhance the category interactive learning of the category grouping attention module on the channel.

[0029] Preferably, in step S3, the category grouping attention module includes several parallel self-attention modules. By specifying the information space of each category on the channel, it is ensured that the disadvantaged category also has sufficient information to represent its characteristics. Multiple self-attention heads are deployed for each category to ensure balanced learning of each category. The process of reconstructing the characteristics of each category is as follows:

[0030] First, the feature information X∈R of the high-resolution network encoder is C×H×W Along the channel dimension, the channel size of each part is divided into groups according to the number of categories. As input to category grouping attention Where C represents the channel dimension, H and W are the sizes of the feature maps, and N represents the number of categories of the segmented target;

[0031] Then, the features of each category are sent to their corresponding self-attention modules to calculate their respective attention information, and 1×1 convolution and window division operations are used to divide each group of features X i Generate the corresponding Q i , K i , Among them, w is the window size, h is the number of heads; then X is calculated by SA i The corresponding attention weight A i , the formula is as follows i∈{1,2,3,…,N}:

[0032]

[0033] Where d is K i The channel dimension of , and dividing by d can be considered as an approximate normalization, and b is the relative position offset.

[0034] Preferably, in step S3, the attention score information of each category is interactively compared through an interactive foreground-background relationship optimization module, the foreground-background pixels of each category are distinguished, and the attention affinity matrix is ​​optimized by improving the relationship between the foreground-background pixels. The interactive optimization process of the attention affinity matrix is ​​as follows:

[0035] First, use a pooling kernel size of w for A 2 ×h average pooling calculates the average attention score of each pixel in each category to obtain the perception of each pixel in each category;

[0036] According to the maximum value of the pixel in the category, the foreground information of the current pixel is determined, and this category is marked with 1. Other categories are used as background information and marked with -1, so the foreground-background information matrix C of each category is obtained;

[0037] Formulate foreground-background relationship criteria, which include foreground positively correlated with foreground and negatively correlated with background, and background negatively correlated with foreground and positively correlated with background;

[0038] According to the foreground-background relationship criterion, the foreground-background relationship mask C′ of each category is generated according to the foreground-background information C of each category, and the attention affinity matrix is ​​optimized through this relationship;

[0039] Multiply the attention weight normalized by the softmax function on the relationship mask C′ to obtain the optimized attention weight A′;

[0040] Finally, the optimized weight A′ is multiplied by the V matrix to obtain the final output of the category grouping attention module, which is specifically expressed as follows:

[0041] C = MAX(AvgPooling(A))

[0042] C′=C T ×C

[0043] A′=C′·Softmax(A)

[0044] X out =X′×V

[0045] Among them, A is the attention score matrix of each category, AvgPooling(·) represents the average pooling with a pooling kernel size of , and MAX(·) represents the judgment function with the maximum mark being 1 and the others being -1.

[0046] Preferably, in step S3, the detail perception fusion module aligns the field of view of the deep features by enhancing the perception of the shallow features, and fuses the shallow feature pixels with the deep features according to the perception of the categories, and uses 1×1 convolution to align the channel sizes of the shallow features F and the deep features Y to obtain the module's detail information input Where C is the channel size of the deep feature Y, N is the number of segmentation target categories, H and W are the feature map sizes;

[0047] First, the shallow feature X is enhanced by pixel perception. i The matrix multiplication operation with the n pixels a in the hole perception area is performed to calculate the correlation with the surrounding pixels, and then the result is Softmax normalized to obtain the context perception weight of the pixel; the pixel x′i after pixel perception enhancement is generated according to the perception weight. The above process can be expressed as, i∈{1, 2, 3, …, H×W}, j∈{1, 2, 3, …, n}:

[0048] α=softmax(x i ×a)

[0049]

[0050] Then x′i and each category pixel y on the channel i After matrix multiplication, Softmax normalization is performed to obtain the perception score β of x′i for each category. i , generate detail perception pixels x"i of each category according to the category perception coefficient, and compare them with y i Add to get the fused feature pixel z i , specifically expressed as follows:

[0051] β=softmax(y i ×x′ i )

[0052] x" i =β×x′ i

[0053] z i =y i +x″ i .

[0054] Preferably, in step S3, the multi-scale representation module uses multiple layers of 3×3 convolution to form multi-level fields of view of different sizes;

[0055] First, three branches are used, each of which deploys a 3×3 convolution module. Batch normalization and ReLU activation functions are added after each convolution, and the output of the three branches is used as the description of the features of the first-level 3×3 field of view;

[0056] Similar to the first level, two 3×3 convolutional modules are deployed in the second level field of view to extract different information, and the output of the first level is used as input, and the two branches are added to obtain the output of the 5×5 field of view;

[0057] The third-level 7×7 field of view uses a 3×3 convolutional module to continue learning the output of the previous level;

[0058] Finally, the splicing operation is used to integrate the descriptions of different fields of view, the channel size is adjusted through 1×1 convolution, the residual is added to the input after batch normalization function, and the multi-scale features described by fields of view of different sizes are obtained after activation using the ReLU function.

[0059] Preferably, in step S3, the dice loss L is used D and the cross entropy loss L CE The combination of is taken as the main loss, which is defined as follows:

[0060]

[0061]

[0062] L M =L D +L CE ;

[0063] Among them, L M represents the main loss, N and K represent the number of training samples and the number of categories, and p′ n and p n denote the one-hot encoding of the ground truth and the predicted output of the network, respectively. Represents the confidence of category K in sample N; at the same time, the cross entropy loss function L is used CE As auxiliary loss L A Supervision; total loss function L total The definition is as follows:

[0064] L A =L CE ;

[0065] L total =L M +αL A ;

[0066] Where α is the proportionality factor of auxiliary loss.

[0067] Compared with the prior art, the beneficial effects of the present invention are:

[0068] The present invention proposes a new semantic segmentation model for remote sensing images based on a codec structure, namely, a category-based interactive attention and perception fusion network. Different from the traditional decoding method, in order to enhance the adaptability of the network model to the imbalance of remote sensing image categories, the present invention proposes a category-based Transformer to reconstruct the features of the encoder in the form of categories. The present invention uses the category grouping attention module as the attention module of the Transformer, reconstructs the input features by category grouping using self-attention, and optimizes the self-attention weights of each category using the interactive foreground-background relationship optimization module embedded in the category grouping attention module to improve the representation of the foreground and background of each category. In addition, the present invention proposes a detail perception fusion module to achieve fine fusion of each category with deep features based on the perception of shallow features. Finally, the present invention designs a feedforward network in which a multi-scale representation module is deployed by category as a category grouping attention module and a detail perception fusion module, and refines the representation of each category feature in a grouped manner using different scales of vision. The main contributions are as follows:

[0069] 1) According to the characteristics of remote sensing images, the present invention provides a new CNN encoding Transformer decoding remote sensing semantic segmentation network, and re-examines the traditional feature processing mode. Different from the general overall processing of features, the present invention divides the feature space of the encoder features in a category-based form during the decoding stage, and reconstructs the features of each category, while balancing the model's learning and representation capabilities for each category, making the features more clearly represented by category.

[0070] 2) The present invention proposes a category grouping attention module and reconsiders the application of multi-head self-attention to process features and deploy self-attention according to a new strategy of category grouping, ensuring that even categories with few samples can obtain sufficient resources for learning. Each category reconstructs its own features through its own multi-head self-attention.

[0071] 3) The present invention provides an interactive foreground-background relationship optimization module and embeds a category grouping attention module, wherein the foreground and background of each category are distinguished by interacting the attention information of each category, and the feature representation of each category is optimized by clarifying the relationship between the foreground and the background.

[0072] 4) The present invention proposes a detail perception fusion module, which uses the perception of hollow expansion to expand the receptive field of shallow detail features and aligns them with the field of view of high-level features. It also fuses the perception of each category with the deep features based on the pixels of the shallow features, and uses the detail information of the shallow features to achieve pixel-level refinement of the deep feature semantics.

[0073] 5) The present invention provides a multi-scale representation module that describes features of different scales from a multi-branch, multi-level, and multi-scale perspective, further improving the model's ability to express complex features of remote sensing images. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] Figure 1 It is the overall architecture diagram of the present invention;

[0075] Figure 2 is a schematic diagram of an interactive foreground-background relationship optimization module;

[0076] Figure 3 is a schematic diagram of the detail-aware fusion module;

[0077] Figure 4 It is a schematic diagram of the multi-scale representation module. DETAILED DESCRIPTION

[0078] The present invention will be further described below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention. In addition, it should be understood that after reading the content taught by the present invention, those skilled in the art can make various changes or modifications to the present invention, and these equivalent forms fall within the scope limited by the application equally.

[0079] Remote sensing images usually contain a large amount of ground object information, the content is complex, and the segmentation targets include multiple categories. Therefore, compared with general segmentation tasks with a single target, the models and modules should be further designed according to the characteristics of the task in remote sensing semantic segmentation tasks. First, the segmentation targets of remote sensing semantic segmentation networks usually include multiple categories, and the pixel distribution of different categories is usually extremely uneven, which is one of the main challenges of remote sensing image semantic segmentation. Therefore, while using technology to improve the modeling ability of the model vertically, it is also necessary to enhance the network's adaptability to different categories horizontally. Secondly, both the low-level and high-level features of the network have rich feature information, especially the shallow features are rich in detailed information of each category, which is very critical for fine pixel-level segmentation, but the two have different receptive fields and feature representations, so reasonable processing and fusion of the two features is the key to obtaining good segmentation results.

[0080] Embodiment: The present invention is a remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion, and the specific steps are as follows:

[0081] Step 1: Collect high-resolution remote sensing image datasets and ensure that each image has pixel-level annotations. Divide the dataset into training sets, validation sets, and test sets for use in different stages;

[0082] Step 2: Preprocess the remote sensing image. First, crop the remote sensing image to 1024×1024 pixels, and then use random horizontal flipping, random scaling, and random cropping to obtain a training image of 512×512 size.

[0083] Step 3: Construct a remote sensing image semantic segmentation architecture based on category-based interactive attention and perceptual fusion, which includes a high-resolution network (HRNet) encoder, a category-based interactive decoder (consisting of a category grouping attention module, an interactive foreground-background relationship optimization module, a detail-aware fusion module, and a multi-scale representation module deployed by category grouping on channels) and a loss function (consisting of a main loss and a category-based auxiliary loss);

[0084] Step 4: Use the training set to train the model and adjust the model parameters through the back propagation algorithm. Use the validation set to verify the training effect and save the best model;

[0085] Step 5: Take the best model weight saved in the test set image test to obtain the semantic segmentation prediction result of the test image.

[0086] Next, the remote sensing image semantic segmentation architecture based on category-based interactive attention and perceptual fusion mentioned in step 3 above, as well as the category grouping attention module, interactive foreground-background relationship optimization module, detail-aware fusion module and multi-scale representation module deployed by category grouping on the channel in the network architecture will be introduced in detail.

[0087] Attached Figure 1 It is the overall architecture diagram of the present invention. Figure 1 In the above figure, IFBRO is the abbreviation of Interactive Front-Background Relationship Optimisation Block, SA is the abbreviation of Self-Attention, WP is the abbreviation of Window partition, CGA is the abbreviation of Category Grouping Attention, CBT is the abbreviation of Class-based Transformer, DAF is the abbreviation of Detail Aware Fusion, and Group MSR is the abbreviation of Multi-Scale Representation deployed by category on the channel.

[0088] The remote sensing image semantic segmentation architecture based on category-based interactive attention and perceptual fusion mentioned in step 3 is as follows: Figure 1 As shown in the figure, the network adopts an encoder-decoder structure. The high-resolution network encoder uses a high-resolution network (HRNet) as the backbone network of the encoder to extract the multi-scale information of the input high-resolution image while minimizing the information loss caused by the reduction of the spatial resolution of the high-resolution remote sensing image; then the decoder is used to sort the features of the CNN encoder in the form of categories.

[0089] Specifically, the present invention proposes a category grouping attention module embedded with an interactive foreground-background relationship optimization module, which can use self-attention to reconstruct the features of each category in the form of groups and optimize the foreground-background information representation through attention interactions of each category. In addition, the present invention creates a detail-aware fusion module that uses shallow detail features to refine deep semantic features. Finally, the present invention deploys a multi-scale representation module as a feedforward network for each category of the category grouping attention module and the detail-aware fusion module to enhance the description capability of information of different scales for each category. The feature processing flow in the network architecture is as follows:

[0090] First, the RGB high-resolution remote sensing image X∈R 3×H×W Input network, first use CNN backbone network HRNet to extract multi-scale feature information C i ∈{32,64,128,256}i∈{1,2,3,4}. In order to facilitate the alignment and fusion of feature maps of different scales, the present invention uses 3×3 convolution to unify the channel size to 32×N, where N is the number of categories. Then the feature F i Divided into category features F with channel size of 32 ij , j∈{1, .., N}. ij The input is sent to the category grouping attention module, and the self-attention is used to reconstruct the features of each category and connect them with the residual. Then the features enter the multi-scale representation module according to each category to obtain the output of the category-based Transformer. Then, the fusion module and F i-1 The corresponding categories in the features are concatenated, and a 3×3 convolution is used to unify the feature channels of each category from 64 to 32 to obtain the input F′ of the category grouping attention module of the next layer. i-1 The specific operation can be expressed as:

[0091] FA i =F i +CGA(F i )

[0092] FT i =Group MSR(FA i )

[0093] F′ i-1,j =Conv(Cat(F i-1,j , Upsample(FT i,j )))

[0094] Among them, F i , FA i are the features of the i-th layer of the backbone network and the output of the category grouping attention module, FT iis the output feature of the category-based transformer, F′ i-1,j is the fusion F′ i-1 The j-th category feature of , Cat(·) represents the concatenation operation, Upsample(·) represents double upsampling, and Conv(·) represents the convolution function with a kernel size of 3×3. i-1 Represents the fused features. FT2 is then sent to the detail perception fusion module to be fused with the shallow feature F1 of the backbone network, and the representation of each category after fusion is optimized through the multi-scale representation module. Finally, the present invention uses 1×1 convolution to convert the number of channels to the number of categories, and uses bilinear interpolation to upsample to the same size as the input image to obtain the final predicted segmentation mask. In addition, the present invention introduces auxiliary losses to supervise the features of each category of the category-based transformer output, enhance the category interactive learning of the category grouping attention module on the channel, and enable the model to achieve better results.

[0095] The detailed description of the category grouping attention module, the interactive foreground-background relationship optimization module, the detail-aware fusion module, and the multi-scale representation module deployed by category grouping on the channel in the decoder, as well as the auxiliary loss function supervised by category are as follows:

[0096] 1) Category Grouping Attention Module

[0097] Self-attention is an important means of obtaining contextual information. The application of self-attention in remote sensing semantic segmentation tasks greatly enhances the global modeling ability of the model. However, self-attention treats features as a whole, which leads to a lack of sensitivity to each category in the feature. Such learning is more likely to lead to an imbalance in model performance for remote sensing images with unbalanced samples. Recent studies have shown that there is also a close relationship between channels and categories. Therefore, the present invention proposes the following from the perspective of channels and categories: Figure 1 The category grouping attention module shown in . By specifying the information space of each category on the channel, it is ensured that the weak category also has enough information to represent its characteristics. Multi-head self-attention is deployed for each category to ensure balanced learning of each category. Next, the present invention will combine Figure 1 Describe in detail the process of reconstructing features for each category:

[0098] First, the present invention transforms the feature information X∈R of the CNN network C×H×W Along the channel dimension, the channel size of each part is divided into groups according to the number of categories. As input to category grouping attention Where C represents the channel dimension, H and W are the sizes of the feature maps, and N represents the number of categories of the segmented target.

[0099] Then, the features of each category are sent to the corresponding self-attention (SA) to calculate their respective attention information. In order to save computational overhead, the present invention uses multi-head self-attention with divided windows.

[0100] like Figure 1 As shown, first, a 1×1 convolution and window partitioning operation (WP) is used to divide each set of features X i Generate the corresponding The present invention sets the window size w to 8 and the number of heads h to 4. For the convenience of representation and description, the present invention omits the number of windows. Then, X is obtained by SA calculation. i The corresponding attention weight A i , the formula is as follows i∈{1,2,3,…,N}:

[0101]

[0102] Where d is K i The channel dimension of , and dividing by d can be considered as approximate normalization, and b is the relative position offset.

[0103] 2) Interactive foreground-background relationship optimization module

[0104] Dividing feature information by category and modeling them separately helps protect the learning of disadvantaged categories and balance the performance of the model for each category, but the isolation of information between categories may miss valuable cross-channel interactions, resulting in insufficient representation of each category. Therefore, unlike simply performing self-attention on each category separately, the present invention designs an interactive foreground-background relationship optimization module in the category grouping attention module, interactively compares the attention score information of each category, distinguishes the foreground-background pixels of each category, and optimizes the attention affinity matrix by improving the relationship between the foreground-background pixels, so as to achieve a clearer representation of the foreground-background features of each category. The interactive optimization process of the attention affinity matrix will be described in detail below:

[0105] like Figure 2 As shown, Figure 2 For ease of viewing and understanding, the present invention uses different colors to represent different categories, wherein dark colors represent foregrounds and light colors represent backgrounds, and a plus sign or a minus sign is used to indicate the correlation between the current foreground or background pixel and other pixels.

[0106] First, use a pooling kernel size of w for A 2×h average pooling calculates the average attention score of each pixel in each category to obtain the perception of each pixel in each category. The present invention determines the foreground information of which category the current pixel belongs to based on the maximum value of the pixel in the category, and marks this category with 1. Other categories are used as background information and marked with -1, thus obtaining the foreground-background information matrix C of each category. For the learning and representation of each category, it is always hoped that the relationship between the foreground and the background is sensitive and distinct, that is, the foreground is positively correlated with the foreground and negatively correlated with the background, and the background is negatively correlated with the foreground and positively correlated with the background. The present invention generates a foreground-background relationship mask C for each category based on the foreground-background information C of each category according to this foreground-background relationship criterion. ′ , through this relationship to optimize the attention affinity matrix. ′ The optimized attention weight A′ is obtained by multiplying the normalized attention weights using the softmax function. A′ clarifies the relationship between the foreground and the background, increases the distance between the foreground and the background, and enhances the attention's ability to express the foreground-background. Finally, the optimized weight A′ is multiplied by the V matrix to obtain the final output of the category grouping attention module. The specific expression is as follows:

[0107] C = MAX(AvgPooling(A))

[0108] C′=C T ×C

[0109] A′=C′·Softmax(A)

[0110] X out =X′×V

[0111] Among them, A is the attention score matrix of each category, AvgPooling(·) represents the average pooling with a pooling kernel size of , and MAX(·) represents the judgment function with the maximum mark being 1 and the others being -1.

[0112] 3) Detail perception fusion module

[0113] The rich spatial detail information such as color, texture and edge in the shallow features is an important basis for accurately judging the details of each category in the remote sensing image. Making good use of shallow features and realizing accurate fusion with deep semantics is a key step to ensure model performance. Different from the general fusion methods of addition, splicing, weighting and attention, the key point of the detail perception fusion proposed in the present invention is to enhance the perception of shallow features to align the field of view of deep features, and to fuse the categories of shallow feature pixels with the categories of deep features. This is explained in detail below.

[0114] ① Pixel perception enhancement: Although shallow features have rich detail information, their small receptive field easily leads to the loss of important contextual information. Figure 3 As shown in (b), inspired by the dilated convolution, the present invention adopts the dilated convolution kernel style, so that each pixel perceives other pixels in a dilated form. Without losing information through pooling, each pixel of the shallow feature is more aware of the surroundings, adding contextual information to the shallow feature.

[0115] ② Category-aware fusion: The semantic information of shallow features and deep features is inconsistent, and direct addition and fusion may destroy or submerge the deep semantics. Inspired by the channel attention mechanism, this paper generates an affinity matrix of the fusion of the shallow features based on their perception of each category in the channel dimension of the deep features, and assigns each pixel of the shallow features to each category of the deep features, thus achieving fine adjustment of the deep semantics.

[0116] like Figure 3 As shown in (a), the present invention first uses 1×1 convolution to align the channel sizes of each category in the shallow feature F and the deep feature Y to obtain the detailed information input of the module Where C is the channel size of the deep feature Y, N is the number of segmentation target categories, H and W are the feature map sizes. The present invention first performs pixel-aware enhancement on the shallow feature X. i The matrix multiplication operation is performed with the n pixels a in the hole perception area to calculate the correlation with the surrounding pixels, and then the result is Softmax normalized to obtain the contextual perception weight of the pixel. According to the perception weight, the present invention generates the pixel x′ after pixel perception enhancement i , the above process can be expressed as, i∈{1, 2, 3, …, H×W}, j∈{1, 2, 3, …, n}:

[0117] α=soffmax(x i ×a)

[0118]

[0119] Then the present invention combines x′i with each category pixel y on the channel i After matrix multiplication, Softmax normalization is performed to obtain the perception score β of x′i for each category. i , generate detail perception pixels x"i of each category according to the category perception coefficient, and compare them with y i Add to get the fused feature pixel z i , specifically expressed as follows:

[0120] β=soffmax(y i ×x′ i )

[0121] x" i =β×x′ i

[0122] z i =y i +x″ i .

[0123] 4) Multi-scale representation module

[0124] Objects in remote sensing images usually have large scale variations, and their textures and other features also have different scales. Therefore, when describing an object in a remote sensing image, it is usually necessary to describe it from different scale perspectives. In order to improve the decoder's ability to describe various categories, the present invention designs a multi-scale representation module, uses multiple layers of 3×3 convolution to form multi-level fields of view of different sizes, and groups them by category in the channel dimension and deploys them as a feedforward network of a category grouping attention module and a detail perception fusion module.

[0125] like Figure 4 As shown, this embodiment divides the field of view into three levels. In order to enable a smaller field of view to describe different features, the present invention uses three branches in the first-level field of view, and each branch deploys a 3×3 convolution module. Batch normalization and ReLU activation functions are attached after each convolution, and the outputs of the three branches are used as the description of the features of the first-level 3×3 field of view. Similar to the first level, the present invention deploys two 3×3 convolution modules in the second-level field of view to extract different information, and uses the output of the first level as input, and adds the two branches to obtain the output of the 5×5 field of view. The third-level 7×7 field of view uses a 3×3 convolution module to continue learning the output of the previous level. Finally, the present invention uses a splicing operation to integrate the descriptions of three different fields of view, adjusts the size of the channel through a 1×1 convolution, adds the residual to the input after the batch normalization function, and activates the ReLU function to obtain multi-scale features described by three different sizes of fields of view.

[0126] 5) Loss Function

[0127] like Figure 1 As shown in FIG. 1 , in order to achieve better decoding effect of this interactive decoding by category combing, the present invention not only performs supervised optimization on the final segmentation prediction map, but also adds an additional auxiliary head to aggregate the features of each category combed by the category-based Transformer reconstruction to obtain the segmentation prediction of the corresponding category, and supervises them according to the ground truth. Therefore, the present invention uses the main loss L M and auxiliary loss L A To train the overall network structure, use the dice loss L D and the cross entropy loss L CE The combination of is taken as the main loss, which is defined as follows:

[0128]

[0129] L M =L D +L CE

[0130] Among them, N and K represent the number of training samples and the number of categories, p ′n and p n denote the one-hot encoding of the ground truth and the predicted output of the network of the present invention, respectively, In addition, the output of the three-layer CBT module is summed, and N groups of 3×3 convolutions and 1×1 convolutions with batch normalization and ReLU activation functions are used as auxiliary heads to aggregate the segmentation predictions of the features of N categories with a channel size of 1, and the output is upsampled, and the cross entropy loss function L is used at the same time. CE As auxiliary loss L A To better combine the main loss and the auxiliary loss, the present invention sets a proportional factor α of the auxiliary loss. Therefore, the total loss function L of the present invention is total The definition is as follows:

[0131] L A =L CE

[0132] L total =L M +αL A .

Claims

1. A remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion, characterized in that: Includes steps: S1. Collect high-resolution remote sensing image datasets and ensure that each remote sensing image has pixel-level annotations. Divide the high-resolution remote sensing image datasets into training sets, validation sets, and test sets. S2, preprocessing the remote sensing images and cropping the remote sensing images into the same pixel size; S3. Construct a remote sensing image semantic segmentation model based on category-based interactive attention and perceptual fusion. The model includes a high-resolution network encoder, a category-based interactive decoder and a loss function. The category-based interactive decoder includes a category grouping attention module, an interactive foreground-background relationship optimization module, a detail-perceptual fusion module and a multi-scale representation module deployed by category grouping on the channel. The loss function includes a main loss and a category-based auxiliary loss. S4. Use the training set to train the model, adjust the model parameters through the back propagation algorithm, use the validation set to verify the training effect and save the best model; S5. Take the best model weight saved in the remote sensing image test in the test set to obtain the semantic segmentation prediction result of the test image.

2. The remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion according to claim 1, characterized in that: In step S2, the remote sensing image is preprocessed and cropped to a size of 1024×1024 pixels, and then a training image of 512×512 size is obtained by random horizontal flipping, random scaling, and random cropping.

3. The remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion according to claim 1, characterized in that: In step S3, the high-resolution network encoder uses the high-resolution network as the backbone network of the encoder.

4. The remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion according to claim 3, characterized in that: In step S3, the RGB high-resolution remote sensing image X∈R 3×H×W After inputting the remote sensing image semantic segmentation model based on category-based interactive attention and perceptual fusion, the specific steps are as follows: First, a high-resolution network is used to extract multi-scale feature information C i ∈{32,64,128,256}, i∈{1,2,3,4}; Then use 3×3 convolution to unify the channel size to 32×N, where N is the number of categories; Then the feature F i Divided into category features F with channel size of 32 ij ,j∈{1,…,N}; F ij The features are input into the category grouping attention module, and the self-attention is used to reconstruct the features of each category and connect them with the residual. Then the features enter the multi-scale representation module according to each category to obtain the output of the category-based Transformer. Then, through the fusion module and F i-1 The corresponding categories in the features are concatenated, and a 3×3 convolution is used to unify the feature channels of each category from 64 to 32 to obtain the input F of the category grouping attention module of the next layer. i ' -1 , the specific operation can be expressed as: <h2 style=";text-align:left;direction:ltr">FA<h2 style=";text-align:left;direction:ltr"> i <h2 style=";text-align:left;direction:ltr"> =F<h2 style=";text-align:left;direction:ltr"> i <h2 style=";text-align:left;direction:ltr"> +CGA(F<h2 style=";text-align:left;direction:ltr"> i <h2 style=";text-align:left;direction:ltr"> ) FT i =Groupp MSR(FA i ) F′ i-1,j =Conv(Cat(F i-1,j ,Upsample(FT i,j ))) Among them, F i is the feature of the i-th layer of the backbone network, FA i is the output of the category grouping attention module, FT i is the output feature of the category-based transformer, F′ i-1,j is the fusion F′ i-1 The j-th category feature of , Cat(·) represents the concatenation operation, Upsample(·) represents double upsampling, Conv(·) represents the convolution function with a kernel size of 3×3, and F i ' -1 Represents the fused features; Then, FT2 is sent to the detail perception fusion module to be fused with the shallow feature F1 of the backbone network, and the representation of each category after fusion is optimized through the multi-scale representation module; Finally, a 1×1 convolution is used to convert the number of channels to the number of categories and bilinear interpolation is used to upsample to the same size as the input image to obtain the final predicted segmentation mask.

5. The remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion according to claim 4, characterized in that: In step S3, auxiliary losses are introduced to supervise the features of each category of the category-based transformer output respectively, so as to enhance the category interactive learning of the category grouping attention module on the channel.

6. The remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion according to claim 5, characterized in that: In step S3, the category grouping attention module includes several parallel self-attention modules, which ensures that the weak category also has enough information to represent its characteristics by specifying the information space of each category on the channel. Multi-head self-attention is deployed for each category to ensure balanced learning of each category. The process of reconstructing features for each category is as follows: First, the feature information X∈R of the high-resolution network encoder is C×H×W Along the channel dimension, the channel size of each part is divided into groups according to the number of categories. As input to category grouping attention i∈{1,2,…,N}, where C represents the channel dimension, H and W are the sizes of the feature maps, and N represents the number of categories of the segmentation target; Then, the features of each category are sent to their corresponding self-attention modules to calculate their respective attention information, and 1×1 convolution and window division operations are used to divide each group of features X i Generate the corresponding Among them, w is the window size, h is the number of heads; then X is calculated by SA i The corresponding attention weight A i , the formula is as follows i∈{1,2,3,…,N}: Where d is K i The channel dimension of , and dividing by d can be considered as an approximate normalization, and b is the relative position offset.

7. The remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion according to claim 6, characterized in that: In step S3, the attention score information of each category is interactively compared through the interactive foreground-background relationship optimization module to distinguish the foreground-background pixels of each category, and the attention affinity matrix is ​​optimized by improving the relationship between the foreground-background pixels. The interactive optimization process of the attention affinity matrix is ​​as follows: First, use a pooling kernel size of w for A 2 ×h average pooling calculates the average attention score of each pixel in each category to obtain the perception of each pixel in each category; According to the maximum value of the pixel in the category, the foreground information of the current pixel is determined, and this category is marked with 1. Other categories are used as background information and marked with -1, so the foreground-background information matrix C of each category is obtained; Formulate foreground-background relationship criteria, which include foreground positively correlated with foreground and negatively correlated with background, and background negatively correlated with foreground and positively correlated with background; According to the foreground-background relationship criterion, the foreground-background relationship mask C′ of each category is generated according to the foreground-background information C of each category, and the attention affinity matrix is ​​optimized through this relationship; Multiply the attention weight normalized by the softmax function on the relationship mask C′ to obtain the optimized attention weight A′; Finally, the optimized weight A′ is multiplied by the V matrix to obtain the final output of the category grouping attention module, which is specifically expressed as follows: C = MAX(AvgPooling(A)) C'=C T ×C A'=C'·Softmax(A) X out =X'×V Among them, A is the attention score matrix of each category, AvgPooling(·) represents the average pooling with a pooling kernel size of , and MAX(·) represents the judgment function with the maximum mark being 1 and the others being -1.

8. The remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion according to claim 7, characterized in that: In step S3, the detail perception fusion module aligns the field of view of deep features by enhancing the perception of shallow features, and fuses the categories of shallow feature pixels with the categories of deep features. It uses 1×1 convolution to align the channel sizes of shallow features F and deep features Y to obtain the module's detail information input Where C is the channel size of the deep feature Y, N is the number of segmentation target categories, H and W are the feature map sizes; First, the shallow feature X is enhanced by pixel perception. i The matrix multiplication operation with the n pixels a in the hole perception area is performed to calculate the correlation with the surrounding pixels, and then the result is Softmax normalized to obtain the context perception weight of the pixel; the pixel x′i after pixel perception enhancement is generated according to the perception weight. The above process can be expressed as, i∈{1,2,3,…,H×W},j∈{1,2,3,…,n}: α=softmax((x i ×a) Then x′ i And each category pixel y on the channel i After matrix multiplication, Softmax normalization is performed to obtain x′ i Perception score for each category β i , generate detail perception pixels x″ of each category according to the category perception coefficient i , and with y i Add to get the fused feature pixel z i , specifically expressed as follows: β=softmax((and i ×x′ i ) x″ i =β×x′ i z i =y i +x′ i 。 9. The remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion according to claim 8, characterized in that: In step S3, the multi-scale representation module uses multiple layers of 3×3 convolution to form multi-level fields of view of different sizes; First, three branches are used, each of which deploys a 3×3 convolution module. Batch normalization and ReLU activation functions are added after each convolution, and the output of the three branches is used as the description of the features of the first-level 3×3 field of view; Similar to the first level, two 3×3 convolutional modules are deployed in the second level field of view to extract different information, and the output of the first level is used as input, and the two branches are added to obtain the output of the 5×5 field of view; The third-level 7×7 field of view uses a 3×3 convolutional module to continue learning the output of the previous level; Finally, the splicing operation is used to integrate the descriptions of different fields of view, the channel size is adjusted through 1×1 convolution, the residual is added to the input after batch normalization function, and the multi-scale features described by fields of view of different sizes are obtained after activation using the ReLU function.

10. The remote sensing image semantic segmentation method based on category-based interactive attention and perceptual fusion according to claim 9, characterized in that: In step S3, the dice loss L is used D and the cross entropy loss L CE The combination of is taken as the main loss, which is defined as follows: L M =L D +L CE ; Among them, L M represents the main loss, N and K represent the number of training samples and the number of categories, and p′ n and p n denote the one-hot encoding of the ground truth and the predicted output of the network, respectively. Represents the confidence of category K in sample N; at the same time, the cross entropy loss function L is used CE As auxiliary loss L A Supervision; total loss function L total The definition is as follows: L A =L CE ; L total =L M +αL A ; Where α is the proportionality factor of auxiliary loss.

Citation Information

Patent Citations

  • Hybrid enhancement method and system for remote sensing image class imbalance

    CN117036202A

  • Remote sensing image real-time semantic segmentation method based on double-path structure

    CN117058166A

  • Remote sensing image road segmentation method based on improved DeeplabV3 +

    CN117351372A

  • Deep learning-based multi-scale aggregation Transform remote sensing image semantic segmentation method

    CN117576402A

  • Image segmentation method and system based on cascade attention and multi-scale feature fusion

    CN118096785A

Cited By

  • Diffusion model-based text graph and diffusion model training method, device and equipment

    CN119169434A

  • Virtual film man-object image matting method based on multi-scale receptive field feature enhancement fusion

    CN119515899A

  • Character matting method for virtual production based on multi-scale receptive field feature enhancement fusion

    CN119515899B

  • Remote sensing image target segmentation method based on multistage feature aggregation and segmentation

    CN119919658A

  • Image restoration and super-resolution reconstruction system and method based on deep learning

    CN120976017A