Disclosure of Invention
The invention aims to provide a pedestrian re-identification method based on typical correlation analysis fusion characteristics, which solves the problems of high result dimension, a large amount of redundant information and complex calculation of fusion characteristics in the prior art.
The technical scheme adopted by the invention is that the pedestrian re-identification method based on typical correlation analysis fusion characteristics comprises three stages: a feature extraction stage, a mapping matrix solving stage and a pedestrian re-identification stage by fusing features; in the feature extraction stage, extracting two different features X and Y from a pedestrian image; in the stage of solving the mapping matrix, the two features X and Y are respectively subjected to typical correlation analysis to obtain a pair of mapping matrices α and β, and the new feature is expressed as X' =α T X,Y'=β T Y,α T To map the transpose of matrix alpha, beta T Transpose of the mapping matrix β; in the pedestrian re-recognition stage of the fusion feature, the fusion feature is expressed asOr Z is 2 =x '+y', fusing feature Z 1 Or Z is 2 The method comprises the steps of dividing a training set and a testing set, training a pedestrian re-identification model by using the training set, and testing the trained model by using the testing set.
The invention is also characterized in that:
the method comprises the following specific steps:
step 1, extracting two characteristics from a pedestrian re-identification data set:
extracting features from the dataset of the pedestrian image by using different feature extraction algorithms, respectively marking as:
X∈R p*N ,Y∈R q*N
p and q represent dimensions of two features, respectively, and N represents the number of pictures contained in the dataset;
step 2, respectively carrying out typical correlation analysis on the two features X and Y extracted in the step 1, and solving by a singular value decomposition method to obtain a pair of featuresMapping matrices α and β, the new feature is expressed as X' =α T X,Y'=β T Y,α T To map the transpose of matrix alpha, beta T Transpose of the mapping matrix β;
step 3, pedestrian re-identification is carried out by using the fusion characteristics:
step 3.1, obtaining fusion expression of typical relevant characteristics through the following fusion strategy through the mapping matrixes alpha and beta obtained in step 2Or Z is 2 =X'+Y'=α T X+β T Y, feature Z of fusion 1 Or Z is 2 Dividing the different data sets into a training set I and a testing set I of a visual angle I, a training set II and a testing set II of the visual angle II according to the dividing rule of the different data sets in the pedestrian re-identification, training a model of the pedestrian re-identification by using the training set I and the training set II, and testing the trained model by using the testing set I and the testing set II;
and 3.2, evaluating the test result in the step 3.1 by using the cumulative matching curve CMC, and taking the identification rate of rank1 as the most important evaluation index, wherein the larger the value of rank1 is, the better the identification effect is.
In the step 2, a singular value decomposition method is used for solving a projection matrix, and the solving process is as follows:
1) Normalizing the two features to obtain standard data with a mean value of 0 and a variance of 1;
2) Calculating the variance S of X XX Variance S of Y YY Covariance S of X and Y XY ;
3) Calculating a matrix
4) Singular value decomposition is carried out on the matrix M to obtain a maximum singular value sigma, and left and right singular vectors u and v corresponding to the maximum singular value;
5) Calculating mapping matrices alpha and beta for X and Y,
6) The representation of the two features in the correlation subspace is X' =α T X,Y'=β T Y。
The specific process for solving the projection matrix by using the singular value decomposition method in the step 2 is as follows:
(1) Let the mapping matrices of X and Y be α and β, respectively, their representation in subspace be: x' =α T X and Y' =β T Y, their correlation coefficients can be expressed as:
the objective function is:
namely solving mapping matrixes alpha and beta corresponding to the maximum correlation coefficient;
(2) Before projection, the original data is normalized first to obtain data with mean value of 0 and variance of 1,
Cov(α T X,β T Y)=E(<α T X,β T Y>)=E((α T X)(β T Y) T )=α T E(XY T )β
similarly, var (. Beta.) T Y)=β T E(YY T )β,μ x Is the mean value of X;
(3) Since the average value of X and Y is 0, then
Var(X)=Cov(X,X)=E(XX T )
Var(Y)=Cov(Y,Y)=E(YY T )
Cov(X,Y)=E(XY T )
Cov(Y,X)=E(YX T );
(4) Let S XX =Var(X,X),S YY =Var(Y,Y),S XY =cov (X, Y), then the objective function is converted into
(5) Since the numerator denominator is increased by the same multiple, the optimization target result is unchanged, the denominator is fixed, and the numerator is optimized, namely:
s.t.α T S XX α=1,β T S YY β=1;
(6) When solving the objective function in (5), adopting a singular value decomposition method, wherein u and v are two unit vectors,
order the
Alpha is then T S XX α=1,β T S YY β=1,
At the same time, from alpha T S XX α=1, obtainable:
from beta T S YY Beta=1, obtainable:
at this time, the objective function is:
s.t.u T u=1,v T v=1;
(7) For the objective function in (6), let the matrixAt this time, U and V represent left and right singular vectors corresponding to a singular value of the matrix M, and m=u Σv is obtained by singular value decomposition T Wherein U, V are respectively the matrix composed of the left singular vector and the right singular vector of M, and Sigma is the diagonal matrix composed of the singular values of M; since all columns of U, V are orthonormal, then U T U and V T v gets a vector with only one scalar 1 and the remaining scalar 0; at this time, the liquid crystal display device,
maximization ofThe corresponding maximum value is the maximum value of the singular values corresponding to a certain group of left and right singular vectors, namely after M is subjected to singular value decomposition, the maximum singular value is the maximum value of an optimization target, namely the maximum correlation coefficient between X and Y;
(8) The mapping matrix of original X and Y is obtained by using the corresponding left and right singular vectors u, v
In the step 3.1, an XQDA algorithm is used in the process of training the pedestrian re-identification model, and a training set and a training sample label are taken as inputs and output as subspace mapping matrixes W and WWherein Sigma 'is' I Is an intra-class covariance matrix, sigma' E Is an inter-class covariance matrix;
during testing, the mahalanobis distance is used for measuring the similarity between two pedestrian images, and the mapping of M and the training features on the subspace W is input to obtain the mahalanobis distance of the original features on the subspace.
The beneficial effects of the invention are as follows: the invention discloses a pedestrian re-identification method based on characteristic fusion of typical correlation analysis. Aiming at the problems of high dimension, large amount of redundant information and complex calculation of the fusion result of the current fusion feature method, the typical correlation analysis algorithm is used for analyzing the internal relations among different features of the same target and searching for a linear combination of the features, so that most of information of the original features is reserved by the new features, and the new features have the maximum correlation with the other new features. The two new features are fused according to a certain strategy, so that the purpose of feature fusion is achieved, and redundant information among the features is eliminated.
Detailed Description
The invention will be described in detail below with reference to the drawings and the detailed description.
The invention relates to a pedestrian re-identification method based on typical correlation analysis fusion characteristics, which comprises three stages as shown in fig. 1: a feature extraction stage, a mapping matrix solving stage and a pedestrian re-identification stage by fusing features; in the feature extraction stage, extracting two different features X and Y from a pedestrian image; in the stage of solving the mapping matrix, the two features X and Y are respectively subjected to typical correlation analysis to obtain a pair of mapping matrices α and β, and the new feature is expressed as X' =α T X,Y'=β T Y,α T To map the transpose of matrix alpha, beta T Transpose of the mapping matrix β; in fusion withThe pedestrian re-identification stage is carried out by combining features, and the combined features are expressed asOr Z is 2 =x '+y', fusing feature Z 1 Or Z is 2 The method comprises the steps of dividing a training set and a testing set, training a pedestrian re-identification model by using the training set, and testing the trained model by using the testing set.
The invention discloses a pedestrian re-identification method based on typical correlation analysis fusion characteristics, which comprises the following specific steps:
step 1, extracting two characteristics from a pedestrian re-identification data set:
extracting features from the dataset of the pedestrian image by using different feature extraction algorithms, respectively marking as:
X∈R p*N ,Y∈R q*N
p and q represent dimensions of two features, respectively, and N represents the number of pictures contained in the dataset;
step 2, respectively performing typical correlation analysis on the two features X and Y extracted in the step 1, and solving by using a singular value decomposition method to obtain a pair of mapping matrixes alpha and beta, wherein the new features are expressed as X' =alpha T X,Y'=β T Y,α T To map the transpose of matrix alpha, beta T Transpose of the mapping matrix β;
step 3, pedestrian re-identification is carried out by using the fusion characteristics:
step 3.1, obtaining fusion expression of typical relevant characteristics through the following fusion strategy through the mapping matrixes alpha and beta obtained in step 2Or Z is 2 =X'+Y'=α T X+β T Y, feature Z of fusion 1 Or Z is 2 Dividing the different data sets into a training set I and a testing set I of a visual angle I, a training set II and a testing set II of the visual angle II according to the dividing rule of the different data sets in the pedestrian re-identification, training a model of the pedestrian re-identification by using the training set I and the training set II, and testing the trained model by using the testing set I and the testing set II;
and 3.2, evaluating the test result in the step 3.1 by using the cumulative matching curve CMC, and taking the identification rate of rank1 as the most important evaluation index, wherein the larger the value of rank1 is, the better the identification effect is.
In the step 2, a singular value decomposition method is used for solving a projection matrix, and the solving process is as follows:
1) Normalizing the two features to obtain standard data with a mean value of 0 and a variance of 1;
2) Calculating the variance S of X XX Variance S of Y YY Covariance S of X and Y XY ;
3) Calculating a matrix
4) Singular value decomposition is carried out on the matrix M to obtain a maximum singular value sigma, and left and right singular vectors u and v corresponding to the maximum singular value;
5) Calculating mapping matrices alpha and beta for X and Y,
6) The representation of the two features in the correlation subspace is X' =α T X,Y'=β T Y。
The specific process for solving the projection matrix by using the singular value decomposition method in the step 2 is as follows:
(1) Let the mapping matrices of X and Y be α and β, respectively, their representation in subspace be: x' =α T X and Y' =β T Y, their correlation coefficients can be expressed as:
the objective function is:
namely solving mapping matrixes alpha and beta corresponding to the maximum correlation coefficient;
(2) Before projection, the original data is normalized first to obtain data with mean value of 0 and variance of 1,
Cov(α T X,β T Y)=E(<α T X,β T Y>)=E((α T X)(β T Y) T )=α T E(XY T )β
similarly, var (. Beta.) T Y)=β T E(YY T )β,μ x Is the mean value of X;
(3) Since the average value of X and Y is 0, then
Var(X)=Cov(X,X)=E(XX T )
Var(Y)=Cov(Y,Y)=E(YY T )
Cov(X,Y)=E(XY T )
Cov(Y,X)=E(YX T );
(4) Let S XX =Var(X,X),S YY =Var(Y,Y),S XY =cov (X, Y), then the objective function is converted into
(5) Since the numerator denominator is increased by the same multiple, the optimization target result is unchanged, the denominator is fixed, and the numerator is optimized, namely:
s.t.α T S XX α=1,β T S YY β=1;
(6) When solving the objective function in (5), adopting a singular value decomposition method, wherein u and v are two unit vectors,
order the
Alpha is then T S XX α=1,β T S YY β=1,
At the same time, from alpha T S XX α=1, obtainable:
from beta T S YY Beta=1, obtainable:
at this time, the objective function is:
s.t.u T u=1,v T v=1;
(7) For the objective function in (6), let the matrixAt this time, U and V represent left and right singular vectors corresponding to a singular value of the matrix M, and m=u Σv is obtained by singular value decomposition T Wherein U, V are respectively the matrix composed of the left singular vector and the right singular vector of M, and Sigma is the diagonal matrix composed of the singular values of M; since all columns of U, V are orthonormal, then U T U and V T v gets a vector with only one scalar 1 and the remaining scalar 0; at this time, the liquid crystal display device,
maximization ofThe corresponding maximum value is the maximum value of the singular values corresponding to a certain group of left and right singular vectors, namely after M is subjected to singular value decomposition, the maximum singular value is the maximum value of an optimization target, namely the maximum correlation coefficient between X and Y;
(8) The mapping matrix of original X and Y is obtained by using the corresponding left and right singular vectors u, v
In the step 3.1, an XQDA algorithm is used in the process of training the pedestrian re-identification model, and a training set and a training sample label are taken as inputs and output as subspace mapping matrixes W and WWherein Sigma 'is' I Is an intra-class covariance matrix, sigma' E Is an inter-class covariance matrix;
during testing, the mahalanobis distance is used for measuring the similarity between two pedestrian images, and the mapping of M and the training features on the subspace W is input to obtain the mahalanobis distance of the original features on the subspace.
The pedestrian re-identification method based on typical correlation analysis fusion characteristics has the advantages that: in the method, a typical correlation analysis and fusion strategy is adopted in a feature fusion stage, so that the maximum correlation of different spatial features in a public subspace is analyzed, the maximum correlation feature between two features is used as discrimination information, redundant information is effectively eliminated while features are fused, and the calculated amount and difficulty are reduced.
Example 1
The invention discloses a pedestrian re-identification method based on typical correlation analysis fusion characteristics, which is implemented according to the following steps:
step 1: extracting two features from pedestrian re-identification dataset
A pedestrian re-identification dataset VIPeR is used, which contains 632 pairs of images of pedestrians, 1264 in total, each pair containing two pictures of a person from different perspectives, and each image being scaled to a size of 128 x 48 pixels, the dataset being extracted WHOS (Weighted Histogram of Overlapping Stripes) features and LOMO (Local Maximal Occurrence) features in combination with existing feature extraction means.
Step 2: the characteristic is subjected to typical correlation analysis, a mapping matrix is solved, and the process of solving by a singular value decomposition method is as follows:
1) Normalizing the two features to obtain standard data with a mean value of 0 and a variance of 1;
2) Calculating the variance S of X XX Variance S of Y YY Covariance S of X and Y XY ;
3) Calculating a matrix
4) Singular value decomposition is carried out on the matrix M to obtain a maximum singular value sigma, and left and right singular vectors u and v corresponding to the maximum singular value;
5) Calculating mapping matrices alpha and beta for X and Y,
6) The representation of the two features in the correlation subspace is X' =α T X,Y'=β T Y。
Step 3: the fusion characteristics are used for pedestrian re-identification, and the specific process is as follows:
1) Fusion feature Z ε R d*N Where d is the dimension of the fused feature, N is the number of pictures contained in the dataset, and the fused feature is represented asOr Z is 2 =X'+Y'=α T X+β T For the VIPeR dataset, n=1264, with 1-632 columns of features as the query set and 633-1264 columns of features as the candidate set;
2) For the query set and the candidate set, 316 columns of features are randomly selected as two training sets, and the rest 316 columns are two test sets;
3) The recognition process uses an XQDA (Cross-view Quadratic Discriminant Analysis) algorithm, takes a training set and a training sample label as inputs and outputs as subspace mapping matrices W andwherein Sigma 'is' I Is an intra-class covariance matrix, sigma' E Is an inter-class covariance matrix;
4) During testing, the similarity between two pedestrian images is measured by using the mahalanobis distance, and the mahalanobis distance of the original feature in the subspace can be obtained by inputting the M and the mapping of the training feature on the subspace W;
5) As shown in fig. 2 and 3, CMC curves are used as evaluation results, and rank1, rank5, rank10, rank20 are used as evaluation indexes, wherein the rank1 value is particularly important in evaluating the effect of pedestrian re-recognition.