A fine-grained classification method and system based on essential causal reasoning
By adopting a method based on essential causal reasoning in remote sensing image classification, combining backbone network and causal multi-head attention module, fusing features and using feature decoupling network, the problem of insufficient utilization of feature correlation in fine-grained classification is solved and the classification efficiency is improved. and accuracy, adapted to the complexity of optical remote sensing images.
Patent Information
- Application Number
- CN202311499603.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-10
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2043-11-10
AI Technical Summary
The existing technology is difficult to effectively utilize the correlation between features in the fine-grained classification of remote sensing images, resulting in low classifier recognition efficiency, and the attention mechanism is not stable enough in complex backgrounds, lacks high-discrimination feature guidance, and is difficult to deal with hyperspectral Image complexity.
Adopt a method based on essential causal reasoning, extract features through the backbone network and causal multi-head attention module, combine the attention pooling module to fuse shallow and deep features, use the feature decoupling network for classification, and improve the model's performance through guided data enhancement Adaptability and generalization performance.
It improves the accuracy and efficiency of fine-grained classification of remote sensing images, reduces computational complexity through effective fusion of features, enhances the credibility and adaptability of the model, and can better handle the complexity of optical remote sensing images.
Smart Images

Figure CN117611883B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition technology, and in particular to a fine-grained classification method and system based on essential causal reasoning. Background Art
[0002] Object fine-grained classification is an important task in remote sensing image interpretation. In the field of remote sensing classification, there are many important tasks such as hyperspectral image classification, image scene classification, and challenging object fine-grained classification. Different from large-category object classification, object fine-grained classification aims to distinguish subordinate object categories, such as different kinds of ships. The characteristics of this task are high inter-class similarity and high sample diversity.
[0003] Due to the advancement of deep convolutional networks, several methods have performed well in the field of natural image classification. However, due to the rich and complex image content of optical remote sensing images, there are many challenges in transferring these methods to fine-grained remote sensing image target classification tasks. Since optical satellite imaging is subject to complex factors such as cloud occlusion, light and shadow changes caused by day and night, and shape changes caused by perspective, it will cause intra-class diversity and inter-class similarity, complicating the classification task, so the stability and accuracy of feature extraction are required to be high.
[0004] The existing remote sensing image target classification tasks usually adopt the method of extracting the features of the image itself or extracting attention features through the attention mechanism. However, the attention features often ignore the shallow features, and the features of the image itself are too shallow. Both cannot meet the fine-grained classification tasks of remote sensing images. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a fine-grained classification method based on essential causal reasoning to eliminate or improve one or more defects existing in the prior art.
[0006] One aspect of the present invention provides a fine-grained classification method based on essential causal reasoning, the method comprising the following steps:
[0007] Inputting the remote sensing image into a preset backbone network, and outputting the intrinsic feature tensor through the backbone network;
[0008] Inputting the intrinsic feature tensor into a causal multi-head attention module, and outputting an attention feature map through the causal multi-head attention module;
[0009] Inputting the intrinsic feature tensor and the attention feature map into an attention pooling module, the attention pooling module flattens the intrinsic feature tensor and the attention feature map, and obtaining an essential feature vector based on the flattened intrinsic feature tensor and the attention feature map;
[0010] The essential feature vector is input into a preset feature decoupling network, the feature decoupling network is provided with a classifier, and a classification result is obtained through the output of the classifier.
[0011] Using the above scheme, the existing fine-grained classification tasks of remote sensing images usually simply use attention features or intrinsic features, or simply superimpose attention features and intrinsic features to enable the classifier to identify targets of various categories. However, the existing schemes ignore the correlation between features. In addition, the rough stacking contains many repeated calculations, which makes the aggregation method inefficient. This scheme adopts an attention pooling module, which cleverly combines attention features and intrinsic features through bilinear aggregation operators and pooling layers, integrates shallow and deep features, improves classification accuracy, and has high efficiency.
[0012] In some embodiments of the present invention, a plurality of ConvNeXt network modules are provided in the backbone network. In the step of outputting the intrinsic feature tensor through the backbone network, the plurality of ConvNeXt network modules are used as feature extractors to perform multiple stages of feature extraction on the remote sensing image to obtain the intrinsic feature tensor.
[0013] Using the above scheme, the difficulty of classifying fine-grained targets in remote sensing images lies in finding the feature differences between two targets of different categories, and these differences are often reflected in the details. This scheme starts with multi-level features and applies multi-scale features in the network to identify targets of different scales. The backbone network of this scheme is composed of a top-down semantic information transmission structure, so that each layer of the pyramid features integrates high-level semantic information.
[0014] In some embodiments of the present invention, the step of inputting the intrinsic feature tensor into a causal multi-head attention module, and outputting an attention feature map through the causal multi-head attention module includes:
[0015] Performing element-wise multiplication of the attention feature map and the remote sensing image, and performing a GAP operation on the generated image to obtain a first attention map, superimposing images of each channel of the first attention map to obtain a regional feature map, inputting the regional feature map into a classifier, and outputting a first feature vector through the classifier;
[0016] Randomly generate a random feature map, perform element-wise multiplication on the random feature map and the remote sensing image, perform a GAP operation on the generated image to obtain a second attention map, superimpose the images of each channel of the second attention map to obtain a local feature map, input the local feature map into a classifier, and output a second feature vector through the classifier;
[0017] A difference vector is calculated based on the first eigenvector and the second eigenvector, a loss function is calculated based on the difference vector and a preset classification label, and the causal multi-head attention module is trained.
[0018] In some embodiments of the present invention, in the step of performing element-wise multiplication of the attention feature map and the remote sensing image, performing a GAP operation on the generated image to obtain a first attention map, superimposing images of each channel of the first attention map to obtain a regional feature map, inputting the regional feature map into a classifier, and outputting a first feature vector through the classifier, the first feature vector is calculated according to the following formula;
[0019]
[0020] In the step of randomly generating a random feature map, performing element-wise multiplication of the random feature map and the remote sensing image, performing a GAP operation on the generated image to obtain a second attention map, superimposing images of each channel of the second attention map to obtain a local feature map, inputting the local feature map into a classifier, and outputting a second feature vector through the classifier, the second feature vector is calculated according to the following formula:
[0021]
[0022] Among them, F l-1 represents remote sensing image, A m represents the attention feature map, represents a random feature map, ⊙ represents element-wise multiplication, represents the GAP operation, M represents the number of channels of the first attention map or the second attention map, m represents the mth channel of the first attention map, Γ represents the classifier processing, and Y A represents the first eigenvector, represents the second eigenvector.
[0023] In some embodiments of the present invention, the steps of the method also include model pre-training. In the model pre-training step, based on a preset training data set, the remote sensing images in the training data set are input into the backbone network, and the classification results are output by the classifier of the feature decoupling network. The loss function is calculated based on the classification results and the preset classification labels, and the backbone network, causal multi-head attention module, attention pooling module and feature decoupling network are trained based on the loss function value.
[0024] In some embodiments of the present invention, the step of inputting the remote sensing images in the training data set into the backbone network and outputting the classification results through the classifier of the feature decoupling network further includes:
[0025] Obtain an attention feature map output by the causal multi-head attention module based on the remote sensing image; obtain a probability vector based on the attention feature map;
[0026] Based on the probability vector, a detail feature channel map and a mask feature channel map are obtained by screening each channel map of the attention feature map;
[0027] Based on the detail feature channel map, the remote sensing image is cropped and scaled to obtain a detail map;
[0028] Performing mask processing on the remote sensing image based on the mask feature channel map to obtain a mask map;
[0029] The classification labels of the remote sensing images corresponding to the detail map and the mask map are used as the classification labels of the detail map and the mask map, the detail map and the mask map are respectively input into the backbone network, and the classification results are output through the classifier of the feature decoupling network, and the loss functions are calculated respectively to train the backbone network, the causal multi-head attention module, the attention pooling module and the feature decoupling network.
[0030] In some embodiments of the present invention, the dimension value of the probability vector and the channel of the attention feature map Figure 1 One to one, in the step of screening the detail feature channel map and the mask feature channel map from each channel map of the attention feature map based on the probability vector, the channel map corresponding to the largest dimension value in the dimensional value of the probability vector is obtained as the detail channel map, and the channel map corresponding to the smallest dimension value in the dimensional value of the probability vector is obtained as the mask channel map.
[0031] In some embodiments of the present invention, the step of cropping and scaling the remote sensing image based on the detail feature channel map to obtain the detail map includes:
[0032] Performing binarization processing on the detail feature channel map based on a preset first pixel threshold;
[0033] The position of 1 in the detail feature channel map after binarization is cropped from the remote sensing image to obtain the detail map.
[0034] In some embodiments of the present invention, the step of performing mask processing on the remote sensing image based on the mask feature channel map to obtain the mask map includes:
[0035] Performing binarization processing on the mask feature channel map based on a preset second pixel threshold;
[0036] The mask map is obtained by cutting out the position of 0 in the mask feature channel map after binarization processing from the remote sensing image.
[0037] The second aspect of the present invention also provides a fine-grained classification system based on essential causal reasoning, the system comprising a computer device, the computer device comprising a processor and a memory, the memory storing computer instructions, the processor being used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the system implements the steps implemented by the method described above.
[0038] The third aspect of the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps implemented by the aforementioned fine-grained classification method based on essential causal reasoning.
[0039] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention can be specifically pointed out and obtained in the specification and the accompanying drawings.
[0040] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention.
[0042] Figure 1 A schematic diagram of an implementation of a fine-grained classification method based on essential causal reasoning of the present invention;
[0043] Figure 2 It is a schematic diagram of the implementation architecture of the fine-grained classification method based on essential causal reasoning of the present invention;
[0044] Figure 3 It is a schematic diagram of the processing flow of the backbone network;
[0045] Figure 4 A flowchart of the steps for calculating the difference vector;
[0046] Figure 5 Schematic diagram of feature decoupling network;
[0047] Figure 6 Schematic diagram of the processing steps for data enhancement;
[0048] Figure 7 Schematic diagram of the processing flow for calculating the essential eigenvector. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0050] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.
[0051] Introduction to existing technology:
[0052] Existing technologies construct classification networks through deep convolutional neural networks, extract the features of the target itself in the image, and use attention mechanisms or other means to enhance the features. The current mainstream technologies all use attention mechanisms to enhance the effective parts of the features and suppress the non-critical parts. In the fine-grained classification of natural images, many studies have used channel attention mechanisms to distinguish different targets by learning the differences between the features of the target image in different channels. Feature channels are usually used to measure the depth of the network. The more channels there are, the richer the semantic information can be accommodated. Channel attention generally regards each channel as an independent unit and assigns different weights to each channel so that important channels are filtered out.
[0053] The existing research designs an end-to-end feature representation network by combining attribute supervision information and multi-level feature representation to explore fine-grained information and improve classification performance. Most existing methods use statistical learning methods to search for patterns from a large amount of observational data. These methods train models to match and fit the training data set without providing a reasonable explanation for the final decision results.
[0054] At present, the feature aggregation methods in the classification field are mainly divided into bilinear product and global average pooling. Bilinear product associates the positions and semantics of two feature maps by performing matrix multiplication on two feature maps, thereby obtaining more advanced associated features, which is widely used in fine-grained image classification. Global average pooling forces the mapping between features and categories and integrates spatial information, which essentially prevents overfitting of the overall structure. In addition, there are also studies that use second-order pooling instead of fully connected layers to classify remote sensing images.
[0055] Remote sensing image datasets in the direction of fine-grained image classification, such as FGSC-23 and FGSCR-42, generally have a long-tail distribution. It is common for some categories to have an order of magnitude less than other categories due to the difficulty in obtaining image samples. Among the common data preprocessing methods, the white box method is mainly based on geometric or color transformation. For example, AlexNet uses random cropping, random rotation, random flipping and scaling. The data enhancement used in Resnet and Densenet is still the method of geometric transformation. Some MixUp methods similar to image mixing alleviate the problem of data imbalance by sampling a small number of samples in the feature space of adjacent categories to synthesize new samples. Some other datasets, MTARSI, use foreground and background separation and random combination to alleviate the problem of single data scenes.
[0056] Disadvantages of existing technology:
[0057] These spurious associations between attention regions and predicted labels lead to unexplainable and unreliable decisions of the trained network. The dual-path structure of the multi-level attention network structure generally uses feature sampling or difference to fuse the feature maps of two adjacent layers, which leads to a lot of calculations. Existing solutions generally directly stack all features, and after pooling and dimensionality reduction, input them into the fully connected layer for classification. This rough processing method not only has many repeated calculations, but also may cause feature entanglement and difficulty in convergence due to the superposition of multiple features. In addition, the attention mechanism is not stable enough for complex background images. Due to the high computational complexity of bilinear product, the speed of back propagation is particularly slow, which is not suitable for remote sensing image feature aggregation. In addition, the two different levels of features, intrinsic features and attention features, are not fully utilized in existing solutions, and there is a lack of highly discriminative features to guide the classification network to make distinguishing decisions between refined categories. Existing data augmentation methods do not purposefully expand the data sample enhancement method, which may introduce additional noise and make it difficult to cope with complex high-dimensional data mining tasks.
[0058] The steps of the present invention specifically include:
[0059] like Figure 1 and 2 As shown, the present invention proposes a fine-grained classification method based on essential causal reasoning, and the steps of the method include:
[0060] Step S100, inputting the remote sensing image into a preset backbone network, and outputting the intrinsic feature tensor through the backbone network;
[0061] like Figure 3 As shown, in the specific implementation process, a plurality of ConvNeXt network modules are arranged in the backbone network to complete feature extraction at multiple stages. The ConvNeXt network is a convolutional neural network and is used for image classification tasks.
[0062] The difficulty of classifying fine-grained targets in remote sensing images lies in finding the feature differences between two targets of different categories, and these differences are often reflected in the details. Many target recognition networks apply multi-scale features in the network to identify targets of different scales. The top-down semantic information transmission structure makes each layer of the pyramid feature integrate high-level semantic information.
[0063] Step S200, inputting the intrinsic feature tensor into a causal multi-head attention module, and outputting an attention feature map through the causal multi-head attention module;
[0064] In the specific implementation process, the causal multi-head attention module is based on the causal multi-head attention mechanism, and the causal multi-head attention module is a neural network model.
[0065] The convolutional layer of the neural network model of the causal multi-head attention mechanism is used to obtain several attention maps from the intrinsic feature tensor to represent the discriminative part of the object, and a counterfactual intervention based on causal reasoning is introduced to explore the intrinsic relationship between the generated attention map and the predicted category. The causal multi-head attention map is generated to explore the true causal relationship between the attention area and the classification result, so that the network focuses on the salient features of the object.
[0066] like Figure 7 As shown, in step S300, the intrinsic feature tensor and the attention feature map are input into the attention pooling module, and the attention pooling module flattens the intrinsic feature tensor and the attention feature map, and obtains the essential feature vector based on the flattened intrinsic feature tensor and the attention feature map;
[0067] In the specific implementation process, in the step of obtaining the essential feature vector based on the flattened intrinsic feature tensor and the attention feature map, the essential feature vector is calculated based on the following formula:
[0068]
[0069] in, represents the flattened intrinsic feature tensor, represents the attention feature map after flattening, represents the vector of the first row of the flattened attention feature map, represents the vector of the Kth row of the flattened attention feature map, and β1 represents The total number of dimensions of the obtained vector, α1 represents Any dimension of the resulting vector, β K express The total number of dimensions of the resulting vector, α K express For any dimension of the obtained vector, b represents the essential eigenvector.
[0070] The attention pooling module cleverly combines attention features and intrinsic features, aggregates and pools the attention features and features extracted by the backbone network to generate a feature vector, fully utilizing the differences in feature levels among targets of different categories and improving the network's ability to accurately classify targets.
[0071] The aggregation of essential feature vectors is not a bilinear operation on the feature map output by the backbone network itself, but takes the two homologous features of channel filtering, merging and backbone network output features as input. Since a large number of channels may respond to the same feature repeatedly in the output feature map, a large number of channels with repeated responses can be filtered out through the strengthening and screening of attention. In this process, not only the computational complexity is reduced by avoiding the calculation of repeated channels, but also the interference of the existence of channels with possible background pole peak responses on classification is removed.
[0072] With the above scheme, the existing fusion method simply superimposes the attention features and the intrinsic features to enable the classifier to identify targets of various categories. The existing technology ignores the association between features. In addition, the rough stacking contains many repeated calculations, making the aggregation method inefficient. This scheme cleverly combines the attention features and the intrinsic features and is highly efficient. This scheme fuses the two tensors into an essential feature vector through the attention pooling module. The existing technology uses a bilinear aggregation operator to aggregate, which can only aggregate two vectors. This scheme first flattens the vectors and then aggregates them through the above formula to obtain the essential feature vector.
[0073] Step S400: input the essential feature vector into a preset feature decoupling network, wherein the feature decoupling network is provided with a classifier, and a classification result is obtained through the output of the classifier.
[0074] In a specific implementation process, the feature decoupling network includes a classifier and multiple fully connected layers, and the classifier can be a softmax classifier.
[0075] With the above scheme, the features in the feature decoupling network are entangled with each other, so a mapping method is used to decouple, mapping the feature vector in the high-dimensional non-orthogonal space to another orthogonal space of the same dimension, that is, mapping the feature vector to the orthogonal essential feature space to obtain the essential feature vector, so that the features are no longer entangled. The dimensions of the feature vectors in this space are relatively orthogonal, which facilitates the classifier to learn the target features and correctly classify. At the same time, this scheme first avoids directly stacking all features, and then inputs them into the fully connected layer for classification after pooling and dimensionality reduction. By combining the attention features and the intrinsic features, the shallow and deep features are integrated, the processing sophistication is improved, and the classification accuracy is improved.
[0076] like Figure 2 As shown, this solution targets the process of intrinsic feature and attention feature extraction, feature fusion, feature decoupling, and feature-guided classification. It constructs the network based on the neural network structure, extracts intrinsic features based on the backbone network built on ConvNeXt, generates multiple causal attention graphs based on the causal multi-head attention model, and obtains attention features by further fusion through calculation. The intrinsic features and attention features are combined through the innovatively proposed attention pooling module to obtain the essential features, the final classification is obtained through the feature decoupling network, and interactive training is performed using guided data enhancement.
[0077] Using the above scheme, the existing fine-grained classification tasks of remote sensing images usually simply use attention features or intrinsic features, or simply superimpose attention features and intrinsic features to enable the classifier to identify targets of various categories. However, the existing schemes ignore the correlation between features. In addition, the rough stacking contains many repeated calculations, which makes the aggregation method inefficient. This scheme adopts an attention pooling module, which cleverly combines attention features and intrinsic features through bilinear aggregation operators and pooling layers, integrates shallow and deep features, improves classification accuracy, and has high efficiency.
[0078] In some embodiments of the present invention, a plurality of ConvNeXt network modules are provided in the backbone network. In the step of outputting the intrinsic feature tensor through the backbone network, the plurality of ConvNeXt network modules are used as feature extractors to perform multiple stages of feature extraction on the remote sensing image to obtain the intrinsic feature tensor.
[0079] Using the above scheme, the difficulty of classifying fine-grained targets in remote sensing images lies in finding the feature differences between two targets of different categories, and these differences are often reflected in the details. This scheme starts with multi-level features and applies multi-scale features in the network to identify targets of different scales. The backbone network of this scheme is composed of a top-down semantic information transmission structure, so that each layer of the pyramid features integrates high-level semantic information.
[0080] like Figure 4 As shown, in some embodiments of the present invention, the step of inputting the intrinsic feature tensor into the causal multi-head attention module, and outputting the attention feature map through the causal multi-head attention module includes:
[0081] Performing element-wise multiplication of the attention feature map and the remote sensing image, and performing a GAP operation on the generated image to obtain a first attention map, superimposing images of each channel of the first attention map to obtain a regional feature map, inputting the regional feature map into a classifier, and outputting a first feature vector through the classifier;
[0082] Randomly generate a random feature map, perform element-wise multiplication on the random feature map and the remote sensing image, perform a GAP operation on the generated image to obtain a second attention map, superimpose the images of each channel of the second attention map to obtain a local feature map, input the local feature map into a classifier, and output a second feature vector through the classifier;
[0083] A difference vector is calculated based on the first eigenvector and the second eigenvector, a loss function is calculated based on the difference vector and a preset classification label, and the causal multi-head attention module is trained.
[0084] In a specific implementation process, the first eigenvector is subtracted from the second eigenvector to obtain a difference vector.
[0085] In the step of calculating the loss function based on the difference vector and the preset classification label, a cross entropy loss function may be used.
[0086] In the specific implementation process, the GAP operation is a global average pooling process.
[0087] like Figure 5 As shown, in the specific implementation process, the feature decoupling network includes a sequentially connected fully connected layer, a batch normalization layer, an activation function layer, a normalized exponential function layer, and a plurality of processing modules consisting of a sequentially connected fully connected layer, a batch normalization layer, and an activation function layer.
[0088] In some embodiments of the present invention, in the step of performing element-wise multiplication of the attention feature map and the remote sensing image, performing a GAP operation on the generated image, obtaining a first attention map, superimposing images of each channel of the first attention map, obtaining a regional feature map, inputting the regional feature map into a classifier, and outputting a first feature vector through the classifier, the first feature vector is calculated according to the following formula:
[0089]
[0090] In the step of randomly generating a random feature map, performing element-wise multiplication of the random feature map and the remote sensing image, performing a GAP operation on the generated image to obtain a second attention map, superimposing images of each channel of the second attention map to obtain a local feature map, inputting the local feature map into a classifier, and outputting a second feature vector through the classifier, the second feature vector is calculated according to the following formula:
[0091]
[0092] Among them, F l-1 represents remote sensing image, A m represents the attention feature map, represents a random feature map, ⊙ represents element-wise multiplication, represents the GAP operation, M represents the number of channels of the first attention map or the second attention map, m represents the mth channel of the first attention map, Γ represents the classifier processing, and Y A represents the first eigenvector, represents the second eigenvector.
[0093] In some embodiments of the present invention, the steps of the method also include model pre-training. In the model pre-training step, based on a preset training data set, the remote sensing images in the training data set are input into the backbone network, and the classification results are output by the classifier of the feature decoupling network. The loss function is calculated based on the classification results and the preset classification labels, and the backbone network, causal multi-head attention module, attention pooling module and feature decoupling network are trained based on the loss function value.
[0094] like Figure 6 As shown, in some embodiments of the present invention, the step of inputting the remote sensing images in the training data set into the backbone network and outputting the classification results through the classifier of the feature decoupling network also includes:
[0095] Obtain an attention feature map output by the causal multi-head attention module based on the remote sensing image; obtain a probability vector based on the attention feature map;
[0096] Based on the probability vector, a detail feature channel map and a mask feature channel map are obtained by screening each channel map of the attention feature map;
[0097] Based on the detail feature channel map, the remote sensing image is cropped and scaled to obtain a detail map;
[0098] Performing mask processing on the remote sensing image based on the mask feature channel map to obtain a mask map;
[0099] The classification labels of the remote sensing images corresponding to the detail map and the mask map are used as the classification labels of the detail map and the mask map, the detail map and the mask map are respectively input into the backbone network, and the classification results are output through the classifier of the feature decoupling network, and the loss functions are calculated respectively to train the backbone network, the causal multi-head attention module, the attention pooling module and the feature decoupling network.
[0100] This scheme processes remote sensing images by calculating probability vectors to obtain detail maps and mask maps to achieve data enhancement. The data enhancement of this scheme uses a flexible point-guided method for attention-guided cropping to locate and enlarge key areas, and sets a mask to cover the area selected by the attention feature to transfer the attention area. This mechanism is used to discover more hotspots in essential feature areas, help the network locate other areas with similar features to the masked areas, adaptively enhance training samples during the training phase, accelerate the convergence of the model, and be able to adaptively select, enlarge or mask areas based on features. Adaptive solutions are proposed for different data distributions, and additional samples are introduced more reasonably to expand the network's learning of the essential features of the target.
[0101] In view of the fact that the existing technology makes it difficult to learn category features due to uneven data distribution in remote sensing images, this solution sets up data enhancement. Under normal circumstances, the key features of the target are easy to capture, and the network is less affected by the uneven distribution of data. However, in visible light remote sensing images, it is difficult to accurately extract complete features due to multiple factors such as occlusion, light changes, or resolution, which increases classification losses and is not conducive to model convergence. In order to reduce learning interference on difficult samples and accelerate convergence, this solution uses guided data enhancement during the training phase, so that the classification network can better learn target features.
[0102] In visual tasks, each channel of the feature map is usually considered to be the response value map of the original image to a certain visual pattern. Therefore, this scheme uses a certain layer of features to locate the area in the original image that has a strong response to a certain pattern. The attention feature map output by the causal multi-head attention module contains low-level details and position information, so this scheme uses this feature to adaptively enhance the data. The main idea of this module is to find features that can effectively support refined classification in multi-level feature maps through weakly supervised learning.
[0103] The unsupervised data enhancement module can discover the features of important channels from the attention features. Based on these attention slice features, the module zooms in on important areas for regional focusing and searches for more hot spots for regional diversification.
[0104] In some embodiments of the present invention, the dimension value of the probability vector and the channel of the attention feature map Figure 1One to one, in the step of screening the detail feature channel map and the mask feature channel map from each channel map of the attention feature map based on the probability vector, the channel map corresponding to the largest dimension value in the dimensional value of the probability vector is obtained as the detail channel map, and the channel map corresponding to the smallest dimension value in the dimensional value of the probability vector is obtained as the mask channel map.
[0105] In some embodiments of the present invention, the step of cropping and scaling the remote sensing image based on the detail feature channel map to obtain the detail map includes:
[0106] Performing binarization processing on the detail feature channel map based on a preset first pixel threshold;
[0107] The position of 1 in the detail feature channel map after binarization is cropped from the remote sensing image to obtain the detail map.
[0108] In some embodiments of the present invention, the step of performing mask processing on the remote sensing image based on the mask feature channel map to obtain the mask map includes:
[0109] Performing binarization processing on the mask feature channel map based on a preset second pixel threshold;
[0110] The mask map is obtained by cutting out the position of 0 in the mask feature channel map after binarization processing from the remote sensing image.
[0111] This scheme explores the intrinsic relationship between the object's attention area and the prediction result to identify the true causal relationship from the input image and the classification result, and assists in the mining of essential features, thereby obtaining a feature bilinear aggregation pool with low computational time complexity, associating the intrinsic features with the attention features, and stacking higher-level semantics to form an essential feature vector. This high-level feature represents the high-level semantics of the target category in the feature space, further improving the credibility and accuracy of the network in the classification task. For the feature vector after pooling and dimensionality reduction, the feature decoupling network is used to project the feature vector in the high-dimensional space to the coordinate system in the Euclidean space of the same dimension, so that the features are no longer entangled. A data enhancement method is proposed, which can adaptively select and enlarge or mask the region according to the feature, propose adaptive solutions for different data distributions, and reasonably introduce additional samples to expand the network's learning of the target's essential features. Through weakly supervised learning, features that can effectively support refined classification are found in multi-level feature maps.
[0112] The beneficial effects of this program include:
[0113] 1. The existing feature extraction scheme is improved. ConvNeXt is used to replace the traditional convolutional layer to build the backbone network. ConvNeXt is used as a feature extractor to introduce additional inter-channel information. This inter-channel association has an impact on the network's ability to extract features. When this inter-channel information is attached to the output stage of the feature extraction network, the inter-channel information module is separated from the network feature extraction module. This information has a positive impact on the classification network and improves the extraction efficiency and speed.
[0114] 2. The convolutional layer of the causal multi-head attention model is used to obtain multiple attention maps from high-level feature maps, construct causal maps through counterfactual strategies, and extract multiple causal attention maps from the input image, thereby promoting the generation of interpretable image features and helping the network focus on the discriminative part of the object. The credibility of the model is improved, and decisions are made based on the results of causal reasoning research that imitate human thinking with counterfactual thinking, which is used to explore the intrinsic relationship between attention areas and prediction results.
[0115] 3. The attention pooling aggregation method can aggregate two features of equal size in a bilinear manner under the premise that the computational amount is acceptable. The attention pooling aggregation method does not only perform bilinear operations on the feature map output by the backbone network itself, but uses the causal multi-head attention model to filter and merge the features by channel and the two homologous features of the backbone network output features as input. Since a large number of channels may respond repeatedly to the same feature in the output feature map, a large number of channels with repeated responses can be filtered out through the strengthening and screening of attention, and compressed into channels that only contain the essential features of the target. In this process, not only the computational complexity is reduced by avoiding the calculation of repeated channels, but also the interference of the possible background extreme peak response channels on the classification is removed.
[0116] 4. The feature decoupling network of this scheme learns a nonlinear mapping so that the original coordinate system can be mapped to the features described by mutually orthogonal basis vectors through orthogonal transformation. The spatial basis vectors are mutually orthogonal. We call this feature space the essential feature space. There will be no feature entanglement between features. In the essential features of two categories, even if the difference is only in a certain dimension, it is enough for the classifier to effectively distinguish.
[0117] 5. This scheme proposes guided data enhancement. Through the attention-guided cropping and distraction region mechanism, it can find a typical area in the attention feature map, which is the area containing the essential features of the target, and accurately find those areas containing essential features in different samples of the same category, so as to obtain a more precise attention map, and comprehensively learn those important features that were ignored in the first round in the second round, and locate more other areas with similar features to the masked area. This mechanism uses weakly supervised learning to find features that can effectively support refined classification in multi-level feature maps. Through the guided data enhancement mechanism, it can select the most effective parts of the feature map for classification, helping the network focus on these essential features; and it enables our classification network to adapt to the unique properties of optical remote sensing images, improving the network's adaptability and generalization performance.
[0118] An embodiment of the present invention also provides a fine-grained classification system based on essential causal reasoning, the system comprising a computer device, the computer device comprising a processor and a memory, the memory storing computer instructions, the processor being used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the system implements the steps implemented by the method described above.
[0119] The embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps implemented by the aforementioned fine-grained classification method based on essential causal reasoning are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0120] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0121] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.
[0122] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or replace features of other embodiments.
[0123] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A fine-grained classification method based on essential causal reasoning, characterized in that: The steps of the method include: Inputting a remote sensing image into a preset backbone network, outputting an intrinsic feature tensor through the backbone network, wherein a plurality of ConvNeXt network modules are provided in the backbone network, and in the step of outputting the intrinsic feature tensor through the backbone network, performing multiple stages of feature extraction on the remote sensing image through the plurality of ConvNeXt network modules as feature extractors to obtain the intrinsic feature tensor; The intrinsic feature tensor is input into a causal multi-head attention module, and an attention feature map is output through the causal multi-head attention module. The steps include: performing element-wise multiplication of the attention feature map and the remote sensing image, performing a GAP operation on the generated image, obtaining a first attention map, superimposing images of each channel of the first attention map, obtaining a regional feature map, inputting the regional feature map into a classifier, and outputting a first feature vector through the classifier; randomly generating a random feature map, performing element-wise multiplication of the random feature map and the remote sensing image, performing a GAP operation on the generated image, obtaining a second attention map, superimposing images of each channel of the second attention map, obtaining a local feature map, inputting the local feature map into a classifier, and outputting a second feature vector through the classifier; calculating a difference vector based on the first feature vector and the second feature vector, calculating a loss function based on the difference vector and a preset classification label, and training the causal multi-head attention module; Inputting the intrinsic feature tensor and the attention feature map into an attention pooling module, the attention pooling module flattens the intrinsic feature tensor and the attention feature map, and obtaining an essential feature vector based on the flattened intrinsic feature tensor and the attention feature map; The essential feature vector is input into a preset feature decoupling network, the feature decoupling network is provided with a classifier, and a classification result is obtained through the output of the classifier.
2. The fine-grained classification method based on essential causal reasoning according to claim 1 is characterized in that: In the step of performing element-wise multiplication of the attention feature map and the remote sensing image, performing a GAP operation on the generated image to obtain a first attention map, superimposing images of each channel of the first attention map to obtain a regional feature map, inputting the regional feature map into a classifier, and outputting a first feature vector through the classifier, the first feature vector is calculated according to the following formula; In the step of randomly generating a random feature map, performing element-wise multiplication of the random feature map and the remote sensing image, performing a GAP operation on the generated image to obtain a second attention map, superimposing images of each channel of the second attention map to obtain a local feature map, inputting the local feature map into a classifier, and outputting a second feature vector through the classifier, the second feature vector is calculated according to the following formula: Among them, F l-1 represents remote sensing image, A m represents the attention feature map, represents a random feature map, ⊙ represents element-wise multiplication, represents the GAP operation, M represents the number of channels of the first attention map or the second attention map, m represents the mth channel of the first attention map, Γ represents the classifier processing, and Y A represents the first eigenvector, represents the second eigenvector.
3. The fine-grained classification method based on essential causal reasoning according to claim 1 or 2 is characterized in that: The method also includes model pre-training. In the model pre-training step, based on a preset training data set, the remote sensing images in the training data set are input into the backbone network, and the classification results are output through the classifier of the feature decoupling network. The loss function is calculated based on the classification results and the preset classification labels, and the backbone network, causal multi-head attention module, attention pooling module and feature decoupling network are trained based on the loss function value.
4. The fine-grained classification method based on essential causal reasoning according to claim 3 is characterized in that: The step of inputting the remote sensing images in the training data set into the backbone network and outputting the classification results through the classifier of the feature decoupling network also includes: Obtain an attention feature map output by the causal multi-head attention module based on the remote sensing image; obtain a probability vector based on the attention feature map; Based on the probability vector, a detail feature channel map and a mask feature channel map are obtained by screening each channel map of the attention feature map; Based on the detail feature channel map, the remote sensing image is cropped and scaled to obtain a detail map; Performing mask processing on the remote sensing image based on the mask feature channel map to obtain a mask map; The classification labels of the remote sensing images corresponding to the detail map and the mask map are used as the classification labels of the detail map and the mask map, the detail map and the mask map are respectively input into the backbone network, and the classification results are output through the classifier of the feature decoupling network, and the loss functions are calculated respectively to train the backbone network, the causal multi-head attention module, the attention pooling module and the feature decoupling network.
5. The fine-grained classification method based on essential causal reasoning according to claim 4 is characterized in that: The dimension values of the probability vector correspond one-to-one to the channel maps of the attention feature map. In the step of screening the detail feature channel map and the mask feature channel map from the various channel maps of the attention feature map based on the probability vector, the channel map corresponding to the largest dimension value among the dimension values of the probability vector is obtained as the detail channel map, and the channel map corresponding to the smallest dimension value among the dimension values of the probability vector is obtained as the mask channel map.
6. The fine-grained classification method based on essential causal reasoning according to claim 5 is characterized in that: The step of cropping and scaling the remote sensing image based on the detail feature channel map to obtain the detail map comprises: Performing binarization processing on the detail feature channel map based on a preset first pixel threshold; The position of 1 in the detail feature channel map after binarization is cropped from the remote sensing image to obtain the detail map.
7. The fine-grained classification method based on essential causal reasoning according to claim 5 is characterized in that: The step of performing mask processing on the remote sensing image based on the mask feature channel map to obtain the mask map includes: Performing binarization processing on the mask feature channel map based on a preset second pixel threshold; The mask map is obtained by cutting out the position of 0 in the mask feature channel map after binarization processing from the remote sensing image.
8. A fine-grained classification system based on essential causal reasoning, characterized in that: The system includes a computer device, which includes a processor and a memory. The memory stores computer instructions. The processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the system implements the steps implemented by the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Fine-grained image classification method and system, computer equipment and storage medium
CN112163465A
Weak supervision fine-grained image classification method and system based on local diversification guidance
CN115984627A
