An unsupervised person re-identification method
By using the AIBLN layer and Pearson correlation coefficient similarity calculation in unsupervised person re-identification, combined with memorybank update, the problem of inaccurate pseudo-label assignment is solved and the recognition efficiency and reliability are improved.
Patent Information
- Application Number
- CN202111636116.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-12-29
AI Technical Summary
In existing unsupervised person re-identification methods, inaccurate similarity calculation leads to inaccurate pseudo-label assignment, affecting recognition efficiency and reliability.
A pedestrian re-identification model based on ResNet-50 is used, by replacing the BN layer with the AIBLN layer in the backbone network, and training in and out of the unsupervised perspective. Global features are used for clustering to generate pseudo labels, combined with Pearson correlation. The coefficients are used to calculate similarity, memorybank is added to update instance differences, and supervised training with pseudo-labels is performed.
By superimposing strong similarity calculations, the accuracy of pseudo labels is improved, the model training converges faster, has stronger robustness, and improves recognition efficiency and reliability.
Smart Images

Figure CN114299543B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision, and in particular to an unsupervised pedestrian re-identification method. Background Art
[0002] Existing unsupervised person re-identification techniques can be summarized into three categories. The first category is to use the prior knowledge learned from other datasets to transfer to unsupervised person re-identification. The second category uses the GAN network to transfer image style. Both categories complete unsupervised person re-identification by using transfer learning. PTGAN and SPGAN first generate transferred images from the source dataset and then use the transferred images for training. HHL generates images under different cameras and uses triplet loss to train the network. ECN uses transfer learning and minimizes target invariance. JVTC uses GAN network to expand data for perspective information and uses data enhancement to achieve better results. Transfer learning requires a labeled source domain dataset for training. So this still requires huge manual costs. The third category uses clustering to estimate pseudo labels to train CNN. This method uses the similarity of sample features to generate pseudo labels, uses pseudo labels to train the model, and iterates until the network converges. This method basically does not require huge manual costs. However, the quality of the calculated pseudo labels determines the performance of these methods. Some people use the standard k-means clustering method to generate pseudo labels and use these labels to fine-tune the model. Some people propose to calculate pseudo labels by multi-label similarity and use these labels to iterate the model. Some people propose soft labels and calculate and update pseudo labels through multiple similarities. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide an unsupervised pedestrian re-identification method to solve the problem of inaccurate pseudo-label assignment caused by similarity calculation problems, and effectively improve recognition efficiency and reliability.
[0004] To achieve the above object, the present invention adopts the following technical solutions:
[0005] An unsupervised person re-identification method comprises the following steps:
[0006] Step S1: Obtain pedestrian image data including several viewing angles and construct a pedestrian dataset;
[0007] Step S2: constructing a person re-identification model, specifically, replacing the BN layer with the AIBLN layer in the backbone network ResNet-50, and training based on unsupervised in-view and out-of-view training methods to obtain a trained person re-identification model;
[0008] Step S3: Input the image to be recognized into the trained person re-recognition model to obtain the recognition result.
[0009] Furthermore, the viewing angles include four types: v={left, right, front, behind}.
[0010] Furthermore, the training is performed based on unsupervised in-view and out-of-view training methods, specifically as follows:
[0011] Step S21: extract a global feature at each viewing angle through the CNN network;
[0012] Step S22: perform clustering at each viewing angle using global features, generate pseudo labels at N viewing angles, and then perform supervised training with a classifier;
[0013] Step S23: Calculate a view similarity by calculating the classification score generated by the classifier, and use the view similarity and global similarity to measure the similarity between two samples; cluster all samples and assign pseudo labels based on the similarity, and then use the pseudo labels for supervised learning;
[0014] Step S24: iterate steps S22-S23 to optimize the similarity between perspectives and the information on the similarity between non-perspectives.
[0015] Furthermore, the global features are used to perform clustering at each perspective, specifically:
[0016] Divide the training set X into subsets X = {X1..X c};
[0017] Calculate the similarity based on feature f for clustering in each subset;
[0018] Assign pseudo labels generated by clustering to each subset, making the dataset a labeled dataset.
[0019] Furthermore, the step S23 is specifically: using the Pearson correlation coefficient to calculate their similarity
[0020]
[0021] Where cov is the covariance of two vectors, σ is the standard deviation of the two vectors, and μ represents the mean. M and N represent two feature vectors extracted by the network model.
[0022]
[0023]
[0024] Among them, p(k|f m , w c ) represents the kth classification probability obtained by the classifier, and the classification score S m is obtained by concatenating the classification scores from C classifiers; The c in the middle represents a certain perspective;
[0025] After calculating the Pearson correlation coefficient, the similarity between the two samples is calculated by the formula
[0026] SIM(f m , f n ) = dist(f m , f n )+μ·ρ m,n
[0027] Further, pseudo labels based on viewpoint similarity are generated, and then supervised training with pseudo labels is performed.
[0028] Furthermore, step S23 adds a memory bank to update the differences between instances. Specifically, each feature is initialized and stored in the memory bank. Then, at each update, the memory is updated and the loss is calculated to update the vector from the perspective of the feature:
[0029] c i ←m·c i +(1-m)·q
[0030] Among them, instance q is the feature extracted this time, ci represents the feature of the same image stored in memory last time; m is the momentum update factor.
[0031] Furthermore, the regularization layer of the pedestrian re-identification model adopts a new regularization layer AIBLN, which is calculated by linearly fusing the statistics obtained by IN, BN and LN.
[0032]
[0033] where X∈R H×W×N is featuremap, μ bn , σ bn are the mean and variance calculated by BN. μ in , σ in is the mean and variance calculated by IN; μ ln , σ lnare the mean and variance calculated by LN; γ and β are affine parameters, and λ is a learnable weighting parameter; the optimization of λ can be optimized by back propagation during CNN training; during the training of the network, no restrictions on λ are added; during the optimization process, the parameter of λ is restricted to [0,1].
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] 1. The present invention calculates similarity by superimposing enhanced similarity calculation, thereby allocating more accurate pseudo-labels, so that subsequent model training converges faster and has stronger robustness.
[0036] 2. The present invention solves the problem of inaccurate pseudo-label assignment caused by similarity calculation, and effectively improves recognition efficiency and reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a structural diagram of the method of the present invention;
[0038] Figure 2 It is a schematic diagram of different viewing angles in one embodiment of the present invention. DETAILED DESCRIPTION
[0039] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0040] In this embodiment, given a pedestrian data set X = {X c}, X c represents the image of the pedestrian, and C represents the index of the viewing angle. In unsupervised person re-identification, the purpose of the present invention is to train a person re-identification model on the X dataset.
[0041] For any query person image q, the model generates a feature vector that is used to retrieve images g containing the same person from the image gallery G. The trained person re-identification model should ensure that the features of q are more similar to the features of g. In other words, their distance metric should be minimized. We express it in terms of formula:
[0042]
[0043] Where f∈R d ,f is a d-dimensional feature vector extracted by trained person re-identification. dist(·) represents the distance metric, which is usually represented by Euclidean distance.
[0044]
[0045] Please refer to Figure 1 The pedestrian re-identification model training adopted by the present invention specifically includes two stages:
[0046] In the first stage, a CNN network is used to extract a global feature at each viewing angle. The global feature is used to perform clustering at each viewing angle, and pseudo labels at N viewing angles are generated, and then supervised training with a classifier is performed. In this part of the network, the network can learn that under normal circumstances, people will only slightly change their posture at the same viewing angle. Naturally, at this step, we can prioritize screening people with more similar features.
[0047] In the second stage, a perspective similarity is calculated by calculating the classification score generated by the classifier, and the perspective similarity and global similarity are used to measure the similarity of two samples. All samples are clustered and assigned pseudo labels based on similarity, and then supervised learning is performed using pseudo labels. In this stage, a full-perspective training is performed to make up for the situation where people suddenly change their perspectives. This part refines the information missing in the previous part. A memory bank is added to retain the enhanced information of the sample image in the next round of training and fuse it. In addition, in order to compress the mutual information between the input and the intermediate features as much as possible, as well as retain as much correlation as possible with the output.
[0048] Preferably, in this embodiment, a popular 3D mesh generator Human Mesh Recovery (HMR) is used to generate the corresponding 3D mesh, referring to Figure 2 The above perspectives are our auxiliary data sets. We only need to select perspectives or perform simple unsupervised work to train a perspective classifier, which can be used on all data sets and can accurately separate 3D data sets. In this embodiment, the perspectives are divided into 4 types: v = {left, right, front, behind}.
[0049] First, we load the pre-trained model of Resnet-50 into our pedestrian model and extract pedestrian features f through the model. In this stage, we first divide the training set X into subsets X = {X1..X c Then, the similarity is calculated based on the feature f to perform clustering in each subset. The pseudo labels generated by clustering are assigned to each subset, making the dataset a labeled dataset.
[0050] In this embodiment, in order to predict the possibility that two pictures from different perspectives belong to the same identity, a feature that does not depend on the perspective is needed, and pictures belonging to the same person should have the same classification probability distribution. Preferably, the Pearson correlation coefficient is used to calculate their similarity because it can reflect the degree of correlation between two samples.
[0051]
[0052] Where cov is the covariance of two vectors, σ is the standard deviation of the two vectors, and μ represents the mean.
[0053]
[0054]
[0055] Among them, p(k|f m , w c ) represents the kth classification probability obtained by the classifier, and the classification score S m is obtained by concatenating the classification scores from C classifiers. In the formula, c represents a certain perspective. After calculating the Pearson correlation coefficient, we can calculate the similarity between two samples by the formula
[0056] SI M (f m , f n )=dist(f m , f n )+μ·ρ m,n
[0057] It is better to generate pseudo-labels based on viewpoint similarity, and then perform supervised training with pseudo-labels.
[0058] In order to better measure the relationship between instances, this embodiment adds a memorybank at this stage to update the differences between instances. First, initialize each feature and store it in the memorybank. Then, at each update, update the memory and calculate the loss. Update the vector from the perspective of the feature:
[0059] c i ←m·c i +(1-m)·q
[0060] Here, instance q is the feature extracted this time, ci represents the feature of the same image stored in memory last time, and m is the momentum update factor.
[0061] In this paper, it is preferred to compress the mutual information between the input and the intermediate features as much as possible while retaining as much correlation as possible with the output. A new regularization layer AIBLN is proposed. Instance Normalization can make the network invariant to changes in the framework. Instance Normalization reduces the variance between classes and reduces the discriminability of the network. IN learns to discriminate insensitive features such as shape transformation, color, style, virtual or real. Unlike Instance Normalization, BN (Batch Normalization) retains texture-related features, and Batch Normalization retains the changes between different categories and reduces the internal covariate changes during network training. However, the emergence of LayerNormalization can well avoid the above-mentioned drawbacks of Batch Norm. So we propose Adaptive Instance and Batch and LayerNormalization. They can make up for each other's shortcomings.
[0062] In order to obtain the advantages of IN and BN and LN at the same time, AIBLN is proposed. It is calculated by linearly fusing the statistics (mean and variance) obtained by IN and BN and LN.
[0063]
[0064] where X∈R H×W×N is featuremap, μ bn , σ bn is the mean and variance calculated by BN. μ in , σ in is the mean and variance calculated by IN. μ ln , σ ln are the mean and variance calculated by LN. γ and β are affine parameters, and λ is a learnable weight parameter. The optimization of λ can be optimized by back propagation during CNN training. During the training of the network, we did not add any restrictions on λ. During the optimization process, we restricted the parameter of λ to [0,1] to avoid negative values of λ.
[0065] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.
Claims
1. An unsupervised person re-identification method, characterized in that: The following steps are involved: Step S1: Obtain pedestrian image data including several viewing angles and construct a pedestrian dataset; Step S2: constructing a person re-identification model, specifically, replacing the BN layer with the AIBLN layer in the backbone network ResNet-50, and training based on unsupervised in-view and out-of-view training methods to obtain a trained person re-identification model; Step S3: input the image to be identified into the trained person re-identification model to obtain the recognition result; The training is performed based on the unsupervised in-view and out-of-view training methods, as follows: Step S21: extract a global feature at each viewing angle through the CNN network; Step S22: perform clustering at each viewing angle using global features, generate pseudo labels at N viewing angles, and then perform supervised training with a classifier; Step S23: Calculate a view similarity by calculating the classification score generated by the classifier, and use the view similarity and global similarity to measure the similarity between two samples; cluster all samples and assign pseudo labels based on the similarity, and then use the pseudo labels for supervised learning; Step S24: iteratively perform steps S22-S23 to optimize the similarity between perspectives and the information of similarity between non-perspectives; The pedestrian re-identification model regularization layer adopts a new regularization layer AIBLN, which is calculated by linearly fusing the statistics obtained by IN, BN and LN. where X∈R H×W×N is the feature map, μ bn , σ bn is the mean and variance calculated by BN; μ in , σ in is the mean and variance calculated by IN; μ ln , σ ln are the mean and variance calculated by LN; γ and β are affine parameters, and λ is a learnable weighting parameter; λ is optimized by back propagation during CNN training; no restrictions are imposed on λ during network training; and the parameter of λ is restricted to [0,1] during optimization.
2. The unsupervised person re-identification method according to claim 1, characterized in that: The viewing angles include four types: v = {left, right, front, behind}.
3. The unsupervised person re-identification method according to claim 1, characterized in that: The global features are used to perform clustering at each perspective, specifically: Divide the training set X into subsets X = {X1..X c }; Calculate the similarity based on feature f for clustering in each subset; Assign pseudo labels generated by clustering to each subset, making the dataset a labeled dataset.
4. The unsupervised person re-identification method according to claim 1, characterized in that: The step S23 specifically includes: using the Pearson correlation coefficient to calculate the similarity between the two samples. Where cov is the covariance of two vectors, σ is the standard deviation of the two vectors; μ represents the mean; M and N represent two feature vectors extracted by the network model; Among them, p(k|f m , w c ) represents the kth classification probability obtained by the classifier, and the classification score S m is obtained by concatenating the classification scores from C classifiers; The c in the middle represents a certain perspective; After calculating the Pearson correlation coefficient, the similarity between the two samples is calculated by the formula SIM(f m ,f n )=dist(f m ,f n )+μ·ρ m,n Further, pseudo labels based on viewpoint similarity are generated, and then supervised training with pseudo labels is performed.
5. The unsupervised person re-identification method according to claim 4, characterized in that: The step S23 adds a memory bank to update the differences between instances. Specifically, each feature is initialized and stored in the memorybank. Then, each time the feature is updated, the memory is updated and the loss is calculated. The vector is updated from the perspective of the feature: c i ←m·c i +(1-m)·q Among them, instance q is the feature extracted this time, ci represents the feature of the same image stored in memory last time; m is the momentum update factor.
