A cross-domain person re-identification method based on deep learning
By using technical means such as collaborative training and time-series domain relationships in cross-domain pedestrian recognition, the problem of failing to fully utilize source domain knowledge in the prior art is solved, and high accuracy discrimination on the unlabeled target domain is achieved.
Patent Information
- Application Number
- CN202210554612.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-19
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2042-05-19
AI Technical Summary
The prior art is difficult to fully utilize domain sharing knowledge of the source domain on unlabeled target domains, resulting in poor discrimination.
The cross-domain pedestrian re-identification method based on deep learning is adopted. Through a collaborative training strategy, the target domain data with pseudo-labels and source domain data with real annotations are used in each iteration. Combined with the time-series domain relationship and sort-guided sample selection method, the training weight of the source domain samples is controlled to reduce the impact of domain-specific knowledge.
Effectively utilize source domain knowledge to improve discriminant accuracy on unlabeled target domains, and significantly improve the model's test performance on the target domain.
Smart Images

Figure CN114882531B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of pedestrian re-identification, and in particular to a cross-domain pedestrian re-identification method based on deep learning. Background Art
[0002] The current pedestrian re-identification task aims to retrieve specific pedestrians across cameras. Due to its important application in intelligent surveillance, the pedestrian re-identification task has now become one of the research hotspots in the field of computer vision. In recent years, supervised pedestrian re-identification methods have achieved satisfactory performance. However, when the training pedestrian samples and the test pedestrian samples come from different datasets, the performance of most supervised methods will drop significantly. In the real world, the annotation of pedestrian data is both expensive and time-consuming. Therefore, the unsupervised cross-domain pedestrian re-identification task has attracted much attention from scholars.
[0003] The goal of unsupervised cross-domain person re-identification is to transfer discriminative knowledge from the source domain to the unlabeled target domain, and it is expected that the test results of the model in the target domain are comparable to those of supervised methods. Due to the large inter-domain differences between the source and target domains, this task is also very challenging. So far, clustering-based cross-domain person re-identification methods have made great progress, and most of the existing state-of-the-art methods are clustering-based methods; these methods can generally be divided into two stages: 1) using labeled source domain data for supervised pre-training of models; 2) using clustering algorithms on the target domain to assign pseudo-labels and iteratively fine-tune the pre-trained model.
[0004] However, the iteratively trained person re-identification model in the fine-tuning stage will gradually forget the discriminative knowledge from the source domain, which is catastrophic forgetting. Through observation, this phenomenon can be explained from two aspects: 1) As the number of model iterations in the fine-tuning stage increases, its test results on the source domain gradually decrease; 2) Simply removing the pre-training part only brings a small performance degradation for most clustering methods. Therefore, it can be inferred that most existing clustering-based methods do not fully utilize the discriminative knowledge on the source domain; however, the discriminative knowledge from the source domain is very important for improving the performance of the model on the target domain. Summary of the invention
[0005] In view of the above problems existing in the prior art, the technical problem to be solved by the present invention is that the domain shared knowledge in the source domain cannot be fully utilized, resulting in poor discrimination of the prior art in the unlabeled target domain.
[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0007] A cross-domain pedestrian re-identification method based on deep learning includes the following steps:
[0008] S100: Select public datasets A and B, and use dataset A as the source domain D s , the formula is as follows:
[0009]
[0010] in, represents the i-th source domain sample, represents the true label corresponding to the i-th source domain sample, n s represents the total number of source domain samples;
[0011] Select part of the data in dataset B as the target domain training set D T , D T The expression is as follows:
[0012]
[0013] in, represents the jth target domain sample, n t represents the total number of samples in the target domain;
[0014] S200: Select ResNet-50 model M, which consists of two modules. Module 1 is the online feature encoder f(·|θ t ), θ t are the relevant parameters of module one, and module two is the momentum feature encoder are the relevant parameters of module 2;
[0015] Use the dataset ImageNet to initialize the parameters of model M and obtain the initialized model M′;
[0016] S300: Calculate the loss of the initialization model M′ using the loss function;
[0017] S400: using the source domain and the target domain as inputs of the initialization model M′ to train the model M′, updating the parameters in M′ according to the loss calculated in S300, stopping the training when the maximum number of training times is reached, and obtaining the trained model M″;
[0018] S500: Input the pedestrian image to be predicted into the trained model M″ to obtain the pedestrian retrieval result.
[0019] Preferably, the loss function of the initialization model M′ in S300 is as follows:
[0020] S310: Using momentum feature encoder for D T The features of the data in N are extracted and saved in the memory feature library N, and then the DBSCAN clustering algorithm is used to cluster all the features in N and generate One-to-one pseudo-labels
[0021] S320: Use the temporal domain relationship strategy to calculate the training weight w of each iteration of the source domain d (i) The maximum training weight of the source domain for each iteration is preset to be t1 and the minimum is t2, where t1>t2. The calculation expression is as follows:
[0022]
[0023] w d (i) = (1 - s (i)) × t1 + s (i) × t2
[0024] The symbol % represents the modulo operation, i represents the i-th training, e represents the maximum number of training times, and w d (i) represents the training weight of the source domain in the i-th iteration training, s(i) represents the length of each part after t1 and t2 are equally divided;
[0025] S330: Calculate the training weight of each source domain sample using the ranking-guided selection strategy The specific steps are as follows:
[0026] S331: Randomly select a source domain sample from the source domain Ds And use the line feature encoder f(·|θ t )right Extract features, and then use the category classifier of the target domain and the category classifier of the source domain to classify Classify and calculate separately Probability distribution of classification in the target domain and the probability distribution of classification on the source domain The calculation expression is as follows:
[0027]
[0028]
[0029] in, express The probability distribution of classification in the target domain, C t represents the category classifier on the target domain, c p Represents the number of categories of pseudo labels on the target domain; Representative samples The probability distribution of classification on the source domain, c s is the number of categories of the true label in the source domain, C s represents the category classifier on the target domain;
[0030] S332: Calculation The similarity score Si with the target domain is expressed as follows:
[0031]
[0032] Among them, c p Represents the number of categories of pseudo labels on the target domain;
[0033] S333: Calculate the similarity scores of all source domain samples and the target domain to form a similarity score set Then, all similarity scores are sorted in descending order, and the source domain samples corresponding to the top k% similarity scores are taken as the reliability sample set δ s , the expression is as follows:
[0034]
[0035] Among them, τ s represents the similarity score of the k% source domain samples;
[0036] S334: Definition The maximum and second largest category probabilities in the source domain are and calculate The uncertainty U in the source domain i , the expression is as follows:
[0037]
[0038] S335: Calculate the uncertainty values of all source domain samples to form an uncertainty value set Then, all uncertainty values are sorted in ascending order, and the source domain samples corresponding to the top k% uncertainty values are taken as the uncertainty sample set δ u , the expression is as follows:
[0039]
[0040] S336: Combine formula (6) and formula (8) to obtain the training weight of each source domain sample The expression is as follows:
[0041]
[0042] S340: Calculate the cross entropy loss of the source domain based on the source domain sample training weights obtained in S336 The specific expression is as follows:
[0043]
[0044] in, Represents source domain samples Belongs to category probability;
[0045] S350: Calculate the triplet loss of the source domain based on the source domain sample training weights obtained in S336 The specific steps are as follows:
[0046] S351: Calculate the i-th The weight of the triplet loss of the anchor point is The calculation expression is as follows:
[0047]
[0048] in, Representation and The farthest positive source sample, Representation and The closest source domain negative sample;
[0049] S352: After calculating the triplet loss of all source domain samples, the triplet loss of the source domain can be obtained The specific expression is as follows:
[0050]
[0051] in, and Represent the source domain samples The distance between the farthest source domain positive sample and the nearest source domain negative sample, m represents the interval size of the triplet;
[0052] S360: Calculate the cross entropy loss of the target domain and triplet loss The specific expression is as follows:
[0053]
[0054]
[0055] in, Represents the target domain sample Belongs to category probability. and Represent the target domain samples respectively The distance between the farthest target domain positive sample and the nearest target domain negative sample, m represents the interval size of the triplet;
[0056] S370: According to formula (10), formula (12), formula (13) and formula (14), the final loss function L of the initialization model M' can be obtained: total , the expression is as follows:
[0057]
[0058] in, represents the soft cross entropy loss weight, represents the soft triplet loss weight.
[0059] Here, a combination of cross entropy loss and triplet loss is used for calculation, which can achieve a weight balance effect and effectively reduce the impact of noisy pseudo-labels generated by the target domain on model training.
[0060] As a preferred method, the final loss function L in S370 is used total Calculate the loss of M′ and use gradient backpropagation to update f(·|θ t ) parameters, and update them using formula (16) The parameters of and:
[0061]
[0062] Among them, α is the momentum factor and t represents the number of training rounds.
[0063] Compared with the prior art, the present invention has at least the following advantages:
[0064] 1. In response to the discovery that existing technical methods may not be able to fully utilize source knowledge during the training process, the present invention proposes a novel PKSD method that can effectively utilize source domain knowledge throughout the entire training process and improve the discriminative accuracy on unlabeled target domains.
[0065] 2. The present invention proposes a linearly changing time domain relationship method TDR, which reduces the influence of domain-specific samples in the source domain by reducing the training weight of the source domain.
[0066] 3. The present invention proposes a ranking-guided sample selection method RIS, which selects information-rich and reliable source domain samples by calculating the uncertainty and similarity indicators of source domain samples.
[0067] 4. In order to alleviate the impact of catastrophic forgetting in the source domain, the present invention trains the pedestrian re-identification model through collaborative training. Specifically, there is a common training model for source domain samples with real annotations and target domain samples assigned with pseudo labels. Unlike most previous methods, the present invention no longer adopts a two-stage training strategy of pre-training and fine-tuning, but switches to a single-stage collaborative training method. However, as the number of training rounds increases, the model tends to overfit to some domain-specific knowledge in the source domain. When the domain gap between the source domain and the target domain is large, these domain-specific knowledge will impair the performance of the model in the target domain. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 It is the main structure of PKSD in the method of the present invention.
[0069] Figure 2 This is the effectiveness verification result of the method of the present invention and other different methods. DETAILED DESCRIPTION
[0070] The present invention is described in further detail below.
[0071] The present invention trains a person re-identification model by collaborative training. Specifically, there are source domain samples with real annotations and target domain samples assigned with pseudo labels. Unlike most previous methods, the present invention no longer adopts a two-stage training strategy of pre-training and fine-tuning, but switches to a single-stage collaborative training approach. However, as the number of training rounds increases, the model tends to overfit to some domain-specific knowledge in the source domain. When the domain gap between the source domain and the target domain is large, these domain-specific knowledge will impair the performance of the model in the target domain.
[0072] In order to solve the above problems, this paper proposes a novel cross-domain person re-identification method based on Preserving the Knowledge from the Source Domain (PKSD) to effectively utilize the knowledge from the source domain in the entire training process. Different from the previous two-stage training criteria, PKSD adopts a collaborative training strategy, that is, learning source domain samples and target domain samples at the same time. Specifically, in each round of iteration, PKSD not only uses the target domain data with pseudo labels as the input of the model, but also takes the source domain data with real annotations as input to jointly train the model. Although the source domain samples are fully utilized, the domain-specific knowledge in the source domain plays a harmful role in the domain-applicable tasks. Therefore, this chapter proposes a linearly changing temporal domain relation (TDR) method to gradually mitigate the influence of source domain samples. Specifically, as the number of training times increases, the training weight of the source domain is gradually reduced. However, some information-rich and reliable domain-shared knowledge is helpful to improve the performance of the model on the target domain. Furthermore, this chapter proposes a ranking-guided instance selection (RIS) method to judge the uncertainty and similarity of each sample from the source domain. By sorting the uncertainty and similarity scores, samples with rich and reliable domain shared knowledge are selected and their sample training weights are redistributed. In general, by controlling the source domain weight and sample weight, the proposed PKSD can effectively suppress the influence of domain-specific knowledge from the source domain and improve the test performance of the model on the target domain. Experimental results show that the proposed method greatly exceeds the current state-of-the-art methods.
[0073] See also Figure 1 , a cross-domain pedestrian re-identification method based on deep learning, comprising the following steps:
[0074] S100: Select public datasets A and B, and use dataset A as the source domain D s , the formula is as follows:
[0075]
[0076] in, represents the i-th source domain sample, represents the true label corresponding to the i-th source domain sample, n s represents the total number of source domain samples;
[0077] Select part of the data in dataset B as the target domain training set D T , D T The expression is as follows:
[0078]
[0079] in, represents the jth target domain sample, n t represents the total number of samples in the target domain;
[0080] S200: Select ResNet-50 model M, which consists of two modules. Module 1 is the online feature encoder f(·|θ t ), θ t are the relevant parameters of module one, and module two is the momentum feature encoder are the relevant parameters of module 2;
[0081] The dataset ImageNet is used to initialize the parameters of the model M to obtain the initialized model M′; the ResNet-50 model is an existing technology, and the dataset ImageNet is an existing public dataset. Compared with other public datasets, the initialization parameters given by the dataset ImageNet have better accuracy and will not have too large random errors;
[0082] S300: Calculate the loss of the initialization model M′ using the loss function;
[0083] The loss function of the initialization model M′ in S300 is as follows:
[0084] S310: Using momentum feature encoder for D T The features of the data in N are extracted and saved in the memory feature library N. Then, the DBSCAN clustering algorithm is used. The DBSCAN clustering algorithm is an existing technology. All the features in N are clustered and generated. One-to-one pseudo-labels
[0085] S320: Use the temporal domain relationship strategy to calculate the training weight w of each iteration of the source domain d (i) The time series domain relationship method is an existing technology. The maximum training weight of each iteration of the source domain is preset to be t1 and the minimum is t2, where t1>t2. The calculation expression is as follows:
[0086]
[0087] w d (i) = (1 - s (i)) × t1 + s (i) × t2
[0088] The symbol % represents the modulo operation, i represents the i-th training, e represents the maximum number of training times, and w d (i) represents the training weight of the source domain in the i-th iteration training, s(i) represents the length of each part after t1 and t2 are equally divided;
[0089] S330: Calculate the training weight of each source domain sample using the ranking-guided selection strategy The specific steps are as follows:
[0090] S331: From source domain D s Randomly select a source domain sample And use the line feature encoder f(·|θ t )right Extract features, and then use the category classifier of the target domain and the category classifier of the source domain to classify Classify and calculate separately Probability distribution of classification in the target domain and the probability distribution of classification on the source domain Use the target domain classifier C t Classify each source domain sample to measure the similarity between the source domain sample and the target domain; use the category classifier C on the source domain s Each source domain sample is classified to measure the uncertainty of each source domain sample. The category classifiers of the target domain and the source domain are both based on existing classifiers. The calculation expression is as follows:
[0091]
[0092]
[0093] in, express The probability distribution of classification in the target domain, C trepresents the category classifier on the target domain, c p Represents the number of categories of pseudo labels on the target domain; Representative samples The probability distribution of classification on the source domain, c s is the number of categories of the true label in the source domain, C s represents the category classifier on the target domain;
[0094] S332: Calculation The similarity score Si with the target domain is expressed as follows:
[0095]
[0096] Among them, c p Represents the number of categories of pseudo labels on the target domain;
[0097] S333: Calculate the similarity scores of all source domain samples and the target domain to form a similarity score set Then, all similarity scores are sorted in descending order, and the source domain samples corresponding to the top k% similarity scores are taken as the reliability sample set δ s , the expression is as follows:
[0098]
[0099] Among them, τ s represents the similarity score of the k% source domain samples;
[0100] S334: Definition The maximum and second largest category probabilities in the source domain are and calculate The uncertainty U in the source domain i , the expression is as follows:
[0101]
[0102] S335: Calculate the uncertainty values of all source domain samples to form an uncertainty value set Then, all uncertainty values are sorted in ascending order, and the source domain samples corresponding to the top k% uncertainty values are taken as the uncertainty sample set δ u , the expression is as follows:
[0103]
[0104] S336: Combine formula (6) and formula (8) to obtain the training weight of each source domain sample The expression is as follows:
[0105]
[0106] The smaller the similarity between the sample selected from the source domain and the target domain, the greater the difference between the appearance information of the sample and the target domain sample; on the contrary, if the similarity between the source domain sample and the target domain is greater, then the sample is more likely to have domain-shared knowledge with the target domain sample. If the sample has a low similarity with the target domain, its contribution to the model will gradually decrease with the increase of the number of training rounds (TDR); on the contrary, if the sample has a high similarity with the target domain, its contribution will not be affected by the TDR method.
[0107] If the source domain sample has a large uncertainty, it means that the model still has a lot of rich information to learn from the sample. The method proposed by combining formula (6) and formula (8) can select reliable and informative samples in the source domain. By increasing the training weight of these samples, the domain shared knowledge from the source domain can be effectively utilized, which can further improve the performance of the model in the target domain.
[0108] S340: Calculate the cross entropy loss of the source domain based on the source domain sample training weights obtained in S336 The specific expression is as follows:
[0109]
[0110] in, Represents source domain samples Belongs to category probability;
[0111] S350: Calculate the triplet loss of the source domain based on the source domain sample training weights obtained in S336 The specific steps are as follows:
[0112] S351: Calculate the i-th The weight of the triplet loss of the anchor point is The calculation expression is as follows:
[0113]
[0114] in, Representation and The farthest positive source sample, Representation and The closest source domain negative sample;
[0115] S352: After calculating the triplet loss of all source domain samples, the triplet loss of the source domain can be obtained The specific expression is as follows:
[0116]
[0117] in, and Represent the source domain samples The distance between the farthest source domain positive sample and the nearest source domain negative sample, m represents the interval size of the triplet; a more accurate description is that m represents the minimum difference between the distance between the positive sample feature pairs and the distance between the negative sample feature pairs. According to the empirical value, m is set to 0.5 here; this is a hyperparameter used in designing this loss function; its main function is to shorten the distance between feature pairs of the same type of samples and to push away the threshold of the distance between feature pairs of different types of samples.
[0118] S360: Calculate the cross entropy loss of the target domain and triplet loss The specific expression is as follows:
[0119]
[0120]
[0121] in, Represents the target domain sample Belongs to category probability. and Represent the target domain samples respectively The distance between the farthest target domain positive sample and the nearest target domain negative sample, m represents the interval size of the triplet;
[0122] S370: According to formula (10), formula (12), formula (13) and formula (14), the final loss function L of the initialization model M' can be obtained: total , the expression is as follows:
[0123]
[0124] in, represents the soft cross entropy loss weight, represents the soft triplet loss weight.
[0125] Using the final loss function L in S370 total Calculate the loss of M′ and use gradient backpropagation to update f(·|θ t ) parameters, and update them using formula (16) Parameters in:
[0126]
[0127] Among them, α is the momentum factor and t represents the number of training rounds.
[0128] S400: using the source domain and the target domain as inputs of the initialization model M′ to train the model M′, updating the parameters in M′ according to the loss calculated in S300, stopping the training when the maximum number of training times is reached, and obtaining the trained model M″;
[0129] S500: Input the pedestrian image to be predicted into the trained model M″ to obtain the pedestrian retrieval result.
[0130] Experimental design and results analysis
[0131] 1. Introduction to the dataset used
[0132] The present invention verifies the effectiveness of the proposed method on three widely used public datasets: Market1501, DukeMTMC-ReID and MSMT17. For Market1501, the dataset contains 32,668 pedestrian images of 1,501 different identities taken by 6 cameras. Among them, 12,936 pedestrian images of 751 identities are used for training, and the remaining images are used for testing. For DukeMTMC-ReID, the dataset contains 16,522 training images of 702 different identities taken by 8 cameras, 2,228 query images and 17,661 gallery images. MSMT17 is a larger-scale dataset, which includes 126,441 images of 4,101 different identities captured by 15 cameras. Specifically, 32,621 pedestrian images of 1,041 different identities are used as training sets, and the remaining images are used as test sets. This section uses two commonly used evaluation indicators, Mean Average Precision (mAP) and Cumulative Matching Characteristics (CMC), for evaluation. For the convenience of description, the following content will refer to Market1501, DukeMTMC-ReID and MSMT17 as Market, Duke and MSMT respectively, and no additional explanation will be given.
[0133] 2. Experimental Setup
[0134] In the experiment, the proposed method uses ResNet-50 as the feature encoder and loads the pre-trained parameters on ImageNet. For the setting of co-training, each mini-batch in the source and target domains consists of 64 pedestrian images of 16 different identities. The network is optimized using the Adam algorithm with a weight decay rate of 0.0005. The whole training process is 40 times. In this section, the warm-up strategy is used in the first 10 training times and the initial learning rate is set to 0.00035. For each training, the momentum feature encoder fm (·|θ m ) updates its parameters using a temporal sliding average method, and the momentum factor α = 0.999. Pseudo-labels are redistributed after every 400 iterations. All pedestrian images are resized to 256×128 as network input. During testing, the output of the final batch normalization (BN) layer is used as the final feature representation of the pedestrian image. All experiments were conducted on the Pytorch platform and three NVIDIA TITAN VGPUs were used. Note that only the momentum feature encoder fm(·|θ m ) for testing.
[0135] Table 1 compares with some state-of-the-art methods on the Market and Duke datasets respectively.
[0136]
[0137]
[0138] Table 2 compares with some state-of-the-art methods on the MSMT dataset.
[0139]
[0140] 3. Ablation Learning
[0141] In order to verify the effectiveness of the proposed method modules, this section combines different method modules and conducts tests in the setting of Duke and Market as the source domain and target domain respectively. Figure 2 As shown, Figure 2 The left side shows the test results of different methods on the source domain. Figure 2The right side shows the test results of different methods on the target domain. Among them, Market and Duke are used as the target domain and source domain respectively. From the test results on the source domain, it can be seen that with the increase of the number of iterations, the performance of the model under the two-stage training strategy shows a sharp downward trend, and finally only 20% of the mAP is achieved. This shows that the two-stage training strategy will cause the model to forget the source domain knowledge in the fine-tuning stage. In contrast, the collaborative training method proposed in the present invention has overcome the catastrophic forgetting problem encountered by the source domain knowledge and ensured the final performance of the model on the source domain. From the test results on the target domain, it can be seen that because the two-stage training strategy does not make full use of the knowledge from the source domain, the test performance of the model in the target domain is limited. However, the method proposed in the present invention can fully and effectively utilize the source domain knowledge and significantly improve the test results of the model in the target domain. Specifically, the model under the two-stage training strategy achieved 74.7% mAP, and the baseline method under the collaborative training proposed in the present invention can achieve 79.1% mAP. By introducing TDR to prevent the overfitting of the model in the source domain, the test results of the model in the target domain have achieved an improvement of 0.9% mAP. Furthermore, combined with the RIS module, the model finally achieved a mAP of 80.7%. From the experimental results, it can be concluded that the method proposed in the present invention can effectively utilize the knowledge from the source domain and further promote the test results of the model on the target domain.
[0142] 4. Results comparison
[0143] This method compares the proposed PKSD method with the current mainstream cross-domain pedestrian re-identification methods. Note that the global average pooling layer (GAP) of the final feature in this model is changed to a generalized mean pooling layer (Gem). The experimental results are shown in Table 1. It can be seen that the performance of PKSD greatly exceeds all the most advanced cross-domain pedestrian re-identification methods under the strategy of collaborative training. Specifically, in the setting of 'Duke to Market', three generation-based methods, namely SPGAN, PTGAN and ATNet, are first compared. Compared with the best generation method ATNet, PKSD improves mAP and Rank1 by 58.5% and 37.8% respectively. Furthermore, mainstream methods represented by NRMT, MEB-Net, UNRN, GLT, IDM, PDA, etc. are compared. Whether on 'Market to Duke' or 'Duke to Market', the proposed method achieves the best performance. In particular, on ‘Marke to Duke’, PKSD brings a 0.9% mAP improvement over PDA. Similarly, on ‘Duke to Market’, PKSD improves mAP by 1.9% over PDA.
[0144] The method of the present invention was also experimented on the larger and more challenging MSMT dataset. Some of the latest methods, such as NRMT, UNRN, GLT, IDM and PDA, have demonstrated their good performance on the MSMT dataset. As shown in Table 2, on 'Market to MSMT', PKSD achieved 63.8% Rank1 and 36.5% mAP. Similarly, in the 'Duke to MSMT' setting, PKSD achieved 63.8% Rank1 and 36.7% mAP. Compared with other methods, the PKSD proposed in this method achieved the best test results. In general, these experiments show that fully and efficiently utilizing the knowledge from the source domain can further improve the performance of the model in the target domain.
[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.
Claims
1. A cross-domain pedestrian re-identification method based on deep learning, characterized by: The steps include: S100: Select public datasets A and B, and use dataset A as the source domain D s , the formula is as follows: in, represents the i-th source domain sample, represents the true label corresponding to the i-th source domain sample, n s represents the total number of source domain samples; Select part of the data in dataset B as the target domain training set D T , D T The expression is as follows: in, represents the jth target domain sample, n t represents the total number of samples in the target domain; S200: Select ResNet-50 model M, which consists of two modules. Module 1 is the online feature encoder f(·|θ t ), θ t are the relevant parameters of module one, and module two is the momentum feature encoder are the relevant parameters of module 2; Use the dataset ImageNet to initialize the parameters of model M and obtain the initialized model M′; S300: Calculate the loss of the initialization model M′ using the loss function. The loss function of the initialization model M′ is as follows: S310: Using momentum feature encoder for D T The features of the data in N are extracted and saved in the memory feature library N, and then the DBSCAN clustering algorithm is used to cluster all the features in N and generate One-to-one pseudo-labels S320: Use the temporal domain relationship strategy to calculate the training weight w of each iteration of the source domain d (i) The maximum training weight of the source domain for each iteration is preset to be t1 and the minimum is t2, where t1>t2. The calculation expression is as follows: w d (i)=(1-s(i))×t1+s(i)×t2 The symbol % represents the modulo operation, i represents the i-th training, e represents the maximum number of training times, and w d (i) represents the training weight of the source domain in the i-th iteration training, s(i) represents the length of each part after t1 and t2 are equally divided; S330: Calculate the training weight of each source domain sample using the ranking-guided selection strategy The specific steps are as follows: S331: From source domain D s Randomly select a source domain sample 1≤i≤n s , and use the line feature encoder f(·|θ t )right Extract features, and then use the category classifier of the target domain and the category classifier of the source domain to classify Classify and calculate separately Probability distribution of classification in the target domain and the probability distribution of classification on the source domain The calculation expression is as follows: in, express The probability distribution of classification in the target domain, C t represents the category classifier on the target domain, c p Represents the number of categories of pseudo labels on the target domain; Representative samples The probability distribution of classification on the source domain, c s is the number of categories of the true label in the source domain, C s represents the category classifier on the target domain; S332: Calculation The similarity score S with the target domain i , the expression is as follows: Among them, c p Represents the number of categories of pseudo labels on the target domain; S333: Calculate the similarity scores of all source domain samples and the target domain to form a similarity score set Then, all similarity scores are sorted in descending order, and the source domain samples corresponding to the top k% similarity scores are taken as the reliability sample set δ s , the expression is as follows: Among them, τ s represents the similarity score of the k% source domain samples; S334: Definition The maximum and second largest category probabilities in the source domain are and calculate The uncertainty U in the source domain i , the expression is as follows: S335: Calculate the uncertainty values of all source domain samples to form an uncertainty value set Then, all uncertainty values are sorted in ascending order, and the source domain samples corresponding to the top k% uncertainty values are taken as the uncertainty sample set δ u , the expression is as follows: S336: Combine formula (6) and formula (8) to obtain the training weight of each source domain sample The expression is as follows: S340: Calculate the cross entropy loss of the source domain based on the source domain sample training weights obtained in S336 The specific expression is as follows: in, Represents source domain samples Belongs to category probability; S350: Calculate the triplet loss of the source domain based on the source domain sample training weights obtained in S336 The specific steps are as follows: S351: Calculate the i-th The weight of the triplet loss of the anchor point is The calculation expression is as follows: in, Representation and The farthest positive source domain sample, Representation and The closest source domain negative sample; S352: After calculating the triplet loss of all source domain samples, the triplet loss of the source domain can be obtained The specific expression is as follows: in, and Represent the source domain samples The distance between the farthest source domain positive sample and the nearest source domain negative sample, m represents the interval size of the triplet; S360: Calculate the cross entropy loss of the target domain and triplet loss The specific expression is as follows: in, Represents the target domain sample Belongs to category probability. and Represent the target domain samples respectively The distance between the farthest target domain positive sample and the nearest target domain negative sample, m represents the interval size of the triplet; S370: According to formula (10), formula (12), formula (13) and formula (14), the final loss function L of the initialization model M' can be obtained: total , the expression is as follows: in, represents the soft cross entropy loss weight, represents the soft triplet loss weight; S400: using the source domain and the target domain as inputs of the initialization model M′ to train the model M′, updating the parameters in M′ according to the loss calculated in S300, stopping the training when the maximum number of training times is reached, and obtaining the trained model M″; S500: Input the pedestrian image to be predicted into the trained model M″ to obtain the pedestrian retrieval result.
2. The cross-domain pedestrian re-identification method based on deep learning as claimed in claim 1, characterized in that: Using the final loss function L in S370 total Calculate the loss of M′ and use gradient backpropagation to update f(·|θ t ) parameters, and update them using formula (16) Parameters in: Among them, α is the momentum factor and t represents the number of training rounds.
Citation Information
Patent Citations
Cross-domain pedestrian re-identification algorithm based on momentum network guidance
CN113326731A