An unsupervised person re-identification method based on online hierarchical clustering

The online hierarchical clustering method is used to simultaneously update pseudo labels and features, which solves the problem of mismatch between pseudo label accuracy and update rate in unsupervised pedestrian re-identification, and improves the accuracy and stability of the model.

CN113920536BActive Publication Date: 2024-10-08GUANGZHOU POWER SUPPLY BUREAU GUANGDONG POWER GRID CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111188153.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-12
Publication Date
2024-10-08
Estimated Expiration
2041-10-12

AI Technical Summary

Technical Problem

In existing unsupervised person re-identification methods, the accuracy of pseudo-label generation is not high enough, and the pseudo-label update rate does not match the feature update rate, making it difficult to achieve high accuracy after model training.

Method used

Using a method based on online hierarchical clustering, the pseudo labels are sequentially updated from low to high levels through the hierarchical clustering label library, and the pseudo labels and features are updated simultaneously to improve the accuracy of the pseudo labels and the model training effect.

Benefits of technology

It effectively improves the accuracy and stability of the unsupervised person re-identification model, ensures that the pseudo-label update rate matches the feature update rate, and improves the effect of person re-identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113920536B_ABST
    Figure CN113920536B_ABST
Patent Text Reader

Abstract

The present invention discloses an unsupervised pedestrian re-identification method based on online hierarchical clustering. The method comprises: collecting pedestrian sample images and forming a training set; inputting the training set into a pedestrian re-identification model and outputting the features of all pedestrian sample images; performing online hierarchical clustering on the features of all pedestrian sample images using an online hierarchical clustering method, generating pseudo labels corresponding to the training set, and then training the pedestrian re-identification model according to the pseudo labels, and obtaining a trained pedestrian re-identification model after iterative training; selecting a pedestrian image to be tested and extracting the features of the pedestrian image to be tested; calculating the cosine similarity between the features of the pedestrian image to be tested and the features of the remaining pedestrian images to be tested in the pedestrian data set to be tested, and retaining all pedestrian images to be tested that are higher than the preset similarity threshold according to a preset similarity threshold to achieve pedestrian re-identification. The present invention can complete the unsupervised pedestrian re-identification task with a high accuracy rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an unsupervised pedestrian re-identification method, in particular to an unsupervised pedestrian re-identification method based on online hierarchical clustering. Background Art

[0002] Person re-identification methods can search for specific pedestrians in large data sets and have a wide range of applications in real life. With the development of the times, the number of images in data sets has grown exponentially. Since the cost of manual labeling is very high and the speed of labeling is far behind the growth rate of data volume, unsupervised person re-identification methods are the future development trend. Unsupervised methods can make more full use of the advantages brought by large amounts of data, but the bottleneck today is that the accuracy of generating pseudo-labels is not high enough. At the same time, the current method has the problem of mismatch between pseudo-label update and feature update rate, making it difficult to obtain a high-accuracy model after training. Summary of the invention

[0003] In order to solve the problems in the background technology, the present invention proposes an unsupervised pedestrian re-identification method based on online hierarchical clustering. The online clustering adopted by the present invention is hierarchical clustering, which allows the sample pseudo-labels to be updated in sequence from low level to high level, so that the pseudo-label update rate can be synchronized with the sample feature update rate, and at the same time improves the accuracy of the pseudo-label. The effect of the unsupervised pedestrian re-identification model can be effectively improved, so that effective pedestrian re-identification can be performed with good stability.

[0004] The technical solution of the present invention comprises the following steps:

[0005] 1) Collect sample images of pedestrians, each of which contains only one pedestrian, and form a training set;

[0006] 2) The training set is input into the pedestrian re-identification model, and the pedestrian re-identification model outputs the features of all pedestrian sample images. After the features of all pedestrian sample images are clustered online using the online hierarchical clustering method, pseudo labels corresponding to the training set are generated. The pedestrian re-identification model is then trained based on the pseudo labels. After iterative training, a trained pedestrian re-identification model is obtained;

[0007] 3) Select a pedestrian image from the pedestrian data set and input it into the trained pedestrian re-identification model to extract the features of the pedestrian image;

[0008] 4) The remaining images of pedestrians to be tested in the pedestrian data set are input into the trained pedestrian re-identification model to extract the corresponding features, and the cosine similarity between the features of the pedestrian images to be tested and the features of the remaining pedestrian images to be tested in the pedestrian data set is calculated. According to the preset similarity threshold, all the pedestrian images to be tested that are higher than the preset similarity threshold are retained to achieve pedestrian re-identification.

[0009] The pedestrian sample images refer to images that take pedestrians as targets, and each image has only one complete pedestrian as the subject. The pedestrians in different pedestrian sample images may be the same person or multiple pedestrians may be taken by different persons.

[0010] The step 2) is specifically as follows:

[0011] 2.1) Assign the parameters of the pre-trained model on ImageNet to the pedestrian re-identification model,

[0012] 2.2) Input the training set into the pedestrian re-identification model, and the pedestrian re-identification model outputs the features of all pedestrian sample images;

[0013] 2.3) Use a density-based spatial clustering algorithm to globally cluster the features of all pedestrian sample images to obtain the initial pseudo-label of each pedestrian sample image in the training set;

[0014] 2.4) Create a hierarchical clustering tag library H that satisfies Where N H is the total number of levels, h j Represents the pseudo labels of all pedestrian sample images at the jth level, represents the pseudo label of the i-th pedestrian sample image at the j-th level; h 0 Represents level 0, Represents all pedestrian sample images in the Nth H Hierarchical pseudo-labels, N represents the total number of pedestrian sample images;

[0015] The pseudo label h of level 0 in the hierarchical clustering label library 0 Initialize to {1, 2, ..., N}, and use the initial pseudo-labels obtained in step 2.3) to initialize the pseudo-labels of all levels except the 0th level in the hierarchical clustering label library;

[0016] 2.5) After inputting the i-th pedestrian sample image in the training set into the current pedestrian re-identification model, the corresponding intermediate features are obtained. According to the features of the i-th pedestrian sample image and the intermediate features, the features of the i-th pedestrian sample image are calculated and updated by the following formula. The remaining pedestrian sample images in the training set are traversed to obtain the updated features of all pedestrian sample images;

[0017]

[0018] Among them, f i represents the updated features of the i-th pedestrian sample image, m represents the momentum term coefficient, and f′ i represents the features of the i-th pedestrian sample image before updating, Represents the intermediate features of the i-th pedestrian sample image;

[0019] 2.6) Based on the updated features of all pedestrian sample images and the initialized hierarchical clustering label library, the online hierarchical clustering method is used to update the pseudo labels of all pedestrian sample images and update the hierarchical clustering label library H, and then the loss is calculated based on the updated hierarchical clustering label library H. Finally, the pedestrian re-identification model is trained based on the loss to obtain the updated pedestrian re-identification model;

[0020] 2.7) Repeat steps 2.5)-2.6) to train the person re-identification model until the training is completed to obtain a trained person re-identification model.

[0021] In step 2.6), the pseudo labels of all pedestrian sample images are updated by using an online hierarchical clustering method and the hierarchical clustering label library H is updated. Specifically,

[0022] Based on the pseudo labels of the 0th level of all pedestrian sample images, all pedestrian sample images are labeled once and twice in turn, and the pseudo labels of the i-th pedestrian sample image in the hierarchical clustering label library H except the 0th level are obtained; all pedestrian sample images are traversed, and the labels are merged once and twice, and the pseudo labels of all pedestrian sample images in the hierarchical clustering label library H except the 0th level are obtained, and the hierarchical clustering label library H is updated.

[0023] The specific steps of merging labels for all pedestrian sample images are as follows:

[0024] First, the unit similarity matrix S is constructed based on the pseudo-labels of all pedestrian sample images in the h-1th level of the hierarchical clustering label library H, satisfying S∈R n×n , S∈R n×n The dimension of the unit similarity matrix is ​​n×n. The elements in the unit similarity matrix S are the cosine similarities between the central features of each minimum unit in the h-1th level of all pedestrian sample images, and n is the number of minimum units.

[0025] Next, the number of labels k at the hth level is preset max , construct the initial first label probability matrix Y 0 , satisfying Y 0 ∈R n ×K , Y 0 ∈Rn×K Denote the initial first label probability matrix as Y 0 with dimensions n×K, where K = min(n, k max ). When K = n, Y 0 is the identity matrix. When K < n, randomly select K minimum units from n minimum units. If the m-th minimum unit is selected, the value at the m-th row and k-th column of the initial first label probability matrix Y 0 satisfies (Y 0 ) mk = 1, otherwise (Y 0 ) mk = 0, where m = 1, 2,.., n and k = 1, 2,.., K;

[0026] Then, based on the cell similarity matrix S and the initial first label probability matrix Y 0 , use the label propagation algorithm to calculate the propagated first label probability matrix P * :

[0027] P * = (I - 0.99S) -1 Y 0

[0028] where I represents the identity matrix;

[0029] Finally, use the propagated label probability matrix P * to perform a single merge on the pseudo-labels at the (h - 1)-th level to obtain the single-merged pseudo-labels of all pedestrian sample images at the h-th level.

[0030] The specific process of the second merge of labels for all pedestrian sample images is as follows:

[0031] First, for the i-th pedestrian sample image, calculate the similarity between the updated features of all pedestrian sample images in the training set and the updated features of the i-th pedestrian sample image. Retain the p pedestrian sample images with the highest similarity and form a high-similarity sample set M. Calculate the central features of the pseudo-labels at the h-th level of the high-similarity sample set M based on the single-merged pseudo-labels at the h-th level of the high-similarity sample set M. Construct a label similarity matrix S' that satisfies S' ∈ R h , where S′ ∈ R q×q indicates that the dimension of the label similarity matrix is q×q. The elements in the label similarity matrix S' are the cosine similarities between the central features of each pair of pseudo-labels, and q is the number of pseudo-labels in the pseudo-label set L q×q at the h-th level of the high-similarity sample set M; h

[0032] ​Next, construct the initial second label probability matrix Y′ 0 , where Y′ 0 is the identity matrix of q×q;

[0033] Then, based on the label similarity matrix S' and the initial second label probability matrix Y' 0 , use the label propagation algorithm to calculate the second label probability matrix P' after propagation, select the row p' of the hth level pseudo label of the i-th pedestrian sample image in the second label probability matrix P' after propagation, satisfying p'∈R 1×q ; After the pseudo-labels in the row p′ of the h-th level of the pseudo-label of the i-th pedestrian sample image that are higher than the pseudo-label threshold σ are merged twice, the final pseudo-label of the h-th level of the i-th pedestrian sample image is obtained;

[0034] Finally, after traversing all pedestrian sample images, the final h-th level pseudo labels of all pedestrian sample images are obtained.

[0035] The specific method of calculating the loss in step 2.6) according to the updated hierarchical clustering label library H is as follows:

[0036]

[0037] Among them, L is the loss, f is the updated feature of the i-th pedestrian sample image, z + Represents the i-th pedestrian sample image in the Nth H The central feature of the pseudo-label of the hierarchy, <, > represents the dot product operation, c k Represents the Nth H The central feature of the kth pseudo-label at the level, n represents the Nth H The number of pseudo labels in the layer.

[0038] The beneficial effects of the present invention are:

[0039] 1) The present invention proposes a hierarchical clustering structure, namely a hierarchical clustering tag library, which can capture richer semantic information and effectively improve the clustering effect;

[0040] 2) The present invention proposes an online clustering algorithm, which can synchronize the model parameter update with the label update during person re-identification training, effectively improving the training accuracy of the model; BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is the overall flow chart of the present invention;

[0042] Figure 2 This is a flow chart of a one-time merging of tags in the present invention;

[0043] Figure 3This is a flow chart of secondary merging of tags in the present invention;

[0044] Figure 4 To illustrate the example of the visualization results of hierarchical labels after online clustering of the present method on the Market-1501 dataset;

[0045] Figure 5 This article provides an example of the hierarchical label visualization results after online clustering of the present method on the DukeMTMC-ReID dataset. DETAILED DESCRIPTION

[0046] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0047] like Figure 1 As shown, the present invention comprises the following steps:

[0048] 1) Collect sample images of pedestrians, each of which contains only one pedestrian, and form a training set;

[0049] Pedestrian sample images refer to images with pedestrians as the target. The subject of each image is only one complete pedestrian. The pedestrians in different pedestrian sample images are the same person or multiple pedestrians are taken by different people.

[0050] 2) The training set is input into the pedestrian re-identification model, and the pedestrian re-identification model outputs the features of all pedestrian sample images. After the features of all pedestrian sample images are clustered online using the online hierarchical clustering method, pseudo labels corresponding to the training set are generated. The pedestrian re-identification model is then trained based on the pseudo labels. After iterative training, a trained pedestrian re-identification model is obtained;

[0051] Step 2) is specifically as follows:

[0052] 2.1) Assign the parameters of the pre-trained model on ImageNet to the pedestrian re-identification model. Both the pre-trained model and the pedestrian re-identification model use ResNet50.

[0053] 2.2) Input the training set into the pedestrian re-identification model, and the pedestrian re-identification model outputs the features of all pedestrian sample images;

[0054] 2.3) Use the density-based spatial clustering algorithm (DBSCAN) to globally cluster the features of all pedestrian sample images and obtain the initial pseudo-label of each pedestrian sample image in the training set. y i represents the i-th pedestrian sample image, i represents the sample number, i=1,2…,N, N is the total number of pedestrian sample images in the training set;

[0055] 2.4) Create a hierarchical clustering tag library H that satisfies Where NH is the total number of layers, a fixed hyperparameter, h j Represents the pseudo labels of all pedestrian sample images at the jth level, represents the pseudo label of the i-th pedestrian sample image at the j-th level; h 0 Represents level 0, the lowest level, Represents all pedestrian sample images in the Nth H The pseudo-label of the level, i.e. the highest level, N represents the total number of pedestrian sample images;

[0056] The pseudo label of level 0 in the hierarchical clustering label library is h 0 Initialized to {1, 2, ..., N}, use the initial pseudo-labels obtained in step 2.3) to initialize the pseudo-labels of all levels except the 0th level in the hierarchical clustering label library, that is,

[0057] 2.5) After inputting the i-th pedestrian sample image in the training set into the current pedestrian re-identification model, the corresponding intermediate features are obtained According to the features and intermediate features of the i-th pedestrian sample image, the features of the i-th pedestrian sample image are calculated and updated by the following formula, and the remaining pedestrian sample images in the training set are traversed to obtain the updated features of all pedestrian sample images;

[0058]

[0059] Among them, f i represents the updated features of the i-th pedestrian sample image, m is the momentum term coefficient, the default value is 0.99, which is a fixed hyperparameter, and f′ i represents the features of the i-th pedestrian sample image before updating, Represents the intermediate features of the i-th pedestrian sample image;

[0060] 2.6) Based on the updated features of all pedestrian sample images and the initialized hierarchical clustering label library, the online hierarchical clustering method is used to update the pseudo labels of all pedestrian sample images and update the hierarchical clustering label library H, and then the loss is calculated based on the updated hierarchical clustering label library H, where the hierarchical clustering label library H is the pseudo label of all pedestrian sample images. Finally, the pedestrian re-identification model is trained based on the loss to obtain the updated pedestrian re-identification model;

[0061] In step 2.6), the online hierarchical clustering method is used to update the pseudo labels of all pedestrian sample images and update the hierarchical clustering label library H, specifically:

[0062] After performing the first and second merges of the labels on all pedestrian sample images in sequence based on the pseudo-labels at the 0th level of all pedestrian sample images, the pseudo-labels of the ith pedestrian sample image at other levels in the hierarchical clustering label library H except the 0th level are obtained. After traversing all pedestrian sample images and performing the first and second merges of the labels on all of them, the pseudo-labels of all pedestrian sample images at other levels in the hierarchical clustering label library H except the 0th level are obtained, and the hierarchical clustering label library H is updated.

[0063] Among them, in the first merge of the labels, when the label where the sample is located is not compact enough or the credibility is low, the accuracy of the label needs to be improved through the first merge. By calculating the central features corresponding to the labels, a similarity matrix and a label matrix are constructed. The label propagation algorithm is used to perform the first merge on the label corresponding to sample j at layer h, with the labels at layer (h - 1) as the unit, and the changed labels are updated. Subsequently, the label propagation algorithm is also used to merge the labels where the samples are located within a local range with other labels that may be of the same category.

[0064] As Figure 2 shown, the specific operation of performing the first merge of the labels on all pedestrian sample images is as follows:

[0065] Construct a unit similarity matrix S according to the pseudo-labels at the (h - 1)th level of all pedestrian sample images in the hierarchical clustering label library H, satisfying S ∈ R n×n , S ∈ R n×n indicating that the dimension of the unit similarity matrix is n×n, and the elements in the unit similarity matrix S are the cosine similarities between the central features of each minimum unit in all pedestrian sample images at the (h - 1)th level. n is the number of minimum units, and the calculation method of the central feature of the minimum unit is the average value of the features of the minimum unit, and the feature of the pedestrian sample image is the latest feature.

[0066] Preset the number of labels k max at the hth level, that is, the number of minimum units after the label merge at the hth level, and construct an initial first label probability matrix Y 0 , satisfying Y 0 ∈ R n×K , Y 0 ∈ R n×K indicating that the dimension of the initial first label probability matrix Y 0 is n×K, K = min(n, k max ), when K = n, Y 0 is the identity matrix. When K < n, randomly select K minimum units from n minimum units. If the mth minimum unit is selected, the value of the mth row and kth column in the initial first label probability matrix Y 0 satisfies (Y 0 ) mk = 1, otherwise (Y 0) mk =0, m=1,2,..,n, k=1,2,..K;

[0067] Based on the unit similarity matrix S and the initial first label probability matrix Y 0 , use the label propagation algorithm to calculate the first label probability matrix P after propagation * :

[0068] P * =(I-0.99S) -1 Y 0

[0069] Where I represents the identity matrix;

[0070] Using the propagated label probability matrix P * After merging the pseudo labels at the h-1th level, we obtain the merged pseudo labels of all pedestrian sample images at the hth level.

[0071] like Figure 3 As shown in the figure, the labels of all pedestrian sample images are merged twice, specifically:

[0072] For the i-th pedestrian sample image, calculate the similarity between the updated features of all pedestrian sample images in the training set and the updated features of the i-th pedestrian sample image, retain the p pedestrian sample images with the highest similarity and form a high-similarity sample set M, and calculate the h-th level pseudo-label set L of the high-similarity sample set M based on the h-th level merged pseudo-label of the high-similarity sample set M h The central features of each pseudo-label in the calculation method of the central features of each pseudo-label are the same as the calculation method of the central features of the minimum unit; construct the label similarity matrix S' according to the central features of each pseudo-label, satisfying S'∈R q×q , S′∈R q×q The dimension of the label similarity matrix is ​​q×q. The elements in the label similarity matrix S' are the cosine similarities between the central features of each pseudo-label. q is the pseudo-label set L of the hth level of the high-similarity sample set M. h The number of pseudo labels in

[0073] Construct the initial second label probability matrix Y′ 0 , where Y′ 0 is the identity matrix of q×q;

[0074] Based on the label similarity matrix S' and the initial second label probability matrix Y' 0, use the label propagation algorithm to calculate the second label probability matrix P' after propagation, select the row p' of the hth level pseudo label of the i-th pedestrian sample image in the second label probability matrix P' after propagation, satisfying p'∈R 1×q ; After the pseudo-labels in the row p′ of the h-th level of the pseudo-label of the i-th pedestrian sample image that are higher than the pseudo-label threshold σ are merged twice, the final pseudo-label of the h-th level of the i-th pedestrian sample image is obtained;

[0075] After traversing all pedestrian sample images, the final h-th level pseudo labels of all pedestrian sample images are obtained.

[0076] The specific method of calculating the loss in step 2.6) based on the updated hierarchical clustering label library H is:

[0077]

[0078] Among them, L is the loss, f is the updated feature of the i-th pedestrian sample image, z + Represents the i-th pedestrian sample image in the Nth H The central feature of the pseudo-label of the hierarchy, <, > represents the dot product operation, c k Represents the Nth H The central feature of the kth pseudo-label at the level, n represents the Nth H The number of pseudo labels in the layer.

[0079] 2.7) Repeat steps 2.5)-2.6) to train the person re-identification model until the training is completed to obtain a trained person re-identification model.

[0080] 3) Select a pedestrian image from the pedestrian data set and input it into the trained pedestrian re-identification model to extract the high-dimensional features of the pedestrian image;

[0081] 4) The remaining images of pedestrians to be tested in the pedestrian data set are input into the trained pedestrian re-identification model to extract the corresponding features, and the cosine similarity between the features of the pedestrian images to be tested and the features of the remaining pedestrian images to be tested in the pedestrian data set is calculated. According to the preset similarity threshold, all the pedestrian images to be tested that are higher than the preset similarity threshold are retained to achieve pedestrian re-identification.

[0082] Embodiments of the present invention are as follows:

[0083] The training set and test set in the experimental data set are all public data sets: Market-1501, DukeMTMC-ReID and MSMT17. The Market-1501 training set contains 12,936 images (751 label categories in total), and the test set contains 19,732 images (750 label categories in total). The DukeMTMC-ReID training set contains 16,522 images (702 label categories in total), and the test set contains 19,889 images (702 label categories in total). The MSMT17 training set contains 32,621 images, corresponding to 1,041 label categories. The test set contains 93,820 images, corresponding to 3,060 label categories.

[0084] The model backbone network uses ResNet50, and uses the pre-trained model on ImageNet for parameter initialization. The output feature dimension is 2048. The model optimizer uses Adam with a weight decay of 0.0005, and the initial learning rate is set to 3.5×10 -4 , and reduced to 0.1 of the current learning rate at 8000 and 16000 iterations, for a total of 24000 iterations. 64 samples are input for training in each iteration, and 64 samples correspond to N H The number of layer labels is not less than 16, and the size of the input model is 256 × 128. τ in the loss function is set to 0.05, and the momentum term m for updating features in M ​​is set to 0.2. H Set to 3, KNN searches for 64 nearby samples, and α in the label propagation formula is 0.99. When merging labels once, at most 8 sub-labels are merged at a time. When merging labels twice, k' in the similarity matrix is ​​30, and σ is set to 0.25.

[0085] Table 1, Table 2, and Table 3 show the results of the present invention on Market-1501, DukeMTMC-ReID, and MSMT17, respectively. In order to make a fairer comparison, we use the commonly used mAP (mean average precision) and CMC (cumulative matching characteristic) indicators for test evaluation. No post-processing operations are included in the test.

[0086] Table 1 Evaluation results of Market-1501 dataset

[0087] mAP Rank-1 Rank-5 Rank-10 78.1 91.1 96.4 97.7

[0088] Table 2 Evaluation results of DukeMTMC-ReID dataset

[0089] mAP Rank-1 Rank-5 Rank-10 65.6 79.8 88.6 91.6

[0090] Table 3 Evaluation results of MSMT17 dataset

[0091] mAP Rank-1 Rank-5 Rank-10 26.9 53.7 65.3 70.2

[0092] Compared with other current unsupervised person re-identification methods, the present invention achieves better results on three public datasets.

[0093] Figure 1 and Figure 2 The visualization results of different levels of labels after online clustering of the Market-1501 dataset and the DukeMTMC-ReID dataset are shown. It can be seen that as the level increases, the pedestrian forms contained in the same label are more diverse and rich, and the recall rate is higher.

[0094] It can be seen that the present invention can obtain better and more excellent results in the pedestrian re-identification task by synchronously updating the sample features of the dataset and the pseudo-labels for training, and adopting the pseudo-label generation method based on hierarchical clustering.

[0095] The above specific implementation modes are used to explain the present invention rather than to limit the present invention. Any modification and change made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.

Claims

1. An unsupervised person re-identification method based on online hierarchical clustering, The following steps are involved: 1) Collect sample images of pedestrians, each of which contains only one pedestrian, and form a training set; 2) The training set is input into the pedestrian re-identification model, and the pedestrian re-identification model outputs the features of all pedestrian sample images. After the features of all pedestrian sample images are clustered online using the online hierarchical clustering method, pseudo labels corresponding to the training set are generated. The pedestrian re-identification model is then trained based on the pseudo labels. After iterative training, a trained pedestrian re-identification model is obtained; 3) Select a pedestrian image from the pedestrian data set and input it into the trained pedestrian re-identification model to extract the features of the pedestrian image; 4) Input the remaining images of the pedestrians to be tested in the pedestrian data set into the trained pedestrian re-identification model to extract the corresponding features, calculate the cosine similarity between the features of the pedestrian images to be tested and the features of the remaining images of the pedestrians to be tested in the pedestrian data set, and retain all the images of the pedestrians to be tested that are higher than the preset similarity threshold according to the preset similarity threshold to achieve pedestrian re-identification; The step 2) is specifically as follows: 2.1) Assign the parameters of the pre-trained model on ImageNet to the pedestrian re-identification model, 2.2) Input the training set into the pedestrian re-identification model, and the pedestrian re-identification model outputs the features of all pedestrian sample images; 2.3) Use a density-based spatial clustering algorithm to globally cluster the features of all pedestrian sample images to obtain the initial pseudo-label of each pedestrian sample image in the training set; 2.4) Create a hierarchical clustering tag library H that satisfies Where N H is the total number of levels, h j Represents the pseudo labels of all pedestrian sample images at the jth level, represents the pseudo label of the i-th pedestrian sample image at the j-th level; h 0 Represents level 0, Represents all pedestrian sample images in the Nth H Hierarchical pseudo-labels, N represents the total number of pedestrian sample images; The pseudo label h of level 0 in the hierarchical clustering label library 0 Initialize to {1, 2, ..., N}, and use the initial pseudo-labels obtained in step 2.3) to initialize the pseudo-labels of all levels except the 0th level in the hierarchical clustering label library; 2.5) After inputting the i-th pedestrian sample image in the training set into the current pedestrian re-identification model, the corresponding intermediate features are obtained. According to the features of the i-th pedestrian sample image and the intermediate features, the features of the i-th pedestrian sample image are calculated and updated by the following formula. The remaining pedestrian sample images in the training set are traversed to obtain the updated features of all pedestrian sample images; Among them, f i represents the updated features of the i-th pedestrian sample image, m represents the momentum term coefficient, and f i ′ represents the features of the i-th pedestrian sample image before updating, Represents the intermediate features of the i-th pedestrian sample image; 2.6) Based on the updated features of all pedestrian sample images and the initialized hierarchical clustering label library, the online hierarchical clustering method is used to update the pseudo labels of all pedestrian sample images and update the hierarchical clustering label library H, and then the loss is calculated based on the updated hierarchical clustering label library H. Finally, the pedestrian re-identification model is trained based on the loss to obtain the updated pedestrian re-identification model; 2.7) Repeat steps 2.5)-2.6) to train the person re-identification model until the training is completed to obtain a trained person re-identification model.

2. The unsupervised person re-identification method based on online hierarchical clustering according to claim 1, Features: The pedestrian sample images refer to images that take pedestrians as targets, and each image has only one complete pedestrian as the subject. The pedestrians in different pedestrian sample images may be the same person or multiple pedestrians may be taken by different persons.

3. The unsupervised person re-identification method based on online hierarchical clustering according to claim 1, Features: In step 2.6), the pseudo labels of all pedestrian sample images are updated by using an online hierarchical clustering method and the hierarchical clustering label library H is updated. Specifically, Based on the pseudo labels of the 0th level of all pedestrian sample images, all pedestrian sample images are labeled once and twice in sequence, and the pseudo labels of the i-th pedestrian sample image in the hierarchical clustering label library H except the 0th level are obtained; After traversing all pedestrian sample images and performing the first and second merging of labels, the pseudo labels of all pedestrian sample images in the hierarchical clustering label library H except the 0th level are obtained, and the hierarchical clustering label library H is updated.

4. The unsupervised person re-identification method based on online hierarchical clustering according to claim 3, It is characterized in that The specific steps of merging labels for all pedestrian sample images are as follows: First, the unit similarity matrix S is constructed based on the pseudo-labels of all pedestrian sample images in the h-1th level of the hierarchical clustering label library H, satisfying S∈R n×n , S∈R n×n The dimension of the unit similarity matrix is ​​n×n. The elements in the unit similarity matrix S are the cosine similarities between the central features of each minimum unit in the h-1th level of all pedestrian sample images, and n is the number of minimum units. Next, preset the number of tags k at the h-th level max , and construct the initial first label probability matrix Y 0 , satisfying Y 0 ∈R n×K , Y 0 ∈R n×K represents the initial first label probability matrix Y 0 has a dimension of n×K, where K = min(n, k max ), when K = n, Y 0 is the identity matrix, when K < n, randomly select K minimum units from n minimum units, then select the m-th minimum unit, and the value of the m-th row and k-th column in the initial first label probability matrix Y 0 satisfies (Y 0 ) mk = 1, otherwise (Y 0 ) mk = 0, m = 1, 2,.., n, k = 1, 2,..K; Then, based on the unit similarity matrix S and the initial first label probability matrix Y 0 , use the label propagation algorithm to calculate the first label probability matrix P after propagation * : P * =(I-0.99S) -1 AND 0 Where I represents the identity matrix; Finally, using the propagated label probability matrix P * After merging the pseudo labels at the h-1th level, we obtain the merged pseudo labels of all pedestrian sample images at the hth level.

5. The unsupervised person re-identification method based on online hierarchical clustering according to claim 3, It is characterized in that The secondary merging of labels for all pedestrian sample images is specifically as follows: First, for the i-th pedestrian sample image, the similarity between the updated features of all pedestrian sample images in the training set and the updated features of the i-th pedestrian sample image is calculated, and the p pedestrian sample images with the highest similarity are retained to form a high-similarity sample set M. Based on the h-th level merged pseudo-label of the high-similarity sample set M, the h-th level pseudo-label set L of the high-similarity sample set M is calculated. h The central features of each pseudo-label in; construct a label similarity matrix S' based on the central features of each pseudo-label, satisfying S'∈R q×q , S′∈R q×q The dimension of the label similarity matrix is ​​q×q. The elements in the label similarity matrix S' are the cosine similarities between the central features of each pseudo-label. q is the pseudo-label set L of the hth level of the high-similarity sample set M. h The number of pseudo labels in Next, construct the initial second label probability matrix Y 0 ′, where Y 0 ′ is the identity matrix of q×q; Then, based on the label similarity matrix S' and the initial second label probability matrix Y 0 ′, use the label propagation algorithm to calculate the second label probability matrix P' after propagation, select the row p' of the hth level pseudo label of the i-th pedestrian sample image in the second label probability matrix P' after propagation, satisfying p'∈R 1×q ; After the pseudo-labels in the row p′ of the h-th level of the pseudo-label of the i-th pedestrian sample image that are higher than the pseudo-label threshold σ are merged twice, the final pseudo-label of the h-th level of the i-th pedestrian sample image is obtained; Finally, after traversing all pedestrian sample images, the final h-th level pseudo labels of all pedestrian sample images are obtained.

6. The unsupervised person re-identification method based on online hierarchical clustering according to claim 1, Features: The specific method of calculating the loss in step 2.6) according to the updated hierarchical clustering label library H is as follows: Among them, L is the loss, f is the updated feature of the i-th pedestrian sample image, z + Represents the i-th pedestrian sample image in the Nth H The central feature of the pseudo-label of the hierarchy, <,> represents the dot product operation, c k Represents the Nth H The central feature of the kth pseudo-label at the level, q represents the Nth H The number of pseudo labels in the layer.