Multispectral image feature extraction method, system and device
Through multi-scale fusion of local and global feature extraction and feature fusion methods, combined with convolutional neural network and Transformer architecture, the problem of information loss and gradient disappearance in multispectral image feature extraction is solved, and more efficient and accurate feature extraction is achieved, which is suitable for Feature extraction scenarios for multispectral images.
Patent Information
- Application Number
- CN202410720066.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-06-05
AI Technical Summary
Existing technologies are prone to information loss in multispectral image feature extraction, resulting in reduced efficiency and accuracy of downstream tasks. In addition, deep learning-based methods have deficiencies in local and global correlation extraction, gradient disappearance problems, etc.
A multi-scale fusion local and global feature extraction method is used to extract features from visible light images and infrared thermal images, and the target feature pyramid of multispectral images is obtained through feature fusion. It combines the convolutional neural network and Transformer architecture to use self-attention and cross-over Attention mechanism enhances the richness and robustness of feature extraction.
It effectively extracts rich information from multispectral images, improves feature extraction efficiency and accuracy, and is suitable for feature extraction scenarios of multispectral images. It overcomes the problems of local non-convergence and global non-convergence in the existing technology, and improves performance in low-light scenes. feature extraction capabilities.
Smart Images

Figure CN118506015B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a multispectral image feature extraction method, system and device. Background Art
[0002] Multispectral images contain spectral bands of multiple bands and have richer spectral and spatial information. They are widely used in environmental monitoring, military reconnaissance and other fields. Therefore, it is often necessary to extract features from multispectral images.
[0003] In recent years, with the development of deep learning, image feature extraction methods based on deep learning have made great progress. Existing deep learning-based feature extraction encoders are mainly divided into two types: based on Convolutional Neural Networks (CNN) architecture and based on Transformer architecture. However, the former is prone to local convergence but not global convergence during the iteration process, ignores the global and local correlation during feature extraction, and the extracted high-level features are generally interpretable; the latter performs poorly in the representation of position information, and is prone to gradient vanishing when the number of network layers is large.
[0004] Moreover, due to the complexity of multispectral image information, the feature extraction of multispectral images using existing technologies will lose a lot of information, further leading to reduced efficiency and accuracy of downstream tasks, such as multispectral target detection and classification. Summary of the invention
[0005] In view of this, the present invention provides a multispectral image feature extraction method, system and device, which can solve the technical problem that the current feature extraction of multispectral images will lose a lot of information, further leading to reduced efficiency and accuracy of downstream tasks.
[0006] According to a first aspect of the present invention, a method for extracting features from a multispectral image is provided, the method comprising:
[0007] Acquire a multispectral image to be extracted, wherein the multispectral image includes a visible light image and an infrared thermal image;
[0008] Performing multi-scale fusion of local and global feature extraction on the visible light image and the infrared thermal image respectively to obtain visible light image features and infrared thermal image features corresponding to each scale, wherein the multi-scale fusion of local and global feature extraction includes: extracting the first feature of each token element in the visible light image or the infrared thermal image, performing a first scale fusion of global and local feature extraction on the first feature to obtain a feature extraction result of the first scale, performing a next scale fusion of global and local feature extraction on the feature extraction result of the first scale, until obtaining a feature extraction result of the last scale;
[0009] The visible light image features and the infrared thermal image features of the same scale are fused to obtain target features of corresponding scales, and the target feature pyramid of the multispectral image is obtained according to the target features of all scales.
[0010] Preferably, performing a first-scale fusion global and local feature extraction on the first feature to obtain a first-scale feature extraction result includes:
[0011] After performing deep convolution processing on the first feature, the second feature is added to the first feature to obtain a second feature that introduces feature position information;
[0012] performing normalization processing on the second feature;
[0013] Obtaining a first initial key matrix, a first initial value matrix, and a first initial query matrix of the normalized second feature, performing token interaction fusion on the first initial key matrix and the first initial value matrix to obtain a first fused key matrix and a first fused value matrix, performing global feature dependency modeling on the first fused key matrix, the first fused value matrix, and the first initial query matrix to obtain global features, performing fine-grained feature extraction operations based on the global features and the normalized second features to obtain local features, adding the global features to the local features to obtain a third feature having a global feature dependency and a local feature representation, and adding the third feature to the second feature to obtain a fourth feature;
[0014] The fourth feature is normalized, and the normalized fourth feature is enhanced to obtain an enhanced feature, and the enhanced feature is added to the fourth feature to obtain a feature extraction result of the first scale corresponding to the visible light image or the infrared thermal image.
[0015] Preferably, performing token interaction fusion on the first initial key matrix and the first initial value matrix to obtain a first fused key matrix and a first fused value matrix, and performing global feature dependency modeling on the first fused key matrix, the first fused value matrix and the first initial query matrix to obtain global features include:
[0016] Performing first depthwise convolution operations of different step lengths on the first initial key matrix and the first initial value matrix respectively to obtain a first matrix corresponding to the first initial key matrix and a second matrix corresponding to the first initial value matrix;
[0017] After performing a second depthwise convolution operation with the same step length on the first matrix and the second matrix respectively, a first matrix to be fused and a second matrix to be fused are obtained correspondingly, the first matrix to be fused and the second matrix are added, a convolution operation is performed on the added matrix to obtain a first fusion key matrix, the second matrix to be fused and the first matrix are added, a convolution operation is performed on the added matrix to obtain a first fusion value matrix;
[0018] A multi-head attention score is calculated according to the first fusion key matrix, the first fusion value matrix and the first initial query matrix, and a global feature is calculated according to the multi-head attention score and the weight matrix.
[0019] Preferably, performing a fine-grained feature extraction operation according to the global feature and the normalized second feature to obtain a local feature includes:
[0020] After performing a feature splicing operation on the global feature and the second feature after the normalization processing, a splicing feature is obtained, a convolution operation is performed on the splicing feature, a deep convolution operation is performed on the splicing feature after the convolution operation, and a fifth feature is obtained, and the fifth feature and the second feature after the normalization processing are respectively convolved and then added to obtain a local structural relationship feature;
[0021] Performing a convolution operation on the weighted sum of the local structural relationship feature and the global feature to obtain an intermediate feature;
[0022] Obtain a second initial key matrix, a second initial value matrix, and a second initial query matrix of the intermediate features, and perform third depthwise convolution operations of different step lengths on the second initial key matrix and the second initial value matrix, respectively, to obtain a third matrix corresponding to the second initial key matrix and a fourth matrix corresponding to the second initial value matrix;
[0023] After performing a fourth depthwise convolution operation with the same step length on the third matrix and the fourth matrix respectively, a third matrix to be fused and a fourth matrix to be fused are obtained correspondingly, the third matrix to be fused and the fourth matrix are added, a convolution operation is performed on the added matrix to obtain a second fusion key matrix, the fourth matrix to be fused and the third matrix are added, a convolution operation is performed on the added matrix to obtain a second fusion value matrix;
[0024] A multi-head attention score is calculated according to the second fusion key matrix, the second fusion value matrix and the second initial query matrix, and a local feature is calculated according to the multi-head attention score and the weight matrix.
[0025] Preferably, the step of fusing the visible light image features and the infrared thermal image features of the same scale to obtain target features of the corresponding scale includes:
[0026] Performing feature compression on the visible light image features and the infrared thermal image features of the same scale respectively, and obtaining compressed features of the visible light image and compressed features of the infrared thermal image accordingly;
[0027] Planarizing the compressed features of the visible light image and the compressed feature maps of the infrared thermal image into a set of tokens and adding learnable spatial position embeddings, respectively, to obtain tokens with position embeddings of the visible light image and tokens with position embeddings of the infrared thermal image;
[0028] Calculating the cross-modal enhanced features of the visible light image and the cross-modal enhanced features of the infrared thermal image according to the token with position embedding of the visible light image and the token with position embedding of the infrared thermal image;
[0029] The cross-modal enhanced features of the visible light image are added to the features of the visible light image to obtain a first addition result, the cross-modal enhanced features of the infrared thermal image are added to the features of the infrared thermal image to obtain a second addition result, and feature aggregation is performed on the first addition result and the second addition result to obtain target features of corresponding scales.
[0030] Preferably, the calculating the cross-modal enhanced features of the visible light image and the cross-modal enhanced features of the infrared thermal image according to the token with position embedding of the visible light image and the token with position embedding of the infrared thermal image comprises:
[0031] Calculate the query matrix of the visible light image according to the token with position embedding of the visible light image, calculate the key matrix of the infrared thermal image and the value matrix of the infrared thermal image according to the token with position embedding of the infrared thermal image, establish a first correlation matrix between the key matrix of the infrared thermal image and the query matrix of the visible light image by using a dot product operation, multiply the first correlation matrix by the value matrix of the infrared thermal image and perform normalization processing to obtain a sixth feature, add the sixth feature to the token with position embedding of the infrared thermal image to obtain a seventh feature, process the seventh feature by using a convolutional feedforward network to obtain an eighth feature, and add the seventh feature to the eighth feature to obtain a cross-modal enhanced feature of the infrared thermal image;
[0032] A query matrix of the infrared thermal image is calculated according to the position-embedded token of the infrared thermal image, a key matrix of the visible light image and a value matrix of the visible light image are calculated according to the position-embedded token of the visible light image, a second correlation matrix of the key matrix of the visible light image and the query matrix of the infrared thermal image is established by using a dot product operation, the second correlation matrix is multiplied by the value matrix of the visible light image and then normalized to obtain a ninth feature, the ninth feature is added to the position-embedded token of the visible light image to obtain a tenth feature, the tenth feature is processed by using a convolutional feedforward network to obtain an eleventh feature, and the tenth feature is added to the eleventh feature to obtain a cross-modal enhanced feature of the visible light image.
[0033] According to a second aspect of the present invention, a multispectral image feature extraction system is provided, the system comprising:
[0034] Acquisition module, convolution extraction module, deep neural encoder, cross attention fusion module;
[0035] Acquire a multispectral image to be extracted using the acquisition module, wherein the multispectral image includes a visible light image and an infrared thermal image;
[0036] The convolution extraction module and the deep neural encoder are used to perform multi-scale fusion local and global feature extraction on any one of the visible light image and the infrared thermal image. After the multi-scale fusion local and global feature extraction is performed on both images, the visible light image features and infrared thermal image features corresponding to each scale are obtained, wherein the convolution extraction module is used to extract the first feature of each token element in the visible light image or the infrared thermal image, the deep neural encoder is used to perform a first scale fusion global and local feature extraction on the first feature to obtain a feature extraction result of the first scale, and the deep neural encoder is used to perform a next scale fusion global and local feature extraction on the feature extraction result of the first scale until a feature extraction result of the last scale is obtained;
[0037] The cross-attention fusion module is used to fuse the visible light image features and the infrared thermal image features of the same scale to obtain target features of the corresponding scale, and the target feature pyramid of the multispectral image is obtained according to the target features of all scales.
[0038] Preferably, the deep neural encoder comprises: a convolution position embedding module, a first normalization processing module, a self-attention module, a second normalization processing module, and a convolution feedforward module;
[0039] After performing deep convolution processing on the first feature using the convolution position embedding module, the second feature is added to the first feature to obtain a second feature that introduces feature position information;
[0040] Using the first normalization processing module to perform normalization processing on the second feature;
[0041] Obtaining a first initial key matrix, a first initial value matrix, and a first initial query matrix of the second feature after normalization, and using the interactive fusion module of the self-attention module to perform token interactive fusion on the first initial key matrix and the first initial value matrix to obtain a first fused key matrix and a first fused value matrix;
[0042] Using the shallow self-attention unit of the self-attention module to model the global feature dependency relationship of the first fusion key matrix, the first fusion value matrix, and the first initial query matrix to obtain global features;
[0043] Using the local information perception unit of the self-attention module and the deep self-attention unit of the self-attention module to perform a fine-grained feature extraction operation according to the global feature and the normalized second feature to obtain a local feature;
[0044] Adding the global feature to the local feature to obtain a third feature having a global feature dependency relationship and a local feature representation, adding the third feature to the second feature to obtain a fourth feature, and performing normalization processing on the fourth feature using the second normalization processing module;
[0045] The convolution feedforward module is used to perform feature enhancement on the fourth feature after normalization to obtain an enhanced feature, and the enhanced feature is added to the fourth feature to obtain a feature extraction result of the first scale corresponding to the visible light image or the infrared thermal image.
[0046] According to a third aspect of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the multispectral image feature extraction method described above is implemented.
[0047] According to a fourth aspect of the present application, a computer device is provided, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the multispectral image feature extraction method when executing the program.
[0048] Through the above technical scheme, the present invention provides a multispectral image feature extraction method, system and device. Through the technical scheme of the present invention, multi-scale feature extraction is performed on visible light images and infrared thermal images respectively. On the one hand, the prior art only uses the CNN architecture for feature extraction, which is prone to global non-convergence, and only uses the Transformer architecture for feature extraction, which performs poorly in terms of position information representation, and when the number of network layers is large, gradient disappearance is prone to occur. Therefore, compared with the prior art, the feature extraction of this application has the beneficial effect of integrating the local features and global features of the image, so that richer information can be extracted in the feature extraction process of the multispectral image. On the other hand, since the multispectral image contains spectral bands of multiple bands and has richer spectral information and spatial information, the multi-scale feature extraction of the present application has the beneficial effect of extracting richer information in the feature extraction process of the multispectral image compared with the prior art that only uses single-scale feature extraction. information, and is suitable for scenarios where feature extraction is performed on multispectral images; through the technical solution of the present invention, the visible light image features and the infrared thermal image features of the same scale are feature fused to obtain target features of the corresponding scale. Since the visible light image can provide the color, texture and contour of the target under good lighting conditions, and in low-illuminance scenes, it is difficult to distinguish the target details and edges only from the visible light image background, and the infrared thermal image can still provide perceptible contour features due to its unique energy radiation imaging mechanism. Therefore, the present application utilizes the complementarity of visible light images and infrared thermal images. Specifically, the visible light image features and infrared thermal image features of the same scale have an information complementary relationship. The present application performs feature fusion on the two to obtain target features. Compared with the prior art that only uses visible light images or infrared thermal images in multispectral images to extract features, the present application has the beneficial effect that richer information can be extracted in the feature extraction process of multispectral images.
[0049] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation on the local application. In the drawings:
[0051] Figure 1 A schematic diagram of a process of extracting features from a multispectral image provided by an embodiment of the present invention is shown;
[0052] Figure 2 A schematic flow chart of another multispectral image feature extraction method provided by an embodiment of the present invention is shown;
[0053] Figure 3 A schematic diagram of the structure of a multispectral image feature extraction system provided by an embodiment of the present invention is shown;
[0054] Figure 4 A schematic diagram of the structure of a deep neural encoder in a multispectral image feature extraction system provided by an embodiment of the present invention is shown;
[0055] Figure 5 A schematic diagram of the structure of a self-attention module in a deep neural encoder in a multispectral image feature extraction system provided by an embodiment of the present invention is shown;
[0056] Figure 6 A schematic diagram of the structure of a cross attention module provided by an embodiment of the present invention is shown;
[0057] Figure 7 A schematic structural diagram of a feature enhancement unit for infrared thermal image features in a cross-attention module provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0058] The present invention will be described in detail below with reference to the accompanying drawings and in combination with the implementation regulations. It should be noted that the embodiments and features in the embodiments of the present invention can be combined with each other without conflict.
[0059] This embodiment provides a multi-spectral image feature extraction method, such as Figure 1 As shown, the method includes:
[0060] 101. Acquire a multispectral image to be extracted, wherein the multispectral image includes a visible light image and an infrared thermal image.
[0061] 102. Perform multi-scale fusion of local and global feature extraction on the visible light image and the infrared thermal image respectively to obtain visible light image features and infrared thermal image features corresponding to each scale, wherein the multi-scale fusion of local and global feature extraction includes: extracting the first feature of each token element in the visible light image or the infrared thermal image, performing a first scale fusion of global and local feature extraction on the first feature to obtain a feature extraction result of the first scale, performing a next scale fusion of global and local feature extraction on the feature extraction result of the first scale, until a feature extraction result of the last scale is obtained.
[0062] 103. Perform feature fusion on the visible light image features and the infrared thermal image features at the same scale to obtain target features at corresponding scales, and obtain a target feature pyramid of the multispectral image based on the target features at all scales.
[0063] Since visible light images can provide the color, texture and contour of the target under good lighting conditions, while in low-light scenes, it is difficult to distinguish the target details and edges from the visible light image background alone, and infrared thermal images can still provide perceptible contour features due to their unique energy radiation imaging mechanism, therefore, in steps 101-103 of the embodiment of the present application, multi-scale fusion of global and local features is performed on the visible light image of the multispectral image to obtain visible light image features, and multi-scale fusion of global and local features is performed on the infrared thermal image of the multispectral image to obtain infrared thermal image features, and the visible light image features are feature fused with the infrared thermal image features. In this way, the visible light image features It is a multi-scale fusion of global and local features. The infrared thermal image features are also a multi-scale fusion of global and local features. Then, the visible light image features and the infrared thermal image features are fused at the same scale. The information complementarity of the visible light image and the infrared thermal image is used to ensure that the information of the multispectral image is not lost. The target features of each scale obtained after feature fusion have rich information. The target feature pyramid of all scales obtained from the target features of each scale has even richer information. Therefore, the feature extraction efficiency and accuracy of the multispectral image are improved. Such a target feature pyramid is further used for downstream tasks to improve the efficiency and accuracy of downstream task processing.
[0064] The present invention provides a multispectral image feature extraction method, system and device. Through the technical solution of the present invention, multi-scale feature extraction is performed on visible light images and infrared thermal images respectively. On the one hand, the prior art only uses the CNN architecture for feature extraction, which is prone to global non-convergence. It only uses the Transformer architecture for feature extraction, which performs poorly in the representation of position information, and when the number of network layers is large, the gradient disappears easily. Therefore, compared with the prior art, the feature extraction of the present application has the beneficial effect of integrating the local features and global features of the image, so that more abundant information can be extracted in the feature extraction process of the multispectral image. On the other hand, since the multispectral image contains spectral bands of multiple bands and has richer spectral information and spatial information, the multi-scale feature extraction of the present application has the beneficial effect of extracting more abundant information in the feature extraction process of the multispectral image compared with the prior art that only uses single-scale feature extraction. The invention is suitable for scenarios where feature extraction is performed on multispectral images. Through the technical solution of the present invention, the visible light image features and the infrared thermal image features of the same scale are feature fused to obtain target features of the corresponding scale. Since the visible light image can provide the color, texture and contour of the target under good lighting conditions, and in low-illuminance scenes, it is difficult to distinguish the target details and edges from the visible light image background alone, while the infrared thermal image can still provide perceptible contour features due to its unique energy radiation imaging mechanism. Therefore, the present application utilizes the complementarity of visible light images and infrared thermal images. Specifically, the visible light image features and the infrared thermal image features of the same scale have an information complementary relationship. The present application performs feature fusion on the two to obtain target features. Compared with the prior art that only uses visible light image extraction features or infrared thermal image extraction features in multispectral images, the present application has the beneficial effect that richer information can be extracted in the feature extraction process of multispectral images.
[0065] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another multispectral image feature extraction method is provided, such as Figure 2 As shown, the method includes:
[0066] 201. Acquire a multispectral image to be extracted, wherein the multispectral image includes a visible light image and an infrared thermal image.
[0067] 202. Perform multi-scale fusion of local and global feature extraction on the visible light image and the infrared thermal image respectively to obtain visible light image features and infrared thermal image features corresponding to each scale, wherein the multi-scale fusion of local and global feature extraction includes: extracting a first feature of each token element in the visible light image or the infrared thermal image, performing a first scale fusion of global and local feature extraction on the first feature to obtain a feature extraction result of the first scale, performing a next scale fusion of global and local feature extraction on the feature extraction result of the first scale, until a feature extraction result of the last scale is obtained.
[0068] It should be noted that the local and global feature extraction of multi-scale fusion of visible light images and infrared thermal images in step 202 of the embodiment are independent of each other and the operation process is the same, that is, step 202 of the embodiment performs multi-scale fusion of local and global feature extraction on the visible light image to obtain visible light image features at each scale, and performs multi-scale fusion of local and global feature extraction on the infrared thermal image to obtain infrared thermal image features at each scale.
[0069] Specifically, the first feature of each token element in the visible light image or the infrared thermal image is extracted. As an implementation method, a convolution operation with a convolution kernel size of 3*3 and a step size of 2 can be performed to extract the first feature of each token element in the visible light image or the infrared thermal image, which serves to adjust the feature dimension and reduce the resolution of the input token.
[0070] Specifically, performing a first-scale fusion global and local feature extraction on the first feature to obtain a first-scale feature extraction result includes:
[0071] 1. After performing deep convolution processing on the first feature, add it to the first feature to obtain a second feature that introduces feature position information;
[0072] Among them, the deep convolution processing performed on the first feature can be a 3*3 deep convolution, and the position information of any resolution is learned through zero filling of the deep convolution, and the feature position information is introduced into all tokens.
[0073] 2. Normalizing the second feature;
[0074] 3. Obtain a first initial key matrix, a first initial value matrix, and a first initial query matrix of the second feature after normalization (specifically, the acquisition method is to directly project the second feature after normalization to obtain the first initial key matrix, the first initial value matrix, and the first initial query matrix), perform token interaction fusion on the first initial key matrix and the first initial value matrix to obtain a first fusion key matrix and a first fusion value matrix, perform global feature dependency modeling on the first fusion key matrix, the first fusion value matrix, and the first initial query matrix to obtain global features;
[0075] It should be noted that the prior art directly uses the first initial key matrix, the first initial value matrix and the first initial query matrix, but the embodiment of the present application performs token interactive fusion on the first initial key matrix and the first initial value matrix to obtain the first fusion key matrix and the first fusion value matrix, and uses the first fusion key matrix, the first fusion value matrix and the first initial query matrix. This reduces the spatial size of the first fusion key matrix and the first fusion value matrix, and at the same time realizes the extraction and interactive fusion of multi-scale tokens.
[0076] Among them, the first initial key matrix and the first initial value matrix are subjected to token interaction fusion to obtain a first fused key matrix and a first fused value matrix, and the first fused key matrix, the first fused value matrix and the first initial query matrix are subjected to global feature dependency modeling to obtain global features, including: performing a first deep convolution operation with different step lengths on the first initial key matrix and the first initial value matrix to obtain a first matrix corresponding to the first initial key matrix and a second matrix corresponding to the first initial value matrix; performing a second deep convolution operation with the same step length on the first matrix and the second matrix to obtain a first matrix to be fused and a second matrix to be fused respectively, adding the first matrix to be fused and the second matrix, performing a convolution operation on the added matrix to obtain a first fused key matrix, adding the second matrix to be fused and the first matrix, performing a convolution operation on the added matrix to obtain a first fused value matrix; calculating a multi-head attention score according to the first fused key matrix, the first fused value matrix and the first initial query matrix, and calculating global features according to the multi-head attention score and the weight matrix.
[0077] Among them, the second depth convolution operation can use a 3*3 depth convolution with a step size of 2, which is not limited here.
[0078] Among them, the shallow self-attention unit models the global feature dependency relationship of the first fusion key matrix, the first fusion value matrix and the first initial query matrix as follows:
[0079] Global feature = Concat(head0,head1,…,head h )W
[0080]
[0081] Among them, W is the weight matrix, head i is the output of the i-th attention head, Attention is the multi-head attention score, D represents the dimension of the input token, Q i is the first initial query matrix of the i-th attention head, K i is the first fusion bond matrix of the i-th attention head, V i is the first fusion value matrix of the i-th attention head.
[0082] 4. Performing a fine-grained feature extraction operation according to the global feature and the normalized second feature to obtain a local feature;
[0083] Among them, a fine-grained feature extraction operation is performed according to the global feature and the second feature after normalization to obtain a local feature, including: performing a feature splicing operation on the global feature and the second feature after normalization to obtain a spliced feature, performing a convolution operation on the spliced feature, performing a deep convolution operation on the spliced feature after the convolution operation to obtain a fifth feature, performing a convolution operation on the fifth feature and the second feature after normalization respectively and then adding them to obtain a local structural relationship feature; performing a convolution operation on the local structural relationship feature and the global feature after weighted summation to obtain an intermediate feature; obtaining a second initial key matrix, a second initial value matrix and a second initial query matrix of the intermediate feature, and performing a convolution operation on the second initial key matrix and the second initial value matrix; The matrices are subjected to a third deep convolution operation with different step lengths to obtain a third matrix corresponding to the second initial key matrix and a fourth matrix corresponding to the second initial value matrix; after the third matrix and the fourth matrix are subjected to a fourth deep convolution operation with the same step length, the third matrix to be fused and the fourth matrix to be fused are obtained respectively, the third matrix to be fused and the fourth matrix are added, and a convolution operation is performed on the added matrix to obtain a second fusion key matrix, the fourth matrix to be fused and the third matrix are added, and a convolution operation is performed on the added matrix to obtain a second fusion value matrix; the multi-head attention score is calculated according to the second fusion key matrix, the second fusion value matrix and the second initial query matrix, and the local features are calculated according to the multi-head attention score and the weight matrix.
[0084] Among them, the local information perception unit includes two 1*1 convolutions and one 3*3 deep convolution, and the local structural relationship feature = Conv(DWConv(Conv(splicing feature))+Conv(splicing feature)), Conv is a 1*1 convolution, and DWConv is a 3*3 deep convolution.
[0085] The calculation of local features is specifically as follows:
[0086] Local features = Concat(head0,head1,…,head h )W
[0087]
[0088] Among them, W is the weight matrix, head i is the output of the i-th attention head, Attention is the multi-head attention score, D represents the dimension of the input token, Q i is the second initial query matrix of the i-th attention head, K i is the second fusion bond matrix of the i-th attention head, V i is the second fusion value matrix of the i-th attention head.
[0089] Among them, the local structural relationship feature and the global feature are weighted and then convolved, and the convolution operation to obtain the intermediate feature can be a 1*1 convolution, which is not limited here.
[0090] Among them, the fourth depth convolution operation can use a 3*3 depth convolution with a step size of 2, which is not limited here.
[0091] 5. Add the global feature to the local feature to obtain a third feature having a global feature dependency relationship and a local feature representation, and add the third feature to the second feature to obtain a fourth feature;
[0092] 6. Normalize the fourth feature, enhance the normalized fourth feature to obtain an enhanced feature, add the enhanced feature to the fourth feature, and obtain a feature extraction result of the first scale corresponding to the visible light image or the infrared thermal image.
[0093] Among them, feature enhancement can be achieved through two 1*1 convolutions. If the first feature is based on a visible light image, the feature extraction result of the first scale of the visible light image is obtained. If the first feature is based on an infrared thermal image, the feature extraction result of the first scale of the infrared thermal image is obtained.
[0094] Specifically, after obtaining the feature extraction result of the first scale, the feature extraction result of the first scale is subjected to the feature extraction of the fusion of global and local features at a second scale to obtain the feature extraction result of the second scale, and then the feature extraction result of the second scale is subjected to the feature extraction of the fusion of global and local features at a third scale until the feature extraction result of the last scale is obtained.
[0095] 203. Perform feature compression on the visible light image features and the infrared thermal image features of the same scale, respectively, to obtain compressed features of the visible light image and compressed features of the infrared thermal image accordingly.
[0096] In order to reduce the subsequent calculation cost, the spatial information of the feature is converted to the channel dimension by reconstructing the dimension of the feature map, and then the channel dimension is compressed by 1*1 convolution. Specifically:
[0097] F compress =conv 1*1 (Reshape(F))
[0098] Among them, if F is the visible light image feature, then F compress is the compressed feature of the visible light image. If F is the feature of the infrared thermal image, then F compress It is the compressed feature of infrared thermal image.
[0099] 204. Flatten the compressed features of the visible light image and the compressed feature maps of the infrared thermal image into a set of tokens and add learnable spatial position embeddings to obtain corresponding tokens with position embeddings for the visible light image and tokens with position embeddings for the infrared thermal image.
[0100] 205. Calculate the cross-modal enhanced features of the visible light image and the cross-modal enhanced features of the infrared thermal image according to the token with position embedding of the visible light image and the token with position embedding of the infrared thermal image.
[0101] For this embodiment, a query matrix of the visible light image is calculated according to the token with position embedding of the visible light image, a key matrix of the infrared thermal image and a value matrix of the infrared thermal image are calculated according to the token with position embedding of the infrared thermal image, a first correlation matrix of the key matrix of the infrared thermal image and the query matrix of the visible light image is established by using a dot product operation, the first correlation matrix is multiplied by the value matrix of the infrared thermal image and then normalized to obtain a sixth feature, the sixth feature is added to the token with position embedding of the infrared thermal image to obtain a seventh feature, the seventh feature is processed by using a convolutional feedforward network to obtain an eighth feature, and the seventh feature is added to the eighth feature to obtain a cross-modal enhanced feature of the infrared thermal image;
[0102] Among them, the query matrix of the visible light image is calculated according to the token with position embedding of the visible light image, and the key matrix of the infrared thermal image and the value matrix of the infrared thermal image are calculated according to the token with position embedding of the infrared thermal image, including: projecting the token with position embedding of the visible light image onto Q, calculating Query, that is, the query matrix of the visible light image, projecting the token with position embedding of the infrared thermal image onto two independent matrices V and T, and correspondingly calculating Value, that is, the value matrix of the infrared thermal image and Key, that is, the key matrix of the infrared thermal image, specifically:
[0103]
[0104] Among them, W V is the weight matrix corresponding to the value matrix of the infrared thermal image, W K is the weight matrix corresponding to the key matrix of the infrared thermal image, W Q is the weight matrix corresponding to the query matrix of the visible light image, V T is the value matrix of the infrared thermal image, K T is the key matrix of infrared thermal image, Q R is the query matrix of the visible light image. The normalization process can use the softmax function.
[0105] Establish K through dot product operation T and Q RThe first correlation matrix represents the similarity of different features between the visible light modality and the thermal infrared modality, the first correlation matrix is multiplied by the value matrix of the infrared thermal image and then normalized to obtain the sixth feature, which means that the infrared thermal image features are refined by using the similarity between the modalities, the sixth feature is added to the token with position embedding of the infrared thermal image to obtain the seventh feature, which means that it is reprojected to the original space through nonlinear transformation and added to the input sequence through residual connection, the seventh feature is processed by the convolutional feedforward network to obtain the eighth feature, and the seventh feature is added to the eighth feature to obtain the cross-modal enhanced feature of the infrared thermal image, which means that the global information is further refined through the convolutional feedforward network to improve the robustness of the model.
[0106] A query matrix of the infrared thermal image is calculated according to the position-embedded token of the infrared thermal image, a key matrix of the visible light image and a value matrix of the visible light image are calculated according to the position-embedded token of the visible light image, a second correlation matrix of the key matrix of the visible light image and the query matrix of the infrared thermal image is established by using a dot product operation, the second correlation matrix is multiplied by the value matrix of the visible light image and then normalized to obtain a ninth feature, the ninth feature is added to the position-embedded token of the visible light image to obtain a tenth feature, the tenth feature is processed by using a convolutional feedforward network to obtain an eleventh feature, and the tenth feature is added to the eleventh feature to obtain a cross-modal enhanced feature of the visible light image.
[0107] Among them, the process of obtaining the cross-modal enhanced features of the visible light image is the same as the process of obtaining the cross-modal enhanced features of the infrared thermal image, which will not be repeated here.
[0108] Through this embodiment, the complementary information feature learning of visible light image features and infrared image features is achieved.
[0109] 206. Add the cross-modal enhanced features of the visible light image to the features of the visible light image to obtain a first addition result, add the cross-modal enhanced features of the infrared thermal image to the features of the infrared thermal image to obtain a second addition result, and perform feature aggregation on the first addition result and the second addition result to obtain target features of corresponding scales.
[0110] Through this embodiment, local feature aggregation is performed on the cross-modal enhanced features to obtain target features of corresponding scales, thereby further completing feature extraction of the multispectral image.
[0111] 207. Obtain a target feature pyramid of the multispectral image according to the target features at all scales.
[0112] The present invention provides a multispectral image feature extraction method, system and device. Through the technical solution of the present invention, multi-scale feature extraction is performed on visible light images and infrared thermal images respectively. On the one hand, the prior art only uses the CNN architecture for feature extraction, which is prone to global non-convergence. It only uses the Transformer architecture for feature extraction, which performs poorly in the representation of position information, and when the number of network layers is large, the gradient disappears easily. Therefore, compared with the prior art, the feature extraction of the present application has the beneficial effect of integrating the local features and global features of the image, so that more abundant information can be extracted in the feature extraction process of the multispectral image. On the other hand, since the multispectral image contains spectral bands of multiple bands and has richer spectral information and spatial information, the multi-scale feature extraction of the present application has the beneficial effect of extracting more abundant information in the feature extraction process of the multispectral image compared with the prior art that only uses single-scale feature extraction. The invention is suitable for scenarios where feature extraction is performed on multispectral images. Through the technical solution of the present invention, the visible light image features and the infrared thermal image features of the same scale are feature fused to obtain target features of the corresponding scale. Since the visible light image can provide the color, texture and contour of the target under good lighting conditions, and in low-illuminance scenes, it is difficult to distinguish the target details and edges from the visible light image background alone, while the infrared thermal image can still provide perceptible contour features due to its unique energy radiation imaging mechanism. Therefore, the present application utilizes the complementarity of visible light images and infrared thermal images. Specifically, the visible light image features and the infrared thermal image features of the same scale have an information complementary relationship. The present application performs feature fusion on the two to obtain target features. Compared with the prior art that only uses visible light image extraction features or infrared thermal image extraction features in multispectral images, the present application has the beneficial effect that richer information can be extracted in the feature extraction process of multispectral images.
[0113] In this embodiment, a multi-spectral image feature extraction system is provided. Figure 3 As shown, the system includes: an acquisition module, a convolution extraction module, a deep neural encoder, and a cross-attention fusion module;
[0114] Acquire a multispectral image to be extracted using the acquisition module, wherein the multispectral image includes a visible light image and an infrared thermal image;
[0115] The convolution extraction module and the deep neural encoder are used to perform multi-scale fusion local and global feature extraction on any one of the visible light image and the infrared thermal image. After the multi-scale fusion local and global feature extraction is performed on both images, the visible light image features and infrared thermal image features corresponding to each scale are obtained, wherein the convolution extraction module is used to extract the first feature of each token element in the visible light image or the infrared thermal image, the deep neural encoder is used to perform a first scale fusion global and local feature extraction on the first feature to obtain a feature extraction result of the first scale, and the deep neural encoder is used to perform a next scale fusion global and local feature extraction on the feature extraction result of the first scale until a feature extraction result of the last scale is obtained;
[0116] in, Figure 3 The four deep neural encoders are used as an example. The number of deep neural encoders is not limited here, and the internal structure of the deep neural encoders is the same. Figure 3 The input of the first deep neural encoder from left to right is the first feature, and the output is the feature extraction result of the first scale, that is, the image feature of the first scale. Figure 3 The input of the second deep neural encoder from left to right is the feature extraction result of the first scale, and the output is the feature extraction result of the second scale, that is, the image feature of the second scale. Figure 3 The input of the third deep neural encoder from left to right is the feature extraction result of the second scale, and the output is the feature extraction result of the third scale, that is, the image feature of the third scale. Figure 3 The input of the fourth deep neural encoder from left to right is the feature extraction result of the third scale, and the output is the feature extraction result of the fourth scale, and Figure 3 The feature extraction result of the fourth scale in is the feature extraction result of the last scale, and the feature extraction result of the last scale is the image feature of the fourth scale. If the first feature is obtained based on the visible light image, then the image feature is the visible light image feature. Similarly, if the first feature is obtained based on the infrared thermal image, then the image feature is the infrared thermal image feature.
[0117] The cross-attention fusion module is used to fuse the visible light image features and the infrared thermal image features of the same scale to obtain target features of the corresponding scale, and the target feature pyramid of the multispectral image is obtained according to the target features of all scales.
[0118] Among them, the number of cross-attention fusion modules is the same as the number of deep neural encoders. Figure 3 The number of cross-attention fusion modules shown is 4, Figure 3The first cross-attention fusion module from left to right fuses the visible light image features of the first scale with the infrared thermal image features of the first scale to obtain the target features of the first scale. Similarly, the target features of the second scale, the target features of the third scale, and the target features of the fourth scale are obtained. The target features of these four scales are the target feature pyramid of the multispectral image.
[0119] In the embodiments of the present application, Figure 4 As shown, the deep neural encoder includes: a convolution position embedding module, a first normalization processing module, a self-attention module, a second normalization processing module, and a convolution feedforward module;
[0120] The first deep neural encoder is taken as an example for explanation. The structures of all other deep neural encoders are the same as that of the first deep neural encoder, and will not be repeated here.
[0121] After performing deep convolution processing on the first feature using the convolution position embedding module, the second feature is added to the first feature to obtain a second feature that introduces feature position information;
[0122] in, Figure 4 The convolution position embedding module shown is a 3*3 depth convolution. Taking 3*3 as an example, it is not limited here. The zero-filling of the depth convolution of the convolution position embedding module learns the position information of any resolution and introduces the feature position information into all tokens.
[0123] Using the first normalization processing module to perform normalization processing on the second feature;
[0124] The self-attention module includes an interactive fusion module, a local information perception unit, a shallow self-attention unit, and a deep self-attention unit, such as Figure 5 , which is a schematic diagram of the structure of the self-attention module, specifically, obtaining a first initial key matrix, a first initial value matrix, and a first initial query matrix of the second feature after normalization;
[0125] Using the interactive fusion module of the self-attention module to perform token interactive fusion on the first initial key matrix and the first initial value matrix to obtain a first fused key matrix and a first fused value matrix;
[0126] Using the shallow self-attention unit of the self-attention module to model the global feature dependency relationship of the first fusion key matrix, the first fusion value matrix, and the first initial query matrix to obtain global features;
[0127] Among them, the shallow self-attention unit models the global feature dependency relationship of the first fusion key matrix, the first fusion value matrix and the first initial query matrix as follows:
[0128] Global feature = Concat(head0,head1,…,head h )W
[0129]
[0130] Among them, W is the weight matrix, head i is the output of the i-th attention head, Attention is the multi-head attention score, D represents the dimension of the input token, Q i is the first initial query matrix of the i-th attention head, K i is the first fusion bond matrix of the i-th attention head, V i is the first fusion value matrix of the i-th attention head.
[0131] Using the local information perception unit of the self-attention module and the deep self-attention unit of the self-attention module to perform a fine-grained feature extraction operation according to the global feature and the normalized second feature to obtain a local feature;
[0132] Among them, in order to enhance the ability to express local features of the image, the local information perception unit of the self-attention module is used to perform a feature splicing operation on the global feature and the second feature after normalization to obtain a splicing feature, a convolution operation is performed on the splicing feature, and a deep convolution operation is performed on the splicing feature after the convolution operation to obtain a fifth feature, and the fifth feature and the second feature after normalization are respectively convolved and added to obtain a local structural relationship feature, so that the deep self-attention unit of the self-attention module can learn the structural information and local relationship of each token;
[0133] Specifically, the local information perception unit includes two 1*1 convolutions and one 3*3 deep convolution. The local structural relationship feature = Conv(DWConv(Conv(splicing feature))+Conv(splicing feature)), Conv is a 1*1 convolution, and DWConv is a 3*3 deep convolution.
[0134] A convolution operation is performed after weighted summation of the local structural relationship feature and the global feature to obtain an intermediate feature; wherein the convolution operation can be a 1*1 convolution, which is not limited here.
[0135] The second initial key matrix, the second initial value matrix and the second initial query matrix of the intermediate feature are obtained, and the interactive fusion module of the self-attention module is used to perform token interactive fusion on the second initial key matrix and the second initial value matrix to obtain a second fused key matrix and a second fused value matrix; the deep self-attention unit of the self-attention module is used to calculate the multi-head attention score for the second fused key matrix, the second fused value matrix and the second initial query matrix, and the local features are calculated according to the multi-head attention score and the weight matrix, specifically:
[0136] Local features = Concat(head0,head1,…,head h )W
[0137]
[0138] Among them, W is the weight matrix, head i is the output of the i-th attention head, Attention is the multi-head attention score, D represents the dimension of the input token, Q i is the second initial query matrix of the i-th attention head, K o is the second fusion bond matrix of the i-th attention head, V i is the second fusion value matrix of the i-th attention head.
[0139] The global feature and the local feature are added to obtain a third feature having a global feature dependency relationship and a local feature representation, such as Figure 4 As shown, the output of the deep self-attention unit and the output of the self-attention module are both the third feature, the third feature is added to the second feature to obtain a fourth feature, and the fourth feature is normalized using the second normalization processing module;
[0140] The convolution feedforward module is used to perform feature enhancement on the fourth feature after normalization to obtain an enhanced feature, and the enhanced feature is added to the fourth feature to obtain a feature extraction result of the first scale corresponding to the visible light image or the infrared thermal image.
[0141] in, Figure 4 The convolution feed-forward module shown is two 1*1 convolutions, which are used to enhance the feature representation of each token. If the first feature is based on a visible light image, the feature extraction result of the first scale of the visible light image is obtained. If the first feature is based on an infrared thermal image, the feature extraction result of the first scale of the infrared thermal image is obtained.
[0142] The deep neural encoder of the present application achieves a balance between local features and global features during the feature extraction process. Specifically, global features are extracted using shallow attention units, and the outputs of local information perception units and shallow attention units are used as inputs of deep attention units to extract local features. Finally, enhanced fusion of global features and local features is performed, thereby improving feature resolution.
[0143] In the embodiments of the present application, Figure 6 As shown, the cross-attention fusion module includes a feature compression unit, a cross-modal feature enhancement unit for infrared thermal image features, a cross-modal feature enhancement unit for visible light images, and a feature aggregation unit;
[0144] The feature compression unit is used to perform feature compression on the visible light image feature and the infrared thermal image feature of the same scale, respectively, to obtain compressed features of the visible light image and compressed features of the infrared thermal image accordingly.
[0145] The compressed features of the visible light image and the compressed feature maps of the infrared thermal image are respectively flattened into a set of tokens and a learnable spatial position embedding is added, which is a trainable parameter with a dimension of H*W*C and is used to encode the spatial information between different tokens, thereby obtaining a token with position embedding of the visible light image and a token with position embedding of the infrared thermal image.
[0146] like Figure 6 As shown, two cross-modal feature enhancement units are used to perform cross-modal feature enhancement on infrared thermal image features and visible light image features respectively. No parameters are shared between the two cross-modal feature enhancement units, and the structures are the same, as shown in FIG. Figure 7 As shown, cross-modal feature enhancement of infrared thermal image features is taken as an example for explanation.
[0147] A cross-modal feature enhancement unit using infrared thermal image features calculates a query matrix of the visible light image according to the position-embedded tokens of the visible light image, calculates a key matrix of the infrared thermal image and a value matrix of the infrared thermal image according to the position-embedded tokens of the infrared thermal image, establishes a first correlation matrix between the key matrix of the infrared thermal image and the query matrix of the visible light image using a dot product operation unit, performs normalization processing on the multiplication of the first correlation matrix and the value matrix of the infrared thermal image using a third normalization processing unit to obtain a sixth feature, adds the sixth feature to the position-embedded tokens of the infrared thermal image to obtain a seventh feature, processes the seventh feature using a convolutional feedforward network to obtain an eighth feature, and adds the seventh feature to the eighth feature to obtain a cross-modal enhanced feature of the infrared thermal image.
[0148] The cross-modal feature enhancement of visible light image features is dual to the cross-modal feature enhancement of infrared thermal image features. The cross-modal feature enhancement of visible light image features is explained as follows:
[0149] A cross-modal feature enhancement unit using visible light image features calculates a query matrix of the infrared thermal image according to the position-embedded token of the infrared thermal image, calculates a key matrix of the visible light image and a value matrix of the visible light image according to the position-embedded token of the visible light image, establishes a second correlation matrix between the key matrix of the visible light image and the query matrix of the infrared thermal image by using a dot product operation, multiplies the second correlation matrix by the value matrix of the visible light image and performs normalization processing to obtain a ninth feature, adds the ninth feature to the position-embedded token of the visible light image to obtain a tenth feature, processes the tenth feature by using a convolutional feedforward network to obtain an eleventh feature, and adds the tenth feature to the eleventh feature to obtain a cross-modal enhanced feature of the visible light image.
[0150] A feature aggregation unit is used to add the cross-modal enhanced features of the visible light image to the features of the visible light image to obtain a first addition result, the cross-modal enhanced features of the infrared thermal image are added to the features of the infrared thermal image to obtain a second addition result, and feature aggregation is performed on the first addition result and the second addition result to obtain target features of corresponding scales.
[0151] Among them, the cross-attention fusion module can realize the complementary information feature learning of visible light image features and infrared image features. Specifically, the cross-modal feature enhancement unit of infrared thermal image features cross-enhances the key matrix and value matrix of infrared thermal images and the query matrix of visible light images, and realizes local feature aggregation through the feature aggregation unit, thereby completing the feature extraction of multispectral images and improving the robustness of the model in different illumination scenes.
[0152] Based on the above Figure 1 to Figure 2 The method shown in the embodiment of the present application accordingly provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned Figure 1 to Figure 2 The multispectral image feature extraction method shown.
[0153] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0154] Based on the above Figure 1 to Figure 2 In order to achieve the above purpose, the present application also provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above Figure 1 to Figure 2 The multispectral image feature extraction method shown.
[0155] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a WI-FI interface), etc.
[0156] Those skilled in the art will appreciate that the computer device structure provided in this embodiment does not limit the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0157] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages and saves the hardware and software resources of the computer device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to realize communication between the components inside the storage medium, and communication with other hardware and software in the physical device.
[0158] Through the description of the above implementation methods, technical personnel in this field can clearly understand that the present application performs multi-scale feature extraction on visible light images and infrared thermal images respectively. On the one hand, the prior art only uses the CNN architecture for feature extraction, which is prone to global non-convergence, and only uses the Transformer architecture for feature extraction, which performs poorly in terms of position information representation, and when the number of network layers is large, gradient disappearance is prone to occur. Therefore, compared with the prior art, the feature extraction of the present application has the beneficial effect of fusing the local features and global features of the image, so that richer information can be extracted in the feature extraction process of the multi-spectral image. On the other hand, since the multi-spectral image contains spectral bands of multiple bands and has richer spectral information and spatial information, the multi-scale feature extraction of the present application has the beneficial effect of extracting richer information in the feature extraction process of the multi-spectral image compared with the prior art which only uses single-scale feature extraction, and is suitable for A scenario in which feature extraction is performed on a multispectral image; through the technical solution of the present invention, the visible light image features and the infrared thermal image features of the same scale are feature fused to obtain target features of the corresponding scale. Since the visible light image can provide the color, texture and contour of the target under good lighting conditions, and in low-illuminance scenes, it is difficult to distinguish the target details and edges from the visible light image background alone, and the infrared thermal image can still provide perceptible contour features due to its unique energy radiation imaging mechanism, the present application utilizes the complementarity of visible light images and infrared thermal images. Specifically, the visible light image features and the infrared thermal image features of the same scale have an information complementary relationship. The present application performs feature fusion on the two to obtain target features. Compared with the prior art that only uses visible light image extraction features or infrared thermal image extraction features in multispectral images, the present application has the beneficial effect that richer information can be extracted in the feature extraction process of multispectral images.
[0159] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0160] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.
Claims
1. A multispectral image feature extraction method, characterized in that: The method comprises: Acquire a multispectral image to be extracted, wherein the multispectral image includes a visible light image and an infrared thermal image; Performing multi-scale fusion of local and global feature extraction on the visible light image and the infrared thermal image respectively to obtain visible light image features and infrared thermal image features corresponding to each scale, wherein the multi-scale fusion of local and global feature extraction includes: extracting the first feature of each token element in the visible light image or the infrared thermal image, performing a first scale fusion of global and local feature extraction on the first feature to obtain a feature extraction result of the first scale, performing a next scale fusion of global and local feature extraction on the feature extraction result of the first scale, until obtaining a feature extraction result of the last scale; Performing feature fusion on the visible light image features and the infrared thermal image features at the same scale to obtain target features at corresponding scales, and obtaining a target feature pyramid of the multispectral image based on the target features at all scales; The step of performing a first-scale fusion global and local feature extraction on the first feature to obtain a first-scale feature extraction result includes: After performing deep convolution processing on the first feature, the second feature is added to the first feature to obtain a second feature that introduces feature position information; performing normalization processing on the second feature; Obtaining a first initial key matrix, a first initial value matrix, and a first initial query matrix of the normalized second feature, performing token interaction fusion on the first initial key matrix and the first initial value matrix to obtain a first fused key matrix and a first fused value matrix, performing global feature dependency modeling on the first fused key matrix, the first fused value matrix, and the first initial query matrix to obtain global features, performing fine-grained feature extraction operations based on the global features and the normalized second features to obtain local features, adding the global features to the local features to obtain a third feature having a global feature dependency and a local feature representation, and adding the third feature to the second feature to obtain a fourth feature; Normalizing the fourth feature, enhancing the normalized fourth feature to obtain an enhanced feature, and adding the enhanced feature to the fourth feature to obtain a feature extraction result of the first scale corresponding to the visible light image or the infrared thermal image; The step of fusing the visible light image features and the infrared thermal image features of the same scale to obtain target features of the corresponding scale includes: Performing feature compression on the visible light image features and the infrared thermal image features of the same scale respectively, and obtaining compressed features of the visible light image and compressed features of the infrared thermal image accordingly; Planarizing the compressed features of the visible light image and the compressed feature maps of the infrared thermal image into a set of tokens and adding learnable spatial position embeddings, respectively, to obtain tokens with position embeddings of the visible light image and tokens with position embeddings of the infrared thermal image; Calculating the cross-modal enhanced features of the visible light image and the cross-modal enhanced features of the infrared thermal image according to the token with position embedding of the visible light image and the token with position embedding of the infrared thermal image; The cross-modal enhanced features of the visible light image are added to the features of the visible light image to obtain a first addition result, the cross-modal enhanced features of the infrared thermal image are added to the features of the infrared thermal image to obtain a second addition result, and feature aggregation is performed on the first addition result and the second addition result to obtain target features of corresponding scales.
2. The method according to claim 1, characterized in that The performing token interaction fusion on the first initial key matrix and the first initial value matrix to obtain a first fused key matrix and a first fused value matrix, and performing global feature dependency modeling on the first fused key matrix, the first fused value matrix, and the first initial query matrix to obtain global features, includes: Performing first depthwise convolution operations of different step lengths on the first initial key matrix and the first initial value matrix respectively to obtain a first matrix corresponding to the first initial key matrix and a second matrix corresponding to the first initial value matrix; After performing a second depthwise convolution operation with the same step length on the first matrix and the second matrix respectively, a first matrix to be fused and a second matrix to be fused are obtained correspondingly, the first matrix to be fused and the second matrix are added, a convolution operation is performed on the added matrix to obtain a first fusion key matrix, the second matrix to be fused and the first matrix are added, a convolution operation is performed on the added matrix to obtain a first fusion value matrix; A multi-head attention score is calculated according to the first fusion key matrix, the first fusion value matrix and the first initial query matrix, and a global feature is calculated according to the multi-head attention score and the weight matrix.
3. The method according to claim 1, characterized in that The performing a fine-grained feature extraction operation according to the global feature and the normalized second feature to obtain a local feature includes: After performing a feature splicing operation on the global feature and the second feature after the normalization processing, a splicing feature is obtained, a convolution operation is performed on the splicing feature, a deep convolution operation is performed on the splicing feature after the convolution operation, and a fifth feature is obtained, and the fifth feature and the second feature after the normalization processing are respectively convolved and then added to obtain a local structural relationship feature; Performing a convolution operation on the weighted sum of the local structural relationship feature and the global feature to obtain an intermediate feature; Obtain a second initial key matrix, a second initial value matrix, and a second initial query matrix of the intermediate features, and perform third depthwise convolution operations of different step lengths on the second initial key matrix and the second initial value matrix, respectively, to obtain a third matrix corresponding to the second initial key matrix and a fourth matrix corresponding to the second initial value matrix; After performing a fourth depthwise convolution operation with the same step length on the third matrix and the fourth matrix respectively, a third matrix to be fused and a fourth matrix to be fused are obtained correspondingly, the third matrix to be fused and the fourth matrix are added, a convolution operation is performed on the added matrix to obtain a second fusion key matrix, the fourth matrix to be fused and the third matrix are added, a convolution operation is performed on the added matrix to obtain a second fusion value matrix; A multi-head attention score is calculated according to the second fusion key matrix, the second fusion value matrix and the second initial query matrix, and a local feature is calculated according to the multi-head attention score and the weight matrix.
4. The method according to claim 1, characterized in that: The step of calculating the cross-modal enhanced features of the visible light image and the cross-modal enhanced features of the infrared thermal image according to the token with position embedding of the visible light image and the token with position embedding of the infrared thermal image comprises: Calculate the query matrix of the visible light image according to the token with position embedding of the visible light image, calculate the key matrix of the infrared thermal image and the value matrix of the infrared thermal image according to the token with position embedding of the infrared thermal image, establish a first correlation matrix between the key matrix of the infrared thermal image and the query matrix of the visible light image by using a dot product operation, multiply the first correlation matrix by the value matrix of the infrared thermal image and perform normalization processing to obtain a sixth feature, add the sixth feature to the token with position embedding of the infrared thermal image to obtain a seventh feature, process the seventh feature by using a convolutional feedforward network to obtain an eighth feature, and add the seventh feature to the eighth feature to obtain a cross-modal enhanced feature of the infrared thermal image; A query matrix of the infrared thermal image is calculated according to the position-embedded token of the infrared thermal image, a key matrix of the visible light image and a value matrix of the visible light image are calculated according to the position-embedded token of the visible light image, a second correlation matrix of the key matrix of the visible light image and the query matrix of the infrared thermal image is established by using a dot product operation, the second correlation matrix is multiplied by the value matrix of the visible light image and then normalized to obtain a ninth feature, the ninth feature is added to the position-embedded token of the visible light image to obtain a tenth feature, the tenth feature is processed by using a convolutional feedforward network to obtain an eleventh feature, and the tenth feature is added to the eleventh feature to obtain a cross-modal enhanced feature of the visible light image.
5. A multispectral image feature extraction system, characterized in that: The system includes: an acquisition module, a convolution extraction module, a deep neural encoder, and a cross attention fusion module; Acquire a multispectral image to be extracted using the acquisition module, wherein the multispectral image includes a visible light image and an infrared thermal image; The convolution extraction module and the deep neural encoder are used to perform multi-scale fusion local and global feature extraction on any one of the visible light image and the infrared thermal image. After the multi-scale fusion local and global feature extraction is performed on both images, the visible light image features and infrared thermal image features corresponding to each scale are obtained, wherein the convolution extraction module is used to extract the first feature of each token element in the visible light image or the infrared thermal image, the deep neural encoder is used to perform a first scale fusion global and local feature extraction on the first feature to obtain a feature extraction result of the first scale, and the deep neural encoder is used to perform a next scale fusion global and local feature extraction on the feature extraction result of the first scale until a feature extraction result of the last scale is obtained; Using the cross-attention fusion module to fuse the visible light image features and the infrared thermal image features at the same scale, to obtain target features at corresponding scales, and to obtain a target feature pyramid of the multispectral image based on the target features at all scales; The deep neural encoder includes: a convolution position embedding module, a first normalization processing module, a self-attention module, a second normalization processing module, and a convolution feedforward module. The self-attention module includes an interactive fusion module, a local information perception unit, a shallow self-attention unit, and a deep self-attention unit. After performing deep convolution processing on the first feature using the convolution position embedding module, the second feature is added to the first feature to obtain a second feature that introduces feature position information; Using the first normalization processing module to perform normalization processing on the second feature; Obtaining a first initial key matrix, a first initial value matrix, and a first initial query matrix of the second feature after normalization, and using the interactive fusion module of the self-attention module to perform token interactive fusion on the first initial key matrix and the first initial value matrix to obtain a first fused key matrix and a first fused value matrix; Using the shallow self-attention unit of the self-attention module to model the global feature dependency relationship of the first fusion key matrix, the first fusion value matrix, and the first initial query matrix to obtain global features; Using the local information perception unit of the self-attention module and the deep self-attention unit of the self-attention module to perform a fine-grained feature extraction operation according to the global feature and the normalized second feature to obtain a local feature; Adding the global feature to the local feature to obtain a third feature having a global feature dependency relationship and a local feature representation, adding the third feature to the second feature to obtain a fourth feature, and performing normalization processing on the fourth feature using the second normalization processing module; Using the convolution feedforward module to perform feature enhancement on the fourth feature after normalization to obtain an enhanced feature, and adding the enhanced feature to the fourth feature to obtain a feature extraction result of the first scale corresponding to the visible light image or the infrared thermal image; The cross-attention fusion module includes a feature compression unit, a cross-modal feature enhancement unit for infrared thermal image features, a cross-modal feature enhancement unit for visible light images, and a feature aggregation unit; Using the feature compression unit to perform feature compression on the visible light image feature and the infrared thermal image feature of the same scale, respectively, to obtain compressed features of the visible light image and compressed features of the infrared thermal image respectively; Planarizing the compressed features of the visible light image and the compressed feature maps of the infrared thermal image into a set of tokens and adding learnable spatial position embeddings, respectively, to obtain tokens with position embeddings of the visible light image and tokens with position embeddings of the infrared thermal image; The cross-modal feature enhancement unit of the infrared thermal image feature calculates the cross-modal enhanced feature of the infrared thermal image according to the position-embedded token of the visible light image and the position-embedded token of the infrared thermal image, and the cross-modal feature enhancement unit of the visible light image calculates the cross-modal enhanced feature of the visible light image according to the position-embedded token of the visible light image and the position-embedded token of the infrared thermal image; The feature aggregation unit is used to add the cross-modal enhanced features of the visible light image and the visible light image features to obtain a first addition result, the cross-modal enhanced features of the infrared thermal image and the infrared thermal image features are added to obtain a second addition result, and feature aggregation is performed on the first addition result and the second addition result to obtain target features of corresponding scales.
6. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the multispectral image feature extraction method according to any one of claims 1 to 4 is implemented.
7. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the multispectral image feature extraction method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Cross-modal pedestrian re-identification method based on modal imbalance feature conversion
CN118116035A
Infrared and visible light fusion method
US20220044374A1
