A novel multi-modal fusion method for person re-identification
Through the multi-modal fusion pedestrian re-identification method, combined with the SCA attention module and ResNet50 network, the problem of modal differences and intra-modal differences in cross-modal pedestrian re-identification is solved, and the accuracy and robustness of pedestrian re-identification are achieved. Improved, suitable for practical applications.
Patent Information
- Application Number
- CN202210190938.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2042-02-28
AI Technical Summary
The existing technology has the problem of large image modal differences and obvious intra-modal differences in cross-modal pedestrian re-identification, resulting in poor recognition results and difficulty in effective application in actual scenarios.
A multi-modal fusion pedestrian re-identification method is adopted. By acquiring image features of three modalities: RGB, near-infrared and thermal infrared, the pre-trained multi-modal fusion pedestrian re-identification network is used for feature extraction and classification, combined with SCA attention. module and ResNet50 convolutional neural network to achieve feature fusion and robust feature learning between modalities.
It effectively reduces the differences between modalities, enhances network performance, realizes complementary information between modalities, improves the accuracy and robustness of pedestrian re-identification, and is suitable for practical application scenarios.
Smart Images

Figure CN114694089B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a novel multi-modal fusion pedestrian re-identification method. Background Art
[0002] Person re-identification (Re-ID) is an important image recognition technology. Its purpose is to solve the problem of retrieving specific pedestrians from a massive image or video library by using their appearance visual features and motion features across cameras. The identities of pedestrians captured by different cameras in the Internet are associated so that the movement trajectory of specific pedestrians can be obtained in a timely manner. Person re-identification technology is an important foundation of intelligent analysis technology and has gradually attracted close attention from researchers in the field of computer vision.
[0003] With the widespread application of deep learning in the field of computer vision, pedestrian re-identification based on deep learning has become the mainstream model, and its effect far exceeds that of pedestrian re-identification solutions based on traditional machine learning. Since pedestrian images captured by infrared mode cameras and depth cameras are also very common in real scenes, cross-modal pedestrian re-identification has been proposed to retrieve images matching the same pedestrian in a multi-modal image library. Effectively solving the problem of cross-modal pedestrian re-identification is of great significance to public safety, crime prevention, and criminal investigation.
[0004] In recent years, a large number of cross-modal person re-identification research works and related frameworks have emerged. However, there is still some gap between cross-modal person re-identification and its application in practical scenarios. The difficulties and challenges currently faced are mainly:
[0005] 1) There are significant differences between images captured in multiple modes. For example, RGB images have three channels, including visible light color information of red, green and blue, while infrared images have only one channel, including the intensity information of near-infrared light. From the perspective of imaging principles, the wavelength ranges of the two are also different. Different clarity and lighting conditions may produce very different effects on the two types of images.
[0006] 2) Intra-model differences in traditional pedestrian re-identification. Due to changes in the monitoring environment, different pedestrian videos or images are shot at different locations and times, and there are differences in pedestrian perspectives, lighting, postures, etc. The feature information of the same pedestrian may also have huge deviations, which has a negative impact on the effective identification of pedestrians.
[0007] Therefore, how to effectively reduce the differences between modal images, learn the robust features shared between modalities, make the information between modalities complementary, and improve the performance of the network is the key to research in the field of cross-modal person re-identification. Summary of the invention
[0008] In order to solve the above problems, a new multimodal fusion pedestrian re-identification method is provided.
[0009] The object of the present invention is achieved in the following manner:
[0010] A new multi-modal fusion pedestrian re-identification method, including:
[0011] Obtain pedestrian images containing three modalities: RGB, NI, and TI;
[0012] Inputting the pedestrian images of the three modalities into a pre-trained multi-modal fusion pedestrian re-identification network to obtain a prediction classification result;
[0013] The multimodal person re-identification network is configured as follows: including three branches to capture the features of the person image in each modality respectively, and obtain image features representing RGB, NI and TI modalities respectively.
[0014] The image features of RGB, NI and TI modalities are horizontally divided into p blocks, and then p partial column vector features are obtained after global average pooling GAP. and That is, the embedding layer features of each modality;
[0015] Then the p partial column vector features of the three modes are and They are respectively input into the classifier composed of the fully connected layer FC and the softmax function to obtain the identity prediction value vector of each modality input pedestrian image
[0016] First, connect the p predicted value vector features of each mode to generate the feature vector under each mode and Then connect these three feature vectors to get the fused feature vector X 1×3Kp , and then pass the feature through a classification layer to obtain the predicted classification result
[0017] Furthermore, the training process of the multimodal person re-identification network is as follows:
[0018] S1. Initialize the network layer weights, usually using random initialization;
[0019] S2. Single-modal feature extraction: For each pedestrian image, extract the features of three modalities: RGB, near-infrared (NI) and thermal infrared (TI). Input the extracted features of the three modalities: RGB, near-infrared (NI) and thermal infrared (TI) into the forward propagation of the convolutional layer, normalization layer, average pooling layer and other layers in the ResNet50 convolutional neural network containing the SCA attention module, and obtain the image features representing the RGB, NI and TI modalities respectively. and
[0020] S3. Single-modal image feature processing: First, for each modality, in order to obtain the local information of the person image, we use a local solution to convert each tensor The horizontal segmentation is divided into p blocks, and then global average pooling (GAP) is performed to obtain p partial column vectors and That is, the embedding layer features of each mode; then the feature vectors g of each part of each mode are i They are respectively input into the classifier composed of the fully connected (FC) layer and the softmax function to obtain the identity prediction value vector of each modality input pedestrian image Then, the difference between the pedestrian ID prediction vector of each modality and the true label is calculated, and the sum of the cross entropy of p classification layers is used as the loss function of the single modality. To optimize the network;
[0021] S4. Set a virtual branch to jointly learn the embedding layer features of the three modal images, realize information fusion between the modalities, make the features of the three different modalities learn towards a common virtual mean vector, and exit the virtual branch when the single-modal cross entropy classification loss is small enough; then calculate the difference between the embedding layer features of each modality and the virtual mean, and use the cosine distance as the loss function to optimize the network;
[0022] S5: The pedestrian ID prediction vector features of each modality obtained in S3 are subjected to the connection operation and the forward propagation of the classification layer to obtain the multi-modal fusion feature output value, that is, the prediction classification result The classification layer is composed of a fully connected layer and a softmax classifier;
[0023] S6. Calculate the KL divergence loss between the multimodal fusion feature output value and the target value and the cross-modal difficult sample triple loss;
[0024] S7. Calculate the final multimodal fusion global loss: add the cross entropy loss function generated by single-modal feature processing, the Euclidean distance loss function generated by the multimodal fusion virtual branch, the KL divergence loss function involved in the multimodal fusion feature processing, and the cross-modal difficult sample triple loss function, as the final multimodal global loss to participate in the network training;
[0025] S8, backpropagating the multimodal fusion global loss back to the network, and obtaining the backpropagation errors of each layer of the network in turn: the classification layer classifier, the fully connected layer FC, the pooling layer GAP, and the resnet50 structure with attention;
[0026] S9, each layer of the network adjusts all weight coefficients in the network according to the back propagation errors of each layer, that is, updates the weights;
[0027] S10, randomly select new image data again, then enter S2, perform network forward propagation to obtain the output value;
[0028] S11, iterate back and forth, when the error between the network output value and the target value (label) is less than a certain threshold, or the number of iterations exceeds a certain threshold, the training ends;
[0029] S12. Save the trained network parameters of all layers.
[0030] Furthermore, the ResNet50 convolutional neural network structure including the attention module includes five parts. The first part mainly performs convolution, regularization, activation function, and maximum pooling calculations on the input. The second, third, fourth, and fifth structures introduce residual blocks, that is, a direct channel is added to the network to allow the original input information to be directly transmitted to the subsequent layers. Each residual block contains three layers of convolution; and the SCA attention module is added after the second and third parts of ResNet50, respectively. Except for the last residual block of ResNet50, the network parameters of the three modes are shared, thereby obtaining image feature information representing RGB, NI, and TI modes respectively. and
[0031] Furthermore, the S3 specifically includes: Step 1: averaging the multimodal image features
[0032] By finding the mean of the features of the embedding layer of each modality, the feature column vector of the three modal fusion is obtained. The formula is as follows:
[0033]
[0034] Step 2: Calculate the loss function of each modality embedding layer feature and fusion feature vector
[0035] Here, we choose the cosine distance as the loss function, and use the sum of the cosine distances of each part as the loss of the modal feature and the fusion feature vector, that is:
[0036]
[0037] Step 3: Exit the virtual branch
[0038] Given a threshold α, when the classification layer loss value of each subsequent modality is less than the threshold, that is,
[0039]
[0040] , exit the virtual branch.
[0041] Furthermore, S6 specifically includes: calculating the difference between the predicted classification result and the true label. Here, we use KL divergence as the loss function to optimize the network. The formula is as follows:
[0042]
[0043] Where y represents the true label of the pedestrian (3 images), which is a K-dimensional vector. j represents the jth value of the y vector;
[0044] The cross-modal difficult sample triplet loss specifically includes:
[0045] Step 1: In each training batch, randomly extract P1 pedestrians in RGB mode, and extract K1 images for each pedestrian; extract P2 pedestrians in NI mode, and extract K2 images for each pedestrian; extract P3 pedestrians in TI mode, and extract K3 images for each pedestrian, for a total of P1K1+P2K2+P3K3 sample images;
[0046] Step 2: For a pedestrian image, in the three modalities, the image with the same ID as the pedestrian image is defined as a positive sample image, otherwise it is defined as a negative sample image;
[0047] Step 3: Using the features of the image and Represents pedestrian images in RGB, NI and TI modes. The distance between images is the distance between image features. The distance function between images is defined as the Euclidean distance:
[0048]
[0049] Step 4: For a fixed anchor image a, assuming that the image is in RGB mode, first calculate the distance d(a,pRGB) between the anchor image and each of its positive sample images pRGB and the distance d(a,nRGB) between the anchor image and its negative sample image pRGB in RGB mode;
[0050] Step 5: Calculate the distance d(a, pNI) between the anchor image and each positive sample pNI in NI mode and the distance d(a, nNI) between each negative sample nNI;
[0051] Step 6: Calculate the distance d(a, pTI) between the anchor image and each positive sample pTI in TI mode and the distance d(a, nTI) between each negative sample nTI;
[0052] Step 7: Define cross-modal hard sample triplets
[0053] When the anchor image is in RGB mode, the loss of its difficult sample triplet is:
[0054]
[0055] Where m is the boundary value parameter, α+β+γ=1 and α,β,γ≥0;
[0056] Similarly, when the anchor images are in NI and TI modes, the losses of the difficult sample triples are:
[0057]
[0058] Therefore, our cross-modal difficult sample triple loss is:
[0059] Lcross -modal =LT -RGB +LT -NI +LT -TI (12)
[0060] This loss can make the distance between positive sample pairs closer and the distance between negative sample pairs farther across modalities.
[0061] Furthermore, the SCA attention module mainly captures the spatial and channel feature information of the image through pooling operations. The input image features are first aggregated by average pooling and maximum pooling, and then the two pooled features are connected and reduced in dimension by convolution. After normalization and nonlinear activation, spatial features are generated. Then, H×1 and 1×W pooling kernels are used to perform maximum pooling operations on each channel in the horizontal and vertical directions, respectively. After activation by the sigmoid function, the attention weights shared by all channels are fused with the original input to obtain the final output features.
[0062] An electronic device comprising
[0063] Memory, used to store programs;
[0064] The processor is used to implement the above method by executing the program stored in the memory.
[0065] A computer-readable storage medium includes a program, wherein the program can be executed by a processor to implement the above method.
[0066] Beneficial effects of the present invention: The pedestrian re-identification method based on multimodal fusion integrates the image feature information of three modalities, wherein the network of each modality introduces an attention module to better extract image feature information, and then enables different modalities to learn in a common direction, effectively suppressing noise, reducing inter-modal differences, and achieving inter-modal information complementarity. Through the cross-modal difficult sample triplet loss, samples of different pedestrians can be pulled apart across modalities, and samples of the same pedestrian can be pulled together across modalities, effectively achieving cross-modal feature clustering. This method has broad application prospects in the field of pedestrian re-identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 It is a flow chart of the present invention.
[0068] Figure 2 It is a structural diagram of the multimodal pedestrian re-identification network of the present invention.
[0069] Figure 3 This is the ResNet50 network structure diagram.
[0070] Figure 4 This is the structure diagram of the SCA attention module. DETAILED DESCRIPTION
[0071] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0072] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same technical meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0073] A new multi-modal fusion pedestrian re-identification method,
[0074] Obtain pedestrian images in three modes, namely, RGB, near infrared (NI), and thermal infrared (TI); input the pedestrian images in the three modes into a pre-trained multimodal pedestrian re-identification network to obtain a prediction classification result;
[0075] The multimodal person re-identification network is configured as follows: including three branches to capture the features of the person image in each modality respectively, obtain image features representing RGB, NI and TI modalities respectively, divide the image features of RGB, NI and TI modalities horizontally into p blocks, and then obtain p partial column vector features after global average pooling (GAP) and That is, the embedding layer features of each mode; then the p partial column vector features of the three modes and They are respectively input into the classifier composed of the fully connected (FC) layer and the softmax function to obtain the identity (ID) prediction value vector of each modal input pedestrian image First, connect the p predicted value vector features of each mode to generate the feature vector under each mode and Then connect these three feature vectors to get the fused feature vector X 1×3Kp , and then pass the feature through a classifier to get the predicted classification result
[0076] As we all know, after a multimodal fusion person re-identification network is established, it needs to be trained to converge. After convergence, the trained network weights are obtained. During the inference process, the weight coefficients trained by the network are pre-loaded to perform the final classification of the input data.
[0077] like Figure 1 As shown, the training process of the multimodal person re-identification network is as follows:
[0078] S1. Initialize the network layer weights, usually using random initialization;
[0079] S2. Single-modal feature extraction: For each pedestrian image, extract the features of three modalities: RGB, near-infrared (NI) and thermal infrared (TI). Input the extracted features of the three modalities: RGB, near-infrared (NI) and thermal infrared (TI) into the forward propagation of the convolutional layer, normalization layer, average pooling layer and other layers in the ResNet50 convolutional neural network containing the SCA attention module, and obtain the image features representing the RGB, NI and TI modalities respectively. and
[0080] S3. Single-modal image feature processing: First, for each modality, in order to obtain the local information of the person image, we use a local solution to convert each tensor The horizontal segmentation is divided into p blocks, and then global average pooling (GAP) is performed to obtain p partial column vectors and That is, the embedding layer features of each modality; then the partial feature vectors gi of each modality are respectively input into the classifier composed of the fully connected (FC) layer and the softmax function, so as to obtain the identity (ID) prediction value vector of each modality input pedestrian image Then, the difference between the predicted value vector of pedestrian ID in each mode and the true label is calculated, and the sum of the cross entropy of p classification layers is used as the loss function of the single mode. To optimize the network;
[0081] S4. Set a virtual branch to jointly learn the embedding layer features of the three modal images, realize information fusion between the modalities, make the features of the three different modalities learn towards a common virtual mean vector, and exit the virtual branch when the single-modal cross entropy classification loss is small enough; then calculate the difference between the embedding layer features of each modality and the virtual mean, and use the cosine distance as the loss function to optimize the network;
[0082] S5: The pedestrian ID prediction value vector features of each modality obtained in S3 are subjected to the connection operation and the forward propagation of the classification layer to obtain the multi-modal fusion feature output value, that is, the predicted classification result.
[0083] S6. Calculate the KL divergence loss between the multimodal fusion feature output value and the target value and the cross-modal difficult sample triple loss;
[0084] S7. Calculate the final multimodal fusion global loss: add the cross entropy loss function generated by single-modal feature processing, the Euclidean distance loss function generated by the multimodal fusion virtual branch, the KL divergence loss function involved in the multimodal fusion feature processing, and the cross-modal difficult sample triple loss function, as the final multimodal global loss to participate in the network training;
[0085] S8, backpropagating the multimodal fusion global loss back to the network, and obtaining the backpropagation errors of each layer of the network in turn: the classification layer classifier, the fully connected layer FC, the pooling layer GAP, and each layer of the resnet50 structure with attention (convolutional layer, pooling layer, normalization layer, activation layer);
[0086] S9, each layer of the network adjusts all weight coefficients in the network according to the back propagation errors of each layer, that is, updates the weights;
[0087] S10, randomly select new image data again, then enter S2, perform network forward propagation to obtain the output value;
[0088] S11, iterate back and forth, when the error between the network output value and the target value (label) is less than a certain threshold, or the number of iterations exceeds a certain threshold, the training ends;
[0089] S12. Save the trained network parameters of all layers.
[0090] Specifically, Figure 2 As shown in FIG. 1 , the structure of the multimodal fusion pedestrian re-identification network proposed in the present invention is as follows:
[0091] First: Unimodal Feature Extraction
[0092] For each pedestrian image, there are three modalities: RGB, near infrared (NI) and thermal infrared (TI).
[0093] First, we need to extract the feature representation of each modality separately. In order to obtain high-quality feature representation of a single modality, we designed three branches based on a convolutional neural network (ResNet50 is used in this invention) to capture the features of the person image in each modality respectively.
[0094] The network structure of ResNet50 is as follows Figure 3 As shown in the figure. The ResNet50 structure is divided into seven parts. The first part mainly performs convolution, regularization, activation function, and maximum pooling calculations on the input. The second, third, fourth, and fifth parts of the structure introduce residual blocks, which add direct channels to the network to allow the original input information to be directly transmitted to the subsequent layers. Each residual block contains three layers of convolution. After the convolution calculations of the first five parts, the pooling layer converts it into a feature vector. Finally, the classifier calculates this feature vector and outputs the category probability.
[0095] In order to better capture image feature information, we propose a new spatial-channel attention module SCA (Spatial-Channel Attention), the structure is as follows Figure 4 As shown. For input feature information FH ×W×C We first use the spatial relationship between features to generate spatial attention features. Since applying pooling operations along the channel axis can highlight the effective information area, in order to calculate spatial attention, we aggregate the channel information of a feature map through two pooling operations (average pooling and maximum pooling) to generate two two-dimensional feature maps. They are then concatenated and reduced in dimension through convolution, and the spatial attention features Fs∈RH are generated after normalization and nonlinear activation function. ×W , to encode the positions that need to be emphasized and suppressed. The calculation formula is as follows:
[0096] Fs=σ(BN(f 1×1×2([AvgPool(F); MaxPool(F)])))
[0097] Where [·;·] represents the connection operation, f 1×1×2 is a convolution operation with a convolution kernel of 1×1×2, BN is batch normalization, and σ represents the non-linear activation function Non-linear.
[0098] Then, in channel attention, we adopt global maximum pooling to globally encode spatial information. In order to enable the attention block to capture long-range spatial interactions with precise location information, each channel feature is pooled along the horizontal and vertical coordinates using H×1 and 1×W pooling kernels, respectively, to generate a pair of direction-aware feature vectors. Therefore, the output at height h can be expressed as:
[0099]
[0100] Similarly, the output at width w can be expressed as:
[0101]
[0102] These two transformations allow the attention block to capture long-range dependencies in one spatial direction and maintain precise location information in another spatial direction, which helps the network locate the region of interest more accurately. Then, gh and gw activated by the sigmoid function are fused with the original input as the attention weights shared by all channels. The final output of the SCA module is expressed as:
[0103] Fc′(i,j)=Fc(i,j)×δ(gh(i))×δ(gw(j))
[0104] Where δ is the sigmoid activation function, Fc(i,j) is the pixel value of the i-th row and j-th column of the c-th channel of the original feature map, and Fc′(i,j) is the pixel value of the i-th row and j-th column of the c-th channel of the output feature map.
[0105] The SCA attention module is added after the second and third parts of ResNet50, and then the images of each modality are input into the first five parts of ResNet50 containing the attention module. The following average pooling (avg pool) layer and fully connected (fc) layer are deleted. In order to reduce the amount of network parameters, except for the last residual block of ResNet50, the network parameters of the three modalities are shared, so as to obtain image feature information representing RGB, NI and TI modalities respectively. and
[0106] Second: Unimodal Feature Processing
[0107] First, for each modality, in order to obtain the local information of the person image, we use a local solution to split each tensor χ horizontally into p blocks, and then obtain p partial column vectors after global average pooling (GAP) and That is, the embedding layer features of each modality.
[0108] Then, each partial feature vector gi of each modality is input into the classifier composed of the fully connected (FC) layer and the softmax function, so as to obtain the identity (ID) prediction value vector of each modality input pedestrian image Note that the p FC layer parameters of each modality are not shared.
[0109] Then, the difference between the predicted value of pedestrian ID in each mode and the true label is calculated, and the sum of the cross-entropy of p classification layers is used as the loss function of the single mode to optimize the network. The formula is as follows:
[0110]
[0111] Where K is the number of ID categories of pedestrian identities, is the predicted probability that the i-th local part belongs to the j-th pedestrian ID, Represents the corresponding true label.
[0112] Third: Setting up multimodal fusion virtual branches
[0113] Image information from the three modalities is beneficial for pedestrian re-identification, but each modality contains a lot of noise, and there are significant differences in wavelength, clarity, and lighting conditions between different modalities. In order to effectively suppress noise, reduce differences between modalities, and achieve inter-modal information complementarity, we create a virtual branch to allow the image features of the three modalities to learn in a common direction, thereby accelerating the convergence of the model.
[0114] We set up a virtual branch to jointly learn the embedding layer features of the three modal images. The implementation is as follows:
[0115] Step 1: Averaging multimodal image features
[0116] By finding the mean of the features of the embedding layer of each modality, the feature column vector of the three modal fusion is obtained. The formula is as follows:
[0117]
[0118] Step 2: Calculate the loss function of each modality embedding layer feature and fusion feature vector
[0119] Here, we choose the cosine distance as the loss function, and use the sum of the cosine distances of each part as the loss of the modal feature and the fusion feature vector, that is:
[0120]
[0121] Step 3: Exit the virtual branch
[0122] Given a threshold α, when the classification layer loss value of each subsequent modality is less than the threshold, that is,
[0123]
[0124] , exit the virtual branch.
[0125] Through this virtual branch, information fusion between modalities can be achieved, so that the features of three different modalities are all learned towards a common virtual mean vector, thereby effectively suppressing noise, reducing the difference between modalities, and accelerating convergence. When the classification loss is small enough, the virtual branch is exited to reduce the computational cost.
[0126] Fourth: Multimodal fusion feature processing:
[0127] In order to further integrate the features of each modality and enhance the generalization ability of the network, we first connect the p features of each modality to generate the feature vectors under each mode and Then connect these three feature vectors to get the fused feature vector X 1×3Kp , and then pass the feature through a classification layer to obtain the predicted classification result That is, the ID prediction probability vector generated by the classification layer classifier is used for re-identification. For example, if the vector is [0.01, 0.53, 0.24, ..., 0.16], it means that the probability that the pedestrian ID is 0 is 0.01, the probability that it is 1 is 0.53, ..., and the probability that it is K-1 is 0.16.
[0128] Then calculate the difference between the predicted classification result and the true label. Here we use KL (Kullback-Leibler) divergence as the loss function to optimize the network. The formula is as follows:
[0129]
[0130] Fifth: Calculate the loss function of difficult sample triples across modalities
[0131] In order to cluster pedestrian image samples across modalities, so that samples of different pedestrians can be pulled apart across modalities and samples of the same pedestrian can be pulled together across modalities, we designed a new type of cross-modal difficult sample triplet loss function.
[0132] The traditional triplet loss function inputs three pictures, namely the fixed anchor picture a (Anchor), the positive sample picture p (Positive) and the negative sample picture n (Negative). Picture a and picture p form a positive sample pair, and picture a and picture n form a negative sample pair. The corresponding triplet loss function is expressed as:
[0133] Lt=(da ,p -da ,n +α) + (6)
[0134] Where (z) + represents max(z,0),da ,p is the distance between positive sample pairs, da ,p is the distance between negative sample pairs, and α is the threshold parameter set according to actual needs.
[0135] The triplet loss function can bring positive sample pairs closer together and push negative sample pairs apart, so that image features with the same label can be clustered in the feature space.
[0136] In order to enhance the generalization ability of the network and enable the network to learn better representations, for each fixed image a, the farthest positive sample image and the closest negative sample image n are selected in a training batch to train the network, which is called the difficult sample triplet loss. The formula is as follows:
[0137] Lth=(maxd ,p -minda ,n +α) + (7)
[0138] Based on this, we propose a cross-modal difficult sample triplet loss, which is implemented as follows:
[0139] Step 1: In each training batch, randomly extract P1 pedestrians in RGB mode, and extract K1 images for each pedestrian; extract P2 pedestrians in NI mode, and extract K2 images for each pedestrian; extract P3 pedestrians in TI mode, and extract K3 images for each pedestrian, for a total of P1K1+P2K2+P3K3 sample images.
[0140] Step 2: For a pedestrian image, in the three modalities, the image with the same ID as the pedestrian image is defined as a positive sample image, otherwise it is defined as a negative sample image;
[0141] Step 3: Using the features of the image and Represents pedestrian images in RGB, NI and TI modes. The distance between images is the distance between image features. The distance function between images is defined as the Euclidean distance:
[0142]
[0143] Step 4: For a fixed anchor image a, assuming that the image is in RGB mode, first calculate the distance d(a, pRGB) between the anchor image and each of its positive sample images pRGB and the distance d(a, nRGB) between the anchor image and its negative sample image nRGB in RGB mode;
[0144] Step 5: Calculate the distance d(a, pNI) between the anchor image and each positive sample pNI in NI mode and the distance d(a, nNI) between each negative sample nNI;
[0145] Step 6: Calculate the distance d(a, pTI) between the anchor image and each positive sample pTI in TI mode and the distance d(a, nTI) between each negative sample nTI;
[0146] Step 7: Define cross-modal hard sample triplets
[0147] When the anchor image is in RGB mode, the loss of its difficult sample triplet is:
[0148]
[0149] Where m is the boundary value parameter, α+β+γ=1 and α,β,γ≥0.
[0150] Similarly, when the anchor images are in NI and TI modes, the losses of the difficult sample triples are:
[0151]
[0152] Therefore, our cross-modal difficult sample triple loss is:
[0153] Lcross -modal =LT -RGB +LT -NI +LT -TI (12)
[0154] This loss can make the distance between positive sample pairs closer and the distance between negative sample pairs farther across modalities.
[0155] Sixth: Calculate the global loss function of multimodal fusion
[0156] We add the cross entropy loss function generated by unimodal feature processing, the Euclidean distance loss function generated by the multimodal fusion virtual branch, the KL divergence loss function involved in multimodal fusion feature processing, and the cross-modal difficult sample triplet loss function as the final multimodal global loss to participate in network training.
[0157]
[0158] Reasoning process:
[0159] 1) Remove the virtual branches and keep only the backbone network.
[0160] 2) Load pre-trained weights to classify pedestrian images or extract image features.
[0161] To summarize, use the trained network model (all trained network layer parameters are saved, the network model is fixed at this time, and no backpropagation is performed to update the parameters), run new data, get the optimal model parameters in the training phase, and directly put the optimal network model into use in the inference phase: put the new data into the network model and perform a forward propagation to get the result, and no backpropagation is performed to update the parameters.
[0162] The above is only a preferred embodiment of the present invention. It should be pointed out that for those skilled in the art, several changes and improvements can be made without departing from the overall concept of the present invention, which should also be regarded as the scope of protection of the present invention.
Claims
1. A novel multi-modal fusion pedestrian re-identification method, characterized by: Obtain pedestrian images containing three modalities: RGB, NI, and TI; Inputting the pedestrian images of the three modalities into a pre-trained multimodal pedestrian re-identification network to obtain a prediction classification result; The multimodal person re-identification network is configured as follows: including three branches to capture the features of the person image in each modality respectively, obtain image features representing RGB, NI and TI modalities respectively, divide the image features of RGB, NI and TI modalities horizontally into p blocks, and then obtain p partial column vector features after global average pooling GAP and That is, the embedding layer features of each modality; Then the p partial column vector features of the three modes are and They are respectively input into the classifier composed of the fully connected layer FC and the softmax function to obtain the identity prediction value vector of each modality input pedestrian image First, connect the p predicted value vector features of each mode to generate the feature vector under each mode and Then connect these three feature vectors to get the fused feature vector X 1×3Kp , and then pass the feature through a classification layer to obtain the predicted classification result The training process of the multimodal person re-identification network is as follows: S1. Initialize the network layer weights, usually using random initialization; S2. Single-modal feature extraction: For each pedestrian image, extract the features of the three modalities of RGB, near-infrared NI and thermal infrared TI respectively; input the extracted features of the three modalities of RGB, near-infrared NI and thermal infrared TI into the forward propagation of the convolution layer, normalization layer, average pooling layer and other layers in the ResNet50 convolutional neural network containing the SCA attention module, and obtain the image features representing the RGB, NI and TI modalities respectively. and S3. Single-modal image feature processing: First, for each modality, in order to obtain the local information of the person image, we use a local solution to convert each tensor The horizontal segmentation is divided into p blocks, and then global average pooling (GAP) is performed to obtain p partial column vectors and That is, the embedding layer features of each mode; then the feature vectors g of each part of each mode are i They are respectively input into the classifier composed of the fully connected FC layer and the softmax function to obtain the identity prediction value vector of each modality input pedestrian image Then, the difference between the pedestrian ID prediction vector of each modality and the true label is calculated, and the sum of the cross entropy of p classification layers is used as the loss function of the single modality. To optimize the network; S4. Set a virtual branch to jointly learn the embedding layer features of the three modal images, realize information fusion between the modalities, make the features of the three different modalities learn towards a common virtual mean vector, and exit the virtual branch when the single-modal cross entropy classification loss is small enough; then calculate the difference between the embedding layer features of each modality and the virtual mean, and use the cosine distance as the loss function to optimize the network; S5: The pedestrian ID prediction vector features of each modality obtained in S3 are subjected to the connection operation and the forward propagation of the classification layer to obtain the multi-modal fusion feature output value, that is, the predicted classification result. The classification layer is composed of a fully connected layer and a softmax classifier; S6. Calculate the KL divergence loss between the multimodal fusion feature output value and the target value and the cross-modal difficult sample triple loss; S7. Calculate the final multimodal fusion global loss: add the cross entropy loss function generated by single-modal feature processing, the Euclidean distance loss function generated by the multimodal fusion virtual branch, the KL divergence loss function involved in the multimodal fusion feature processing, and the cross-modal difficult sample triple loss function, as the final multimodal global loss to participate in the network training; S8, backpropagating the multimodal fusion global loss back to the network, and obtaining the backpropagation errors of each layer of the network in turn: the classification layer classifier, the fully connected layer FC, the pooling layer GAP, and the resnet50 structure with attention; S9, each layer of the network adjusts all weight coefficients in the network according to the back propagation errors of each layer, that is, updates the weights; S10, randomly select new image data again, then enter S2, perform network forward propagation to obtain the output value; S11, iterate back and forth, when the error between the network output value and the target value is less than a certain threshold, or the number of iterations exceeds a certain threshold, the training ends; S12. Save the trained network parameters of all layers.
2. The novel multi-modal fusion pedestrian re-identification method according to claim 1 is characterized by: The ResNet50 convolutional neural network structure including the attention module includes five parts. The first part mainly performs convolution, regularization, activation function, and maximum pooling calculations on the input. The second, third, fourth, and fifth structures introduce residual blocks, that is, a direct channel is added to the network to allow the original input information to be directly transmitted to the subsequent layers. Each residual block contains three layers of convolution; and the SCA attention module is added after the second and third parts of ResNet50 respectively. Except for the last residual block of ResNet50, the network parameters of the three modes are shared, so as to obtain image feature information representing RGB, NI, and TI modes respectively. and 3. The novel multi-modal fusion pedestrian re-identification method according to claim 1 is characterized by: The S3 specifically includes: Step 1: averaging the multimodal image features By finding the mean of the features of the embedding layer of each modality, the feature column vector of the three modal fusion is obtained. The formula is as follows: Step 2: Calculate the loss function of each modality embedding layer feature and fusion feature vector Here, we choose the cosine distance as the loss function, and use the sum of the cosine distances of each part as the loss of the modal feature and the fusion feature vector, that is: Step 3: Exit the virtual branch Given a threshold α, when the classification layer loss value of each subsequent modality is less than the threshold, that is, , exit the virtual branch.
4. The novel multi-modal fusion pedestrian re-identification method according to claim 1 is characterized by: The S6 specifically includes: calculating the difference between the predicted classification result and the true label. Here, we use KL divergence as the loss function to optimize the network. The formula is as follows: Where y represents the true label of the pedestrian (3 images), which is a K-dimensional vector. j represents the jth value of the y vector; The cross-modal difficult sample triplet loss specifically includes: Step 1: In each training batch, randomly extract P1 pedestrians in RGB mode, and extract K1 images for each pedestrian; extract P2 pedestrians in NI mode, and extract K2 images for each pedestrian; extract P3 pedestrians in TI mode, and extract K3 images for each pedestrian, for a total of P1K1+P2K2+P3K3 sample images; Step 2: For a pedestrian image, among the three modalities, the image with the same ID as the pedestrian image is defined as a positive sample image, otherwise it is defined as a negative sample image; Step 3: Using the features of the image and Represents pedestrian images in RGB, NI and TI modes. The distance between images is the distance between image features. The distance function between images is defined as the Euclidean distance: Step 4: For a fixed anchor image a, assuming that the image is in RGB mode, first calculate the anchor image in RGB mode and its positive sample images p RGB The distance d(a,p RGB ) and its negative sample image n RGB The distance d(a,n RGB ); Step 5: Calculate the anchor image and each positive sample p in NI mode NI Distance d(a,p NI ) and each negative sample n NI The distance d(a,n NI ); Step 6: Calculate the anchor image and each positive sample p in TI mode TI Distance d(a,p TI ) and each negative sample n TI The distance d(a,n TI ); Step 7: Define cross-modal hard sample triplets When the anchor image is in RGB mode, the loss of its difficult sample triplet is: Where m is the boundary value parameter, α+β+γ=1 and α,β,γ≥0; Similarly, when the anchor images are in NI and TI modes, the losses of the difficult sample triples are: Therefore, our cross-modal difficult sample triple loss is: L cross-modal =L T-RGB +L T-NI +L T-TI (12) This loss can make the distance between positive sample pairs closer and the distance between negative sample pairs farther across modalities.
5. The novel multi-modal fusion pedestrian re-identification method according to claim 1 is characterized by: The SCA attention module mainly captures the spatial and channel feature information of the image through pooling operations. The input image features are first aggregated through average pooling and maximum pooling, and then the two pooled features are connected and reduced in dimension through convolution. After normalization and nonlinear activation, spatial features are generated; then, H×1 and 1×W pooling kernels are used to perform maximum pooling operations on each channel in the horizontal and vertical directions, respectively. After activation by the sigmoid function, the attention weights shared by all channels are fused with the original input to obtain the final output features.
6. An electronic device, characterized in that: include Memory, used to store programs; A processor, configured to implement the method according to any one of claims 1 to 5 by executing the program stored in the memory.
7. A computer-readable storage medium, characterized in that: The method comprises a program which can be executed by a processor to implement the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Cross-modal pedestrian re-identification method based on difficult quintuple
CN111597876A
Cross-modal pedestrian re-recognition method based on cross-correlation attention mechanism
CN112906493A
Cross-modal target tracking method and system based on modal perception feature learning
CN112949451A
Person Re-Identification Method Combining Random Batch Mask and Multi-Scale Representation Learning
JP6830707B1
Pedestrian re-identification method, computer device and readable medium
US20200342271A1
