A frequency-adaptive cross-modal pedestrian retrieval method and device
By constructing a cross-modal frequency domain adaptive model, extracting high-frequency and low-frequency features and performing interactive processing, the problem of ignoring high-frequency and low-frequency information in the existing technology is solved, and the accuracy and feature representation of cross-modal pedestrian retrieval are improved. diversity.
Patent Information
- Application Number
- CN202411050923.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-08-01
AI Technical Summary
The existing technology ignores the local information of high-frequency channel features, the global information of low-frequency channel features, and the interactive effects between them, resulting in limited accuracy of cross-modal pedestrian retrieval.
Construct a cross-modal frequency domain adaptive model, including a feature extractor, frequency domain adaptive encoder and multi-branch embedding module, and extract high-frequency details and Low-frequency global information is generated, and more feature representations are generated through the multi-branch embedding module to improve feature diversity.
It improves the accuracy of cross-modal pedestrian retrieval and the diversity of feature representations, and enhances the model's learning ability and understanding of image content.
Smart Images

Figure CN118570845B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pedestrian retrieval, and in particular to a frequency-adaptive cross-modal pedestrian retrieval method and device. Background Art
[0002] With the rapid development of smart devices and sensor technology, multimodal smart devices are becoming increasingly popular in various application scenarios. Multimodal smart devices usually integrate multiple sensors, such as visible light cameras and infrared cameras, and can provide multiple types of data under different lighting, weather and environmental conditions. Visible light-infrared pedestrian re-identification uses multimodal smart devices to cross the visible light and infrared modes to achieve accurate identification and matching of pedestrians. Currently, this technology is widely used in security monitoring, night monitoring, intelligent transportation and other fields.
[0003] In the existing technology, DEEN (Diverse Embedding Network) is often used to complete the visible light-infrared pedestrian re-identification task. DEEN learns information-rich feature representations by generating diverse embeddings and reduces the modality differences between visible light (VIS) and infrared (IR) images.
[0004] Although DEEN has made significant progress in feature representation and reduction of modal differences, since DEEN mainly focuses on network feature extraction, it ignores the local information of high-frequency channel features, the global information of low-frequency channel features, and the interaction effects of high- and low-frequency features. As a result, the model's performance in multimodal data processing is limited, reducing the accuracy of cross-modal pedestrian retrieval. Summary of the invention
[0005] To this end, the technical problem to be solved by the present invention is to overcome the problem in the prior art that the local information of high-frequency channel features, the global information of low-frequency channel features and the interaction effects between them are ignored, resulting in limited accuracy of cross-modal pedestrian retrieval.
[0006] In order to solve the above technical problems, the present invention provides a frequency-adaptive cross-modal pedestrian retrieval method, comprising:
[0007] Constructing a cross-modal frequency domain adaptive model, including a feature extractor, a first frequency domain adaptive encoder, a second frequency domain adaptive encoder, a third frequency domain adaptive encoder and a multi-branch embedding module connected in sequence; the first frequency domain adaptive encoder, the second frequency domain adaptive encoder and the third frequency domain adaptive encoder each include a high and low frequency perception unit connected in sequence, a frequency domain self-attention mechanism and an extended channel residual block;
[0008] Multiple pairs of visible light images and infrared images containing pedestrians are input into the cross-modal frequency domain adaptive model, and multiple corresponding target visible light features and target infrared features are output, including:
[0009] The visible light image is input to the visible light feature extraction submodule of the feature extractor, and a visible light feature map is output; the infrared image is input to the infrared feature extraction submodule of the feature extractor, and an infrared feature map is output; the concatenated features of the visible light feature map and the infrared feature map are used as the output of the feature extractor;
[0010] The spliced feature is input to the high-low frequency perception unit of the first frequency domain adaptive encoder, and the first high-frequency feature is output after passing through the Resnet layer; the first high-frequency feature is input to the first depth-separable convolution, and the second high-frequency feature is output; the first high-frequency feature and the second high-frequency feature are added through the residual connection structure to obtain the target high-frequency feature; at the same time, the spliced feature is passed through the second depth-separable convolution of the high-low frequency perception unit to output the first low-frequency feature; the spliced feature and the first low-frequency feature are added through the residual connection structure to obtain the target low-frequency feature;
[0011] Inputting the target high-frequency features and the target low-frequency features into the frequency-domain self-attention mechanism of the first frequency-domain adaptive encoder to obtain output features of the frequency-domain self-attention mechanism;
[0012] Inputting the output features of the frequency domain self-attention mechanism into the extended channel residual block of the first frequency domain adaptive encoder to obtain the output features of the first frequency domain adaptive encoder; the extended channel residual block includes an extended layer, a third depth-separable convolution and a projection layer connected in sequence;
[0013] The output feature of the first frequency domain adaptive encoder is sequentially passed through the second frequency domain adaptive encoder and the third frequency domain adaptive encoder to obtain the output feature of the third frequency domain adaptive encoder;
[0014] Inputting the output features of the third frequency domain adaptive encoder into multiple embedding branches of the multi-branch embedding module respectively, concatenating the output features of each embedding branch with the output features of the third frequency domain adaptive encoder and applying Dropout regularization to obtain the output features of the multi-branch embedding module;
[0015] Separate the output features of the multi-branch embedding module into multiple target visible light features and target infrared features;
[0016] The cosine similarity between each target visible light feature and each target infrared feature is calculated, and the visible light image and infrared image corresponding to the target visible light feature and the target infrared feature are matched based on the cosine similarity.
[0017] Preferably, the visible light feature extraction submodule includes a visible light convolution layer, a normalization layer, a Relu activation function and a maximum pooling layer connected in sequence; the infrared feature extraction submodule includes an infrared convolution layer, a normalization layer, a Relu activation function and a maximum pooling layer connected in sequence.
[0018] Preferably, the first depth-wise separable convolution and the second depth-wise separable convolution are both 3×3 depth-wise separable convolutions.
[0019] Preferably, the target high-frequency feature and the target low-frequency feature are input into the frequency domain self-attention mechanism of the first frequency domain adaptive encoder to obtain the output feature of the frequency domain self-attention mechanism, including:
[0020] The target high-frequency features after layer normalization are used as the query matrix, and the target low-frequency features after layer normalization are used as the key matrix and value matrix to obtain the output features of the frequency domain self-attention mechanism. The formula is expressed as:
[0021] ;
[0022] in, represents the frequency domain self-attention mechanism, represents the query matrix, represents the key matrix, represents the value matrix, is the key matrix The transpose of represents the softmax function, Indicates the number of channels of the target low-frequency features after layer normalization.
[0023] Preferably, the step of inputting the output features of the frequency domain self-attention mechanism into the extended channel residual block of the first frequency domain adaptive encoder to obtain the output features of the first frequency domain adaptive encoder includes:
[0024] The output features of the frequency domain self-attention mechanism are input to the expansion layer. The output features of the expansion layer are activated and normalized before being input to the third depthwise separable convolution. The output features of the third depthwise separable convolution are activated and normalized, added to the input features of the third depthwise separable convolution through the residual connection structure, and then input to the projection layer to obtain the output features of the extended channel residual block. The specific formula is expressed as follows:
[0025] ;
[0026] ;
[0027] ;
[0028] ;
[0029] in, represents activation processing and normalization, represents the batch normalization operation, represents the GELU activation function; represents the input features of the extended channel residual block, Represents the extension layer, represents the output features of the expansion layer, represents the third depth-wise separable convolution, represents the output features of the third depth-wise separable convolution, Represents the projection layer, Represents the output features of the extended channel residual block.
[0030] Preferably, the expansion layer and the projection layer are both 1×1 convolutions, and the third depthwise separable convolution is a 3×3 depthwise separable convolution.
[0031] Preferably, the multi-branch embedding module includes multiple embedding branches, each embedding branch includes a downsampling layer, three 3×3 convolutional layers with different expansion rates and an upsampling layer; after the input features of each embedding branch pass through the downsampling layer, the GELU activation function is applied to activate the output features of the downsampling layer, and then they are respectively input into the three 3×3 convolutional layers with different expansion rates; the output features of the three 3×3 convolutional layers with different expansion rates are averaged and input into the upsampling layer, and the output features of the upsampling layer are the output features of each embedding branch.
[0032] Preferably, calculating the cosine similarity between each target visible light feature and each target infrared feature, and matching the visible light image and the infrared image corresponding to the target visible light feature and the target infrared feature based on the cosine similarity, comprises:
[0033] If the infrared image is queried based on the visible light image, then for each target visible light feature Construct a set of target visible light-target infrared signature pairs ,in is the total number of input visible light images and infrared images, Represents the jth target infrared feature, and calculates the target visible light-target infrared feature pair The infrared signature of each target Visible light characteristics of the target The cosine similarity of the target visible light-target infrared feature pair The target infrared feature and target visible light feature corresponding to the maximum cosine similarity in Matching is performed, and pedestrians in corresponding infrared images and visible light images are identified as the same pedestrian;
[0034] Similarly, if the visible light image is queried based on the infrared image, then for each target infrared feature Construct a set of target infrared-target visible light signature pairs , calculate the target infrared-target visible light feature pair The visible light characteristics of each target Target infrared signature The cosine similarity of the target infrared-target visible light feature pair The target visible light feature and target infrared feature corresponding to the maximum cosine similarity in Matching is performed and the pedestrians in the corresponding visible light image and infrared image are identified as the same pedestrian.
[0035] Preferably, when training the cross-modal frequency domain adaptive model, the loss function is a bidirectional similarity distance clustering loss, specifically including:
[0036] For each target visible light feature Construct a set of target visible light-target infrared signature pairs ,in is the clustering factor, which represents the total number of visible light-infrared image pairs extracted in one category during training. is the batch size for training; represents the infrared feature of the jth target; express When the label When is a positive sample pair; when When is a negative sample pair;
[0037] Calculate the target visible light-target infrared signature pair The infrared signature of each target Visible light characteristics of the target Cosine similarity of ;
[0038] Calculate the target visible light characteristics Target infrared signature The clustering probability is:
[0039] ;
[0040] in, Indicates the target visible light characteristics Target infrared signature The clustering probability, represents the temperature hyperparameter, which is used to control the probability distribution;
[0041] Calculate the similarity distance clustering loss from visible light image to infrared image, the formula is:
[0042] ;
[0043] ;
[0044] in, Represents the similarity distance clustering loss from visible light image to infrared image, represents the KL divergence, Indicates the target visible light characteristics Target infrared signature The clustering probability, Indicates the target visible light characteristics Target infrared signature The true label probability, is the clustering factor, is the batch size for training, represents a constant used to avoid gradient explosion;
[0045] The calculation method of the similarity distance clustering loss from infrared image to visible light image is the same as that of the similarity distance clustering loss from visible light image to infrared image. Construct a set of target infrared-target visible light signature pairs ; Calculate target infrared-target visible light feature pair The visible light characteristics of each target Target infrared signature Cosine similarity of and clustering probability , and then calculate the similarity distance clustering loss from the infrared image to the visible light image. The formula is:
[0046] ;
[0047] ;
[0048] in, Represents the similarity distance clustering loss from infrared images to visible light images, Indicates the target infrared signature Visible light characteristics of the target The true label probability of
[0049] The calculation formula of the bidirectional similarity distance clustering loss is:
[0050] ;
[0051] in, represents the bidirectional similarity distance clustering loss.
[0052] The present invention also provides a frequency-adaptive cross-modal pedestrian retrieval device, comprising:
[0053] A model construction module, for constructing a cross-modal frequency domain adaptive model, comprising a feature extractor, a first frequency domain adaptive encoder, a second frequency domain adaptive encoder, a third frequency domain adaptive encoder and a multi-branch embedding module connected in sequence; the first frequency domain adaptive encoder, the second frequency domain adaptive encoder and the third frequency domain adaptive encoder each comprise a high and low frequency perception unit, a frequency domain self-attention mechanism and an extended channel residual block connected in sequence;
[0054] The feature acquisition module is used to input multiple pairs of visible light images and infrared images containing pedestrians into the cross-modal frequency domain adaptive model, and output corresponding multiple target visible light features and target infrared features, including:
[0055] The visible light image is input to the visible light feature extraction submodule of the feature extractor, and a visible light feature map is output; the infrared image is input to the infrared feature extraction submodule of the feature extractor, and an infrared feature map is output; the concatenated features of the visible light feature map and the infrared feature map are used as the output of the feature extractor;
[0056] The spliced feature is input to the high-low frequency perception unit of the first frequency domain adaptive encoder, and the first high-frequency feature is output after passing through the Resnet layer; the first high-frequency feature is input to the first depth-separable convolution, and the second high-frequency feature is output; the first high-frequency feature and the second high-frequency feature are added through the residual connection structure to obtain the target high-frequency feature; at the same time, the spliced feature is passed through the second depth-separable convolution of the high-low frequency perception unit to output the first low-frequency feature; the spliced feature and the first low-frequency feature are added through the residual connection structure to obtain the target low-frequency feature;
[0057] Inputting the target high-frequency features and the target low-frequency features into the frequency-domain self-attention mechanism of the first frequency-domain adaptive encoder to obtain output features of the frequency-domain self-attention mechanism;
[0058] Inputting the output features of the frequency domain self-attention mechanism into the extended channel residual block of the first frequency domain adaptive encoder to obtain the output features of the first frequency domain adaptive encoder; the extended channel residual block includes an extended layer, a third depth-separable convolution and a projection layer connected in sequence;
[0059] The output feature of the first frequency domain adaptive encoder is sequentially passed through the second frequency domain adaptive encoder and the third frequency domain adaptive encoder to obtain the output feature of the third frequency domain adaptive encoder;
[0060] Inputting the output features of the third frequency domain adaptive encoder into multiple embedding branches of the multi-branch embedding module respectively, concatenating the output features of each embedding branch with the output features of the third frequency domain adaptive encoder and applying Dropout regularization to obtain the output features of the multi-branch embedding module;
[0061] Separate the output features of the multi-branch embedding module into multiple target visible light features and target infrared features;
[0062] The image matching module is used to calculate the cosine similarity between each target visible light feature and each target infrared feature, and match the visible light image and infrared image corresponding to the target visible light feature and the target infrared feature based on the cosine similarity.
[0063] The above technical solution of the present invention has the following beneficial effects compared with the prior art:
[0064] The frequency-adaptive cross-modal pedestrian retrieval method described in the present invention matches visible light images and infrared images containing pedestrians by constructing a cross-modal frequency domain adaptive model. The high- and low-frequency perception units in the cross-modal frequency domain adaptive model can extract high-frequency detail information and low-frequency global information, which not only enhances the diversity and richness of features, but also effectively reduces the computational complexity by adopting the deep separable convolution. The frequency domain self-attention mechanism uses high-frequency features as query matrices and low-frequency features as key matrices and value matrices, which can retain the structural features of the image during the interaction between high-frequency information and low-frequency information. The multi-branch embedding module can generate more feature embedding representations to enhance the learning of the model and improve the diversity of feature representations. Therefore, the present invention fully considers the high- and low-frequency features between visible light images and infrared images, and improves the accuracy of cross-modal pedestrian retrieval. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:
[0066] Figure 1 is a flow chart of a frequency-adaptive cross-modal pedestrian retrieval method of the present invention;
[0067] Figure 2 It is a structural diagram of the cross-modal frequency domain adaptive model constructed by the present invention;
[0068] Figure 3 It is a structural comparison diagram of the inverted residual block and the extended channel residual block, where Figure 3 (a) in the figure is the structural diagram of the inverted residual block. Figure 3 (b) is the structural diagram of the extended channel residual block;
[0069] Figure 4 This is the effect diagram of the cross-modal frequency domain adaptive model extracting the target visible light features and target infrared features. DETAILED DESCRIPTION
[0070] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0071] Reference Figure 1 As shown, the present invention provides a frequency-adaptive cross-modal pedestrian retrieval method, which can effectively process high- and low-frequency features by constructing a cross-modal frequency domain adaptive model. The specific steps include:
[0072] S1. Construct a cross-modal frequency domain adaptive model;
[0073] S2, inputting multiple pairs of visible light images and infrared images containing pedestrians into the cross-modal frequency domain adaptive model, and outputting corresponding multiple target visible light features and target infrared features;
[0074] S3. Calculate the cosine similarity between each target visible light feature and each target infrared feature, and match the visible light image and infrared image corresponding to the target visible light feature and the target infrared feature based on the cosine similarity.
[0075] The structure of the cross-modal frequency domain adaptive model is introduced in detail below.
[0076] The structure diagram of the cross-modal frequency domain adaptive model is shown in Figure 2 As shown, it includes a feature extractor, a first frequency domain adaptive encoder, a second frequency domain adaptive encoder, a third frequency domain adaptive encoder and a multi-branch embedding module connected in sequence.
[0077] The feature extractor includes a visible light feature extraction submodule and an infrared feature extraction submodule. The visible light feature extraction submodule includes a visible light convolution layer, a normalization layer, a Relu activation function and a maximum pooling layer connected in sequence. The infrared feature extraction submodule includes an infrared convolution layer, a normalization layer, a Relu activation function and a maximum pooling layer connected in sequence.
[0078] Multiple pairs of visible light images and infrared images containing pedestrians are input into the cross-modal frequency domain adaptive model. First, the feature extractor extracts features from the visible light image and the infrared image respectively. The visible light image outputs a visible light feature map after passing through the visible light feature extraction submodule, and the infrared image outputs an infrared feature map after passing through the infrared feature extraction submodule. The concatenated features of the visible light feature map and the infrared feature map are used as the output of the feature extractor and input into the first frequency domain adaptive encoder.
[0079] The first frequency domain adaptive encoder includes a high and low frequency perception unit, a frequency domain self-attention mechanism and an extended channel residual block connected in sequence.
[0080] The high and low frequency perception unit includes a Resnet layer, a first depth-separable convolution, a second depth-separable convolution and a residual connection structure.
[0081] The Resnet layer is used to extract high-frequency channel features, achieve more refined feature fusion and improve the information processing capability of the model, so that the cross-modal frequency domain adaptive model can learn richer and more abstract feature representations, which helps to improve the expressive power of the model and the effect of feature extraction.
[0082] The concatenated features are input to the high- and low-frequency perception unit, and the number of channels increases after passing through the Resnet layer, and the first high-frequency features are output; the first high-frequency features are input to the first depth-separable convolution, and the second high-frequency features are output; the first high-frequency features and the second high-frequency features are added through the residual connection structure to obtain the target high-frequency features. At the same time, the concatenated features are passed through the second depth-separable convolution, and the first low-frequency features are output; the concatenated features and the first low-frequency features are added through the residual connection structure to obtain the target low-frequency features.
[0083] Preferably, the first depth-wise separable convolution and the second depth-wise separable convolution are both 3×3 depth-wise separable convolutions.
[0084] The number of channels of the spliced features changes after passing through the Resnet layer. Existing methods often ignore the value brought by the changes in the channels before and after the features, as well as the important information between the high channel and the low channel, which may cause the model to be unable to fully utilize the high-frequency and low-frequency information when processing images, thereby reducing the model's ability to understand and express the image content. Therefore, the high- and low-frequency perception units constructed by the present invention use 3x3 depth-separable convolutions. This convolution method can effectively extract high-frequency details and low-frequency global information, and enhance the diversity and richness of feature representation. And the depth-separable convolution reduces the computational complexity by independently applying the convolution kernel in each channel, while retaining important spatial information for the subsequent frequency domain self-attention mechanism.
[0085] The target high-frequency features and target low-frequency features are respectively normalized by layers and input into the frequency domain self-attention mechanism.
[0086] In the traditional Transformer model, the query matrix, key matrix and value matrix in the attention mechanism are usually derived from the same feature, or the same feature is obtained after linear transformation. The frequency domain adaptive encoder constructed by the present invention uses the target high-frequency features after layer normalization as the query matrix, and the target low-frequency features after layer normalization as the key matrix and value matrix, and the formula is expressed as:
[0087] ;
[0088] in, represents the frequency domain self-attention mechanism, represents the query matrix, represents the key matrix, represents the value matrix, is the key matrix The transpose of represents the softmax function, Indicates the number of channels of the target low-frequency features after layer normalization.
[0089] The frequency domain self-attention mechanism constructed by the present invention reduces the computational complexity on the one hand, and can better capture the frequency domain information and local structural features of the image on the other hand, so that the model can make a more effective trade-off between high-frequency information and low-frequency information, that is, achieve better results in capturing details and understanding the global structure.
[0090] The output features of the frequency domain self-attention mechanism are normalized by layers and then input into the extended channel residual block as the input features.
[0091] Inspired by the inverted residual connection structure in MobileNetV2, this paper constructs an extended channel residual block. Figure 3 As shown, Figure 3 (a) in the figure is the structural diagram of the inverted residual block. Figure 3 (b) in the figure is the structural diagram of the extended channel residual block.
[0092] The extended channel residual block includes an extended layer, a third depth-separable convolution and a projection layer connected in sequence, and adds the input features and output features of the third depth-separable convolution together through a residual connection structure, helping to better retain and transmit the information after the expanded dimension in the deep layer of the network.
[0093] The output features of the frequency domain self-attention mechanism are input to the expansion layer, the output features of the expansion layer are activated and normalized, and then input to the third depth-separable convolution, the output features of the third depth-separable convolution are activated and normalized, added to the input features of the third depth-separable convolution through the residual connection structure, and then input to the projection layer to obtain the output features of the expansion channel residual block. The activation processing and normalization make the representation of the output features more stable and the training process more efficient.
[0094] Preferably, the extended channel residual block uses the GELU activation function to replace the ReLU6 activation function in the inverted residual block, thereby improving the nonlinear expression ability of the model.
[0095] The formula of the extended channel residual block is expressed as:
[0096] ;
[0097] ;
[0098] ;
[0099] ;
[0100] in, represents activation processing and normalization, represents the batch normalization operation, represents the GELU activation function; represents the input features of the extended channel residual block, Represents the extension layer, represents the output features of the expansion layer, represents the third depth-wise separable convolution, represents the output features of the third depth-wise separable convolution, Represents the projection layer, Represents the output features of the extended channel residual block.
[0101] Preferably, the expansion layer and the projection layer are both 1×1 convolutions, and the third depthwise separable convolution is a 3×3 depthwise separable convolution.
[0102] The output feature of the extended channel residual block is the output feature of the first frequency domain adaptive encoder. The output feature of the first frequency domain adaptive encoder is used as the input feature of the second frequency domain adaptive encoder, and the output feature of the second frequency domain adaptive encoder is used as the input feature of the third frequency domain adaptive encoder to obtain the output feature of the third frequency domain adaptive encoder.
[0103] The structures of the second frequency domain adaptive encoder, the third frequency domain adaptive encoder and the first frequency domain adaptive encoder are the same, and thus will not be described in detail.
[0104] The multi-branch embedding module includes multiple embedding branches for generating different embeddings, and the feature information of the generated embeddings is used as positive samples to assist training to further mine diverse cross-modal clues.
[0105] Each embedding branch includes a downsampling layer, three 3×3 convolutional layers with different dilation rates, and an upsampling layer.
[0106] The output features of the third frequency domain adaptive encoder are used as the input features of the multi-branch embedding module and are input to multiple embedding branches respectively. After the input features of each embedding branch pass through the downsampling layer, the GELU activation function is applied to activate the output features of the downsampling layer, and then they are input to three 3×3 convolutional layers with different expansion rates to capture features of different scales. Finally, the output features of the three 3×3 convolutional layers with different expansion rates are averaged and input to the upsampling layer. The output features of the upsampling layer are the output features of each embedding branch.
[0107] The output features of each embedding branch are concatenated with the input features of the multi-branch embedding module in the dimension of the batch size, and Dropout regularization is applied to obtain the output features of the multi-branch embedding module.
[0108] The formula of the multi-branch embedding module is expressed as:
[0109] ;
[0110] ;
[0111] ;
[0112] ;
[0113] in, represents the input features of the multi-branch embedding module, represents the downsampling layer of the nth embedding branch, represents the GELU activation function, represents the mth 3×3 convolutional layer in the nth embedding branch, represents the output features of the mth 3×3 convolutional layer in the nth embedding branch, represents the upsampling layer of the nth embedding branch, represents the output feature of the nth embedding branch, Represents a splicing operation, represents Dropout regularization, Represents the output features of the multi-branch embedding module.
[0114] The output features of the multi-branch embedding module are separated into multiple target visible light features and target infrared features.
[0115] Specifically, in S3, the cosine similarity between each target visible light feature and each target infrared feature is calculated, and the visible light image and the infrared image corresponding to the target visible light feature and the target infrared feature are matched based on the cosine similarity, including:
[0116] If the infrared image is queried based on the visible light image, then for each target visible light feature Construct a set of target visible light-target infrared signature pairs ,in is the total number of input visible light images and infrared images, represents the infrared signature of the jth target.
[0117] Calculate the target visible light-target infrared signature pair The infrared signature of each target Visible light characteristics of the target The cosine similarity of is:
[0118] ;
[0119] in, Visible light characteristics of the target Target infrared signature The cosine similarity of .
[0120] Target visible light-target infrared signature The target infrared feature and target visible light feature corresponding to the maximum cosine similarity in Matching is performed and the pedestrians in the corresponding infrared image and visible light image are identified as the same pedestrian.
[0121] Similarly, if the visible light image is queried based on the infrared image, then for each target infrared feature Construct a set of target infrared-target visible light signature pairs , calculate the target infrared-target visible light feature pair The visible light characteristics of each target Target infrared signature The cosine similarity of the target infrared-target visible light feature pair The target visible light feature and target infrared feature corresponding to the maximum cosine similarity in Matching is performed and the pedestrians in the corresponding visible light image and infrared image are identified as the same pedestrian.
[0122] Preferably, this embodiment adopts a similarity distance clustering strategy to train the cross-modal frequency domain adaptive model, and the loss function is a bidirectional similarity distance clustering loss, including the similarity distance clustering loss from visible light images to infrared images and the similarity distance clustering loss from infrared images to visible light images, which is described in detail below.
[0123] The calculation method of the similarity distance clustering loss from the visible light image to the infrared image includes:
[0124] After separating the output features of the multi-branch embedding module into multiple target visible light features and target infrared features, Construct a set of target visible light-target infrared signature pairs ,in is the clustering factor, which represents the total number of visible light images and infrared images extracted in one category during training. is the batch size for training; represents the infrared feature of the jth target; express When the label When is a positive sample pair, that is, it is matched to the same person; when When is a negative sample pair, that is, it does not match the same person.
[0125] Calculate the target visible light-target infrared signature pair The infrared signature of each target Visible light characteristics of the target Cosine similarity of .
[0126] Based on cosine similarity Calculate the clustering probability, the formula is:
[0127] ;
[0128] in, Indicates the target visible light characteristics Target infrared signature The clustering probability, represents the temperature hyperparameter, which is used to control the probability distribution. Can be regarded as the target visible light signature Target infrared signature Cosine similarity between the target and the visible light feature and all target infrared signatures The ratio of the sum of cosine similarities between them.
[0129] The calculation formula of the similarity distance clustering loss from visible light image to infrared image is:
[0130] ;
[0131] ;
[0132] in, Represents the similarity distance clustering loss from visible light image to infrared image, represents the KL divergence, Indicates the target visible light characteristics Target infrared signature The true label probability, Represents a constant used to avoid exploding gradients.
[0133] The calculation method of the similarity distance clustering loss from infrared image to visible light image is the same as that of the similarity distance clustering loss from visible light image to infrared image. Construct a set of target infrared-target visible light signature pairs . Calculate the target infrared-target visible light signature pair The visible light characteristics of each target Target infrared signature Cosine similarity of and clustering probability , and then calculate the similarity distance clustering loss from the infrared image to the visible light image. The formula is:
[0134] ;
[0135] ;
[0136] in, Represents the similarity distance clustering loss from infrared images to visible light images, Indicates the target infrared signature Visible light characteristics of the target The true label probability.
[0137] Bidirectional similarity distance clustering loss The calculation formula is:
[0138] ;
[0139] The similarity distance clustering strategy directly minimizes the KL divergence of the similarity distribution and the normalized label clustering distribution between the infrared image and the visible light image, which can effectively narrow the gap between the modalities.
[0140] The cross-modal frequency domain adaptive model constructed by the present invention can effectively map infrared images and visible light images into the same latent space, obtain the target visible light features and target infrared features, and then complete the task of pedestrian retrieval in the latent space. The effect diagram of the cross-modal frequency domain adaptive model extracting the target visible light features and target infrared features is shown in the figure. Figure 4 As shown, the first line is a visible light image, the second line is a target visible light image corresponding to the visible light image, the fourth line is an infrared image, and the third line is a target infrared feature corresponding to the infrared image.
[0141] In order to further verify the effect of the frequency-adaptive cross-modal pedestrian retrieval method proposed in the present invention, this embodiment extensively evaluates the method on two challenging infrared and visible light person retrieval datasets, namely the RegDB dataset and the SYSU-MM01 dataset. At the same time, this embodiment uses the popular Rank-k index (k=1,10,20) as the main evaluation index.
[0142] Rank-k reports the probability of finding at least one corresponding infrared person image in the top-k candidate list when a visible light image is given as a query. For the RegDB, dataset, a query from infrared image to visible light image is also used. In addition, in order to conduct a comprehensive evaluation, this embodiment also uses mean average precision (mAP) as another retrieval criterion. The higher the Rank-k and mAP, the better the performance of the model. The cross-modal frequency domain adaptive model constructed by the present invention achieves state-of-the-art performance on the RegDB dataset. Specifically, for the retrieval method from visible light image to infrared image, the cross-modal frequency domain adaptive model achieves 94.51% Rank-1 accuracy, 99.51% Rank-20 accuracy and 87.80% mAP. For the retrieval method from infrared image to visible light image, the cross-modal frequency domain adaptive model achieves 94.56% Rank-1 accuracy, 99.32% Rank-20 accuracy and 88.1% mAP. For the SYSU-MM01 dataset, the cross-modal frequency domain adaptive model achieved a Rank-1 accuracy of 72.55% and a Rank-20 accuracy of 98.50% in the global search mode. In the indoor search mode, the cross-modal frequency domain adaptive model achieved a Rank-1 accuracy of 79.89%, a Rank-20 accuracy of 99.64% and a mAP of 82.65%.
[0143] In summary, the frequency-adaptive cross-modal pedestrian retrieval method proposed in the present invention matches visible light images and infrared images containing pedestrians by constructing a cross-modal frequency domain adaptive model. The high- and low-frequency perception units in the cross-modal frequency domain adaptive model can extract high-frequency detail information and low-frequency global information, which not only enhances the diversity and richness of features, but also effectively reduces the computational complexity by adopting the deep separable convolution. The frequency domain self-attention mechanism uses high-frequency features as query matrices and low-frequency features as key matrices and value matrices, which can retain the structural features of the image during the interaction between high-frequency information and low-frequency information. The multi-branch embedding module can not only generate more feature embedding representations to enhance the learning of the model, but also adopts a method that significantly reduces the computational cost and improves the diversity of feature representation. Therefore, the present invention fully considers the high- and low-frequency features between visible light images and infrared images, and improves the accuracy of cross-modal pedestrian retrieval.
[0144] Based on a frequency-adaptive cross-modal pedestrian retrieval method proposed in the present invention, this embodiment further provides a frequency-adaptive cross-modal pedestrian retrieval device, including:
[0145] A model construction module, for constructing a cross-modal frequency domain adaptive model, comprising a feature extractor, a first frequency domain adaptive encoder, a second frequency domain adaptive encoder, a third frequency domain adaptive encoder and a multi-branch embedding module connected in sequence; the first frequency domain adaptive encoder, the second frequency domain adaptive encoder and the third frequency domain adaptive encoder each comprise a high and low frequency perception unit, a frequency domain self-attention mechanism and an extended channel residual block connected in sequence;
[0146] The feature acquisition module is used to input multiple pairs of visible light images and infrared images containing pedestrians into the cross-modal frequency domain adaptive model, and output corresponding multiple target visible light features and target infrared features, including:
[0147] The visible light image is input to the visible light feature extraction submodule of the feature extractor, and a visible light feature map is output; the infrared image is input to the infrared feature extraction submodule of the feature extractor, and an infrared feature map is output; the concatenated features of the visible light feature map and the infrared feature map are used as the output of the feature extractor;
[0148] The spliced feature is input to the high-low frequency perception unit of the first frequency domain adaptive encoder, and the first high-frequency feature is output after passing through the Resnet layer; the first high-frequency feature is input to the first depth-separable convolution, and the second high-frequency feature is output; the first high-frequency feature and the second high-frequency feature are added through the residual connection structure to obtain the target high-frequency feature; at the same time, the spliced feature is passed through the second depth-separable convolution of the high-low frequency perception unit to output the first low-frequency feature; the spliced feature and the first low-frequency feature are added through the residual connection structure to obtain the target low-frequency feature;
[0149] Inputting the target high-frequency features and the target low-frequency features into the frequency-domain self-attention mechanism of the first frequency-domain adaptive encoder to obtain output features of the frequency-domain self-attention mechanism;
[0150] Inputting the output features of the frequency domain self-attention mechanism into the extended channel residual block of the first frequency domain adaptive encoder to obtain the output features of the first frequency domain adaptive encoder; the extended channel residual block includes an extended layer, a third depth-separable convolution and a projection layer connected in sequence;
[0151] The output feature of the first frequency domain adaptive encoder is sequentially passed through the second frequency domain adaptive encoder and the third frequency domain adaptive encoder to obtain the output feature of the third frequency domain adaptive encoder;
[0152] Inputting the output features of the third frequency domain adaptive encoder into multiple embedding branches of the multi-branch embedding module respectively, concatenating the output features of each embedding branch with the output features of the third frequency domain adaptive encoder and applying Dropout regularization to obtain the output features of the multi-branch embedding module;
[0153] Separate the output features of the multi-branch embedding module into multiple target visible light features and target infrared features;
[0154] The image matching module is used to calculate the cosine similarity between each target visible light feature and each target infrared feature, and match the visible light image and infrared image corresponding to the target visible light feature and the target infrared feature based on the cosine similarity.
[0155] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0156] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0157] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0158] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0159] Obviously, the above embodiments are merely examples for the purpose of clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.
Claims
1. A frequency-adaptive cross-modal pedestrian retrieval method, characterized in that: include: Constructing a cross-modal frequency domain adaptive model, including a feature extractor, a first frequency domain adaptive encoder, a second frequency domain adaptive encoder, a third frequency domain adaptive encoder and a multi-branch embedding module connected in sequence; the first frequency domain adaptive encoder, the second frequency domain adaptive encoder and the third frequency domain adaptive encoder each include a high and low frequency perception unit connected in sequence, a frequency domain self-attention mechanism and an extended channel residual block; Multiple pairs of visible light images and infrared images containing pedestrians are input into the cross-modal frequency domain adaptive model, and multiple corresponding target visible light features and target infrared features are output, including: The visible light image is input to the visible light feature extraction submodule of the feature extractor, and a visible light feature map is output; the infrared image is input to the infrared feature extraction submodule of the feature extractor, and an infrared feature map is output; the concatenated features of the visible light feature map and the infrared feature map are used as the output of the feature extractor; The spliced feature is input to the high-low frequency perception unit of the first frequency domain adaptive encoder, and the first high-frequency feature is output after passing through the Resnet layer; the first high-frequency feature is input to the first depth-separable convolution, and the second high-frequency feature is output; the first high-frequency feature and the second high-frequency feature are added through the residual connection structure to obtain the target high-frequency feature; at the same time, the spliced feature is passed through the second depth-separable convolution of the high-low frequency perception unit to output the first low-frequency feature; the spliced feature and the first low-frequency feature are added through the residual connection structure to obtain the target low-frequency feature; Inputting the target high-frequency features and the target low-frequency features into the frequency-domain self-attention mechanism of the first frequency-domain adaptive encoder to obtain output features of the frequency-domain self-attention mechanism; Inputting the output features of the frequency domain self-attention mechanism into the extended channel residual block of the first frequency domain adaptive encoder to obtain the output features of the first frequency domain adaptive encoder; the extended channel residual block includes an extended layer, a third depth-separable convolution and a projection layer connected in sequence; The output feature of the first frequency domain adaptive encoder is sequentially passed through the second frequency domain adaptive encoder and the third frequency domain adaptive encoder to obtain the output feature of the third frequency domain adaptive encoder; Inputting the output features of the third frequency domain adaptive encoder into multiple embedding branches of the multi-branch embedding module respectively, concatenating the output features of each embedding branch with the output features of the third frequency domain adaptive encoder and applying Dropout regularization to obtain the output features of the multi-branch embedding module; Separate the output features of the multi-branch embedding module into multiple target visible light features and target infrared features; The cosine similarity between each target visible light feature and each target infrared feature is calculated, and the visible light image and infrared image corresponding to the target visible light feature and the target infrared feature are matched based on the cosine similarity.
2. A frequency-adaptive cross-modal pedestrian retrieval method according to claim 1, characterized in that: The visible light feature extraction submodule includes a visible light convolution layer, a normalization layer, a Relu activation function and a maximum pooling layer connected in sequence; the infrared feature extraction submodule includes an infrared convolution layer, a normalization layer, a Relu activation function and a maximum pooling layer connected in sequence.
3. The frequency-adaptive cross-modal pedestrian retrieval method according to claim 1, characterized in that: The first depth-wise separable convolution and the second depth-wise separable convolution are both 3×3 depth-wise separable convolutions.
4. The frequency-adaptive cross-modal pedestrian retrieval method according to claim 1, characterized in that: The target high-frequency features and the target low-frequency features are input into the frequency domain self-attention mechanism of the first frequency domain adaptive encoder to obtain the output features of the frequency domain self-attention mechanism, including: The target high-frequency features after layer normalization are used as the query matrix, and the target low-frequency features after layer normalization are used as the key matrix and value matrix to obtain the output features of the frequency domain self-attention mechanism. The formula is expressed as: ; in, represents the frequency domain self-attention mechanism, represents the query matrix, represents the key matrix, represents the value matrix, is the key matrix The transpose of represents the softmax function, Indicates the number of channels of the target low-frequency features after layer normalization.
5. The frequency-adaptive cross-modal pedestrian retrieval method according to claim 1, characterized in that: The step of inputting the output features of the frequency domain self-attention mechanism into the extended channel residual block of the first frequency domain adaptive encoder to obtain the output features of the first frequency domain adaptive encoder includes: The output features of the frequency domain self-attention mechanism are input to the expansion layer. The output features of the expansion layer are activated and normalized before being input to the third depthwise separable convolution. The output features of the third depthwise separable convolution are activated and normalized, added to the input features of the third depthwise separable convolution through the residual connection structure, and then input to the projection layer to obtain the output features of the extended channel residual block. The specific formula is expressed as follows: ; ; ; ; in, represents activation processing and normalization, represents the batch normalization operation, represents the GELU activation function; represents the input features of the extended channel residual block, Represents the extension layer, represents the output features of the expansion layer, represents the third depth-wise separable convolution, represents the output features of the third depth-wise separable convolution, Represents the projection layer, Represents the output features of the extended channel residual block.
6. A frequency-adaptive cross-modal pedestrian retrieval method according to claim 5, characterized in that: The expansion layer and the projection layer are both 1×1 convolutions, and the third depthwise separable convolution is a 3×3 depthwise separable convolution.
7. The frequency-adaptive cross-modal pedestrian retrieval method according to claim 1, characterized in that: The multi-branch embedding module includes multiple embedding branches, each embedding branch includes a downsampling layer, three 3×3 convolutional layers with different expansion rates and an upsampling layer; after the input features of each embedding branch pass through the downsampling layer, the GELU activation function is applied to activate the output features of the downsampling layer, and then they are respectively input into the three 3×3 convolutional layers with different expansion rates; the output features of the three 3×3 convolutional layers with different expansion rates are averaged and input into the upsampling layer, and the output features of the upsampling layer are the output features of each embedding branch.
8. The frequency-adaptive cross-modal pedestrian retrieval method according to claim 1, characterized in that: Calculate the cosine similarity between each target visible light feature and each target infrared feature, and match the visible light image and infrared image corresponding to the target visible light feature and the target infrared feature based on the cosine similarity, including: If the infrared image is queried based on the visible light image, then for each target visible light feature Construct a set of target visible light-target infrared signature pairs ,in is the total number of input visible light images and infrared images, Represents the jth target infrared feature, and calculates the target visible light-target infrared feature pair The infrared signature of each target Visible light characteristics of the target The cosine similarity of the target visible light-target infrared feature pair The target infrared feature and target visible light feature corresponding to the maximum cosine similarity in Matching is performed, and pedestrians in corresponding infrared images and visible light images are identified as the same pedestrian; Similarly, if the visible light image is queried based on the infrared image, then for each target infrared feature Construct a set of target infrared-target visible light signature pairs , calculate the target infrared-target visible light feature pair The visible light characteristics of each target Target infrared signature The cosine similarity of the target infrared-target visible light feature pair The target visible light feature and target infrared feature corresponding to the maximum cosine similarity in Matching is performed and the pedestrians in the corresponding visible light image and infrared image are identified as the same pedestrian.
9. The frequency-adaptive cross-modal pedestrian retrieval method according to claim 1, characterized in that: When training the cross-modal frequency domain adaptive model, the loss function is a bidirectional similarity distance clustering loss, specifically including: For each target visible light feature Construct a set of target visible light-target infrared signature pairs ,in is the clustering factor, which indicates the total number of visible light-infrared image pairs extracted in one category during training. is the batch size for training; represents the infrared feature of the jth target; express When the label When is a positive sample pair; when When is a negative sample pair; Calculate the target visible light-target infrared signature pair The infrared signature of each target Visible light characteristics of the target Cosine similarity of ; Calculate the target visible light characteristics Target infrared signature The clustering probability is: ; in, Indicates the target visible light characteristics Target infrared signature The clustering probability, represents the temperature hyperparameter, which is used to control the probability distribution; Calculate the similarity distance clustering loss from visible light image to infrared image, the formula is: ; ; in, Represents the similarity distance clustering loss from visible light image to infrared image, represents the KL divergence, Indicates the target visible light characteristics Target infrared signature The clustering probability, Indicates the target visible light characteristics Target infrared signature The true label probability, is the clustering factor, is the batch size for training, represents a constant used to avoid gradient explosion; The calculation method of the similarity distance clustering loss from infrared image to visible light image is the same as that of the similarity distance clustering loss from visible light image to infrared image. Construct a set of target infrared-target visible light signature pairs ; Calculate target infrared-target visible light feature pair The visible light characteristics of each target Target infrared signature Cosine similarity of and clustering probability , and then calculate the similarity distance clustering loss from the infrared image to the visible light image. The formula is: ; ; in, Represents the similarity distance clustering loss from infrared images to visible light images, Indicates the target infrared signature Visible light characteristics of the target The true label probability of The calculation formula of the bidirectional similarity distance clustering loss is: ; in, represents the bidirectional similarity distance clustering loss.
10. A frequency-adaptive cross-modal pedestrian retrieval device, characterized in that: include: A model construction module, for constructing a cross-modal frequency domain adaptive model, comprising a feature extractor, a first frequency domain adaptive encoder, a second frequency domain adaptive encoder, a third frequency domain adaptive encoder and a multi-branch embedding module connected in sequence; the first frequency domain adaptive encoder, the second frequency domain adaptive encoder and the third frequency domain adaptive encoder each comprise a high and low frequency perception unit, a frequency domain self-attention mechanism and an extended channel residual block connected in sequence; The feature acquisition module is used to input multiple pairs of visible light images and infrared images containing pedestrians into the cross-modal frequency domain adaptive model, and output corresponding multiple target visible light features and target infrared features, including: The visible light image is input to the visible light feature extraction submodule of the feature extractor, and a visible light feature map is output; the infrared image is input to the infrared feature extraction submodule of the feature extractor, and an infrared feature map is output; the concatenated features of the visible light feature map and the infrared feature map are used as the output of the feature extractor; The spliced feature is input to the high-low frequency perception unit of the first frequency domain adaptive encoder, and the first high-frequency feature is output after passing through the Resnet layer; the first high-frequency feature is input to the first depth-separable convolution, and the second high-frequency feature is output; the first high-frequency feature and the second high-frequency feature are added through the residual connection structure to obtain the target high-frequency feature; at the same time, the spliced feature is passed through the second depth-separable convolution of the high-low frequency perception unit to output the first low-frequency feature; the spliced feature and the first low-frequency feature are added through the residual connection structure to obtain the target low-frequency feature; Inputting the target high-frequency features and the target low-frequency features into the frequency-domain self-attention mechanism of the first frequency-domain adaptive encoder to obtain output features of the frequency-domain self-attention mechanism; Inputting the output features of the frequency domain self-attention mechanism into the extended channel residual block of the first frequency domain adaptive encoder to obtain the output features of the first frequency domain adaptive encoder; the extended channel residual block includes an extended layer, a third depth-separable convolution and a projection layer connected in sequence; The output feature of the first frequency domain adaptive encoder is sequentially passed through the second frequency domain adaptive encoder and the third frequency domain adaptive encoder to obtain the output feature of the third frequency domain adaptive encoder; Inputting the output features of the third frequency domain adaptive encoder into multiple embedding branches of the multi-branch embedding module respectively, concatenating the output features of each embedding branch with the output features of the third frequency domain adaptive encoder and applying Dropout regularization to obtain the output features of the multi-branch embedding module; Separate the output features of the multi-branch embedding module into multiple target visible light features and target infrared features; The image matching module is used to calculate the cosine similarity between each target visible light feature and each target infrared feature, and match the visible light image and infrared image corresponding to the target visible light feature and the target infrared feature based on the cosine similarity.
