Multi-label classification method for high-resolution remote sensing images based on semantic multi-head attention mechanism
By introducing semantic sensitivity modules and semantic relationship building modules into the multi-head attention mechanism, combined with DCNN features, the problem of the lack of local receptive fields in the multi-head attention mechanism is solved, and high-precision multi-label classification of remote sensing images is achieved.
Patent Information
- Application Number
- CN202111090408.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-17
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-09-17
AI Technical Summary
The existing multi-head attention mechanism lacks local receptive fields in multi-label classification of remote sensing images and cannot effectively construct local relationships between labels in the image, resulting in limited classification accuracy.
A semantic relationship learning method with a multi-head attention mechanism with local receptive fields is designed. By adding a semantic sensitivity module and a semantic relationship building module to the back-end of the DCNN model, the multi-head attention mechanism is used to independently reason about the relationship between labels, and combined with DCNN extraction feature information to realize the positioning of image semantic areas and the automatic construction of label relationships.
It improves the accuracy of multi-label image classification, can automatically extract semantic areas related to images and labels, learns the relationship between labels, and improves classification accuracy.
Smart Images

Figure CN114091509B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of remote sensing image processing and is a semantic relationship learning method with a multi-head attention mechanism having a local receptive field, which can be applied to image multi-label classification. Background Art
[0002] Due to the complexity of remote sensing scenes, multi-label image classification of high-resolution remote sensing images is more general and practical than single-label image classification. High-resolution remote sensing scenes include various categories, and there are correlations and differences between them. For example, for the correlation between categories, such as: "road" and "car" often appear at the same time in remote sensing images, "grass" and "water" accompany "golf course", and "airport" usually contains "airplane". There are not only semantic associations between categories, but also spatial location associations. Even if they have the same feature type, their spatial relationships are different, and they may belong to different categories. For example: the road is on the lake or the bridge, and its category attribute is "bridge". How to construct the relationship between categories is a crucial issue in multi-label image classification. Good relationship expression plays a very critical role in the accuracy of the final algorithm, and the main calculation and testing work of the system is consumed in this part. But in practice, it is generally done manually. However, artificially stipulating the association between categories is a very laborious and subjective method with certain limitations, and its adjustment requires a lot of time.
[0003] The multi-head attention mechanism can automatically infer the relationship between categories without human participation in the process of relationship reasoning. It is a branch of machine learning and the hottest and most cutting-edge research content in the field of AL today. It considers using the self-attention mechanism to learn the association between each small sequence and other sequences in a sequence, and replaces the relationship between manually designed labels through supervised learning. Reasoning the relationship between labels requires not only considering the global relationship between labels, but also the local relationship between labels. Image feature extraction based on DCNN is an important step in image multi-label classification. However, due to the convolution operation of DCNN, the receptive field of DCNN is affected by the convolution kernel. The features extracted by DCNN mainly focus on short-distance relationships and cannot focus on long-distance relationships. The semantic learning method based on the multi-head attention mechanism can construct global relationships but cannot construct local receptive fields. Effectively utilizing the local receptive field information of DCNN so that multi-head attention has a local receptive field can improve the accuracy of label relationship reasoning. The present invention improves the existing multi-head attention method in view of the deficiencies in the above-mentioned prior art. Summary of the invention
[0004] The present invention designs a semantic relationship learning method with a multi-head attention mechanism with a local receptive field, which is used to improve the lack of local receptive field of the multi-head attention mechanism. The method can locate the semantic area of the image and autonomously infer the relationship between labels. The method uses a DCNN model to extract image features, adds a semantic sensitive module to the back end of the DCNN network architecture to obtain the semantic area related to the label in the image, and uses a semantic relationship construction module to infer the relationship between the labels using a multi-head attention mechanism. Finally, the final classification result is obtained through a classifier.
[0005] The specific steps of the present invention are as follows:
[0006] Step 1), input the sample into the constructed model for training to obtain the trained weights. The constructed model includes a feature extraction module, a semantic sensitivity module, and a semantic relationship construction module;
[0007] Step 2), inputting the remote sensing image of the test area into the model constructed in step 1) as an input source;
[0008] Step 3), using a feature extraction module to perform feature encoding on the image to obtain a feature map F, wherein the feature extraction module is a DCNN model;
[0009] Step 4), input F into the semantic-sensitive module to obtain the content-aware category expression S; the semantic-sensitive module includes two branches, one of which is a 1*1 convolution layer, which performs a scale transformation on the feature map F to obtain F'; the other branch is a 1*1 convolution layer and a Sigmoid activation function to obtain the category activation map A; finally, A is multiplied by F' to obtain the content-aware category expression S;
[0010] Step 5), input S into the semantic relationship construction module to obtain the feature expression T; the semantic relationship construction module includes a semantic relationship reasoning submodule of a multi-head attention mechanism, a 1*1 convolutional layer and a Sigmoid activation layer; each semantic relationship reasoning submodule of the multi-head attention mechanism includes a normalization layer, a multi-head attention layer MSA, a normalization layer and a feedforward network FFN;
[0011] Step 6), input T into the binary classifier to obtain the final classification result.
[0012] Furthermore, the multi-head attention layer MSA defines h attention heads, that is, h self-attention modules are applied to S, S can be divided into h X sequences, each X sequence has a size of N×d, where D=hd, N is the number of categories, and D is the dimension of each category feature expression; the results of the h attention heads are connected together, and finally the linear transformation W is used. OThe output H is obtained, and the size of H is N×D, as shown in formula (1); for the i-th h sequence, the attention module will learn three weight matrices, which are From formula (2), we can get the three vectors Q, K, and V. For a given Q vector, The inner product is used to match k key vectors with a dimension of d, that is, The output of self-attention can be calculated by formula (3);
[0013] MSA(S)=Concat(head1,…head h )W o
[0014] head i =Attention(Q i ,K i ,V i ) (1)
[0015] Among them, head i is the i-th self-attention module;
[0016]
[0017]
[0018] Among them, Softmax(·) is the Softmax function, the superscript T represents the transposition, and d k is the dimension of the k key vectors.
[0019] Furthermore, the feed-forward network FFN includes two fully connected layers and one GeLU activation layer.
[0020] Further, the specific processing process of step 5) is as follows;
[0021] Input S into the semantic relationship reasoning submodule of the multi-head attention mechanism to obtain the feature expression H. Perform a 1*1 convolution operation on H, and then activate it using the Sigmoid activation function to obtain the relationship matrix R. Multiply R and H and activate them using the LeakyReLU activation function to obtain the feature expression T. T is calculated using formula (4):
[0022] T=f(S(Conv(H,w)H) (4)
[0023] Where Conv(H, w) represents the convolution of H and w, w is the filter, S(·) represents the Sigmoid activation function, and f(·) represents the LeakyReLU activation function.
[0024] Furthermore, the expression of the binary classifier in step 6) is as follows;
[0025]
[0026] Among them, T i Represents the feature expression of the i-th category.
[0027] Furthermore, the DCNN model includes VGG16, ResNet50, and DenseNet201.
[0028] Compared with conventional remote sensing image multi-label classification methods, the present invention has the following characteristics: it can automatically extract semantic areas related to images and labels, and can automatically learn the relationship between labels. The method of the present invention has higher accuracy in multi-label classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is the overall framework diagram of the present invention.
[0030] Figure 2 Activation maps of specific categories in the semantically sensitive module in an embodiment of the present invention. (a)-(g) are different pictures, and the corresponding categories and scores are respectively displayed in the upper left corner of the corresponding activation maps. For the categories appearing in the image, it can be observed that our method can accurately locate their semantic areas. DETAILED DESCRIPTION
[0031] The specific implementation of the method of the present invention is further described below in conjunction with the accompanying drawings.
[0032] like Figure 1 As shown, a semantic relationship learning method with a multi-head attention mechanism with a local receptive field includes the following steps:
[0033] 1) Inputting the sample into the constructed model for training to obtain trained weights, wherein the model includes a feature extraction module, a semantic sensitivity module, and a semantic relationship construction module;
[0034] 2) The remote sensing images of the test area are fed into the trained model as input sources;
[0035] 3) Using feature extraction to encode the image features to obtain a feature map F; the feature extractor is a DCNN model (such as: VGG16, ResNet50, DenseNet201);
[0036] 4) Input F into the semantic-sensitive module to obtain the content-aware category expression S; the semantic-sensitive module includes two branches, one of which is a 1*1 convolution layer, which performs a scale transformation on the feature map F to obtain F'; the other branch is a 1*1 convolution layer and a Sigmoid activation function to obtain the category activation map A; finally, A is multiplied by F' to obtain the content-aware category expression S;
[0037] 5) Input S into the semantic relationship construction module to obtain the feature expression T; the semantic relationship construction module includes 6 semantic relationship reasoning submodules of multi-head attention mechanism, a 1*1 convolution layer and a Sigmoid activation layer; each semantic relationship reasoning submodule of the multi-head attention mechanism includes a normalization layer, a multi-head attention layer MSA, a normalization layer and a feedforward network FFN, and FFN includes two fully connected layers and a GeLU activation layer; MSA and FFN both contain the same skip connection as ResNet;
[0038] Specifically, MSA defines h attention heads, that is, h self-attention modules are applied to S. S can be divided into h X sequences, and the size of each X sequence is N×d, where D=hd, N is the number of categories, and D is the dimension of each category feature expression. The results of h attention heads are connected together and finally transformed by linear transformation (W O ) to get the output H, the size of H is N×D, as shown in formula (1). For the i-th h sequence, the attention module will learn three weight matrices, which are From formula (2), we can get the three vectors Q, K, and V. For a given Q vector, The inner product is used to match k key vectors with a dimension of d, that is, The output of self-attention can be calculated by formula (3).
[0039] MSA(S)=Concat(head1,…head h )W O
[0040] head i =Attention(Q i ,K i ,V i ) (1)
[0041] Among them, head i is the i-th self-attention module.
[0042]
[0043]
[0044] Among them, Softmax(·) is the Softmax function, the superscript T represents the transposition, and d k is the dimension of the k key vectors.
[0045] 6) Input T into the binary classifier to obtain the final classification result.
[0046] Furthermore, the specific implementation of step 5) is as follows:
[0047] Input S into the semantic relationship reasoning submodule of the multi-head attention mechanism to obtain the feature expression H. Perform a 1*1 convolution operation on H, and then activate it using the Sigmoid activation function to obtain the relationship matrix R. Multiply R and H and activate them using the LeakyReLU activation function to obtain the feature expression T. T is calculated using formula (4):
[0048] T=f(S(Conv(H,w)H) (4)
[0049] Where Conv(H,w) represents the convolution of H and w, w is the filter, S(·) represents the Sigmoid activation function, and f(·) represents the LeakyReLU activation function.
[0050] Furthermore, the specific implementation method of using the binary classifier to obtain the final classification result in step 6) is as follows:
[0051]
[0052] Among them, T i Represents the characteristic expression of the i-th category.
[0053] In order to verify the performance of the method of the present invention, the MLRSNet dataset was used for verification experiments. The size of all images in this dataset is 224×224 and the resolution is 0.1-10m. The dataset consists of 10,916 training images and 98,245 test images. In order to compare with other existing methods in a fair manner, we use overall / per-class precision (OP / CP), overall / per-class recall (OR / CR), overall / per-class F1-score (OF1 / CF1) and mean average precision (mAP) as evaluation indicators. DCNN+SSM means using DCNN as a feature extractor, taking the feature map F as the input of the semantic-sensitive module, generating content-aware category expressions, and directly sending the content-aware category expressions to the classifier for classification to obtain the final result. DCNN+SRBM means using DCNN as a feature extractor, removing the semantic-sensitive module, and taking the feature map F directly as the input of the semantic relationship construction module. The performance of the dataset on different models is shown in Table 1. It can be seen from the table that after adding our method, the accuracy of each model has been improved. From Figure 2It can also be intuitively seen that the method of the present invention can locate the semantic area related to the tag.
[0054] Table 1 Performance of the dataset on different models
[0055]
[0056]
[0057] The specific embodiments described herein are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the appended claims.
Claims
1. A high-resolution remote sensing image multi-label classification method based on semantic multi-head attention mechanism, characterized by: The steps include: Step 1), input the sample into the constructed model for training to obtain the trained weights. The constructed model includes a feature extraction module, a semantic sensitivity module, and a semantic relationship construction module; Step 2), inputting the remote sensing image of the test area as an input source into the model constructed in step 1); Step 3), using a feature extraction module to perform feature encoding on the image to obtain a feature map F, wherein the feature extraction module is a DCNN model; Step 4), input F into the semantic-sensitive module to obtain the content-aware category expression S; the semantic-sensitive module includes two branches, one of which is a 1*1 convolution layer, which performs a scale transformation on the feature map F to obtain F'; the other branch is a 1*1 convolution layer and a Sigmoid activation function to obtain the category activation map A; finally, A is multiplied by F' to obtain the content-aware category expression S; Step 5), input S into the semantic relationship construction module to obtain the feature expression T; the semantic relationship construction module includes a semantic relationship reasoning submodule of a multi-head attention mechanism, a 1*1 convolutional layer and a Sigmoid activation layer; each semantic relationship reasoning submodule of the multi-head attention mechanism includes a normalization layer, a multi-head attention layer MSA, a normalization layer and a feedforward network FFN; Step 6), input T into the binary classifier to obtain the final classification result.
2. The high-resolution remote sensing image multi-label classification method with semantic multi-head attention mechanism as claimed in claim 1, characterized in that: The multi-head attention layer MSA defines h attention heads, that is, h self-attention modules are applied to S, S can be divided into h X sequences, each X sequence has a size of N×d, where D=hd, N is the number of categories, and D is the dimension of each category feature expression; the results of the h attention heads are connected together, and finally the linear transformation W is used. O The output H is obtained, and the size of H is N×D, as shown in formula (1); for the i-th h sequence, the attention module will learn three weight matrices, which are From formula (2), we can get the three vectors Q, K, and V. For a given Q vector, The inner product is used to match k key vectors with a dimension of d, that is, The output of self-attention can be calculated by formula (3); MSA(S)=Concat(head1,…head h )W O head i =Attention(Q i ,K i ,V i ) (1) Among them, head i is the i-th self-attention module; Among them, Softmax(·) is the Softmax function, the superscript T represents the transposition, and d k is the dimension of the k key vectors.
3. The high-resolution remote sensing image multi-label classification method with semantic multi-head attention mechanism as claimed in claim 1, characterized in that: The feed-forward network FFN includes two fully connected layers and one GeLU activation layer.
4. The high-resolution remote sensing image multi-label classification method with semantic multi-head attention mechanism as claimed in claim 1, characterized in that: The specific processing process of step 5) is as follows; Input S into the semantic relationship reasoning submodule of the multi-head attention mechanism to obtain the feature expression H. Perform a 1*1 convolution operation on H, and then activate it using the Sigmoid activation function to obtain the relationship matrix R. Multiply R and H and activate them using the LeakyReLU activation function to obtain the feature expression T. T is calculated using formula (4): T=f(S(Conv(H,w)H) (4) Where Conv(H, w) represents the convolution of H and w, w is the filter, S(·) represents the Sigmoid activation function, and f(·) represents the LeakyReLU activation function.
5. The high-resolution remote sensing image multi-label classification method with semantic multi-head attention mechanism as claimed in claim 4, characterized in that: The expression of the binary classifier in step 6) is as follows; Among them, T i Represents the feature expression of the i-th category.
6. The high-resolution remote sensing image multi-label classification method with semantic multi-head attention mechanism as claimed in claim 1, characterized in that: The DCNN models include VGG16, ResNet50, and DenseNet201.
Citation Information
Patent Citations
Remote sensing image semantic segmentation method based on attention multi-scale feature fusion
CN111127493A
Small sample picture classification model and method based on semantic auxiliary attention mechanism
CN111985538A
Semantic convolution hyperspectral image classification method based on multi-path attention mechanism
CN112052755A
Method and apparatus for carrying out classification prediction by using text classification model
WO2021143396A1
