Object re-identification method based on view adaptation mechanism

By introducing low-rank adaptive tuning and attention mechanisms into the re-identification model, combined with density clustering and bipartite graph maximum matching algorithms, the problem of difficult cross-camera matching is solved, and the cross-view matching performance and generalization ability of the model are significantly improved. .

CN118230362BActive Publication Date: 2024-10-18NORTHWESTERN POLYTECHNICAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410641216.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-22
Publication Date
2024-10-18
Estimated Expiration
2044-05-22

AI Technical Summary

Technical Problem

Existing re-identification models perform poorly in cross-camera matching and are prone to mistakenly match images with similar viewpoints and postures of different pedestrians together, resulting in unsatisfactory generalization performance on large-scale multi-camera datasets and unlabeled images. Data is insufficient to adapt to unknown environments.

Method used

A secondary enhancement module based on the pre-trained model is used, combined with low-rank adaptation tuning and attention mechanism, to embed query vectors, key vectors and value vectors through visual spatial information, generate pseudo labels, and use density clustering and bipartite graph maximum matching The algorithm optimizes pseudo-labels and achieves perspective-adaptive target re-identification.

Benefits of technology

Significantly improved the cross-view matching ability of the pre-trained model, increasing mAP (average accuracy) by 10.7%, and enhanced cross-view matching through unsupervised methods, reducing the risk of over-fitting and improving the robustness and generalization of the model. ization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118230362B_ABST
    Figure CN118230362B_ABST
Patent Text Reader

Abstract

The present invention provides a method for target re-identification based on a perspective adaptive mechanism. First, in the training stage, the image is sent to a low-rank adaptive tuning Transformer. Through the knowledge utilization of the domain generalizable re-identification algorithm and the pre-trained model, combined with low-rank adaptive tuning and attention mechanism, the perspective adaptive target re-identification technology is realized. The visual spatial information is used, and the convolution operation is used to embed the visual features into the query vector, key vector and value vector. Then, pseudo labels are generated for the features after the attention mechanism, and the pseudo-label pairs are used for training, and the entire model is dynamically updated. The present invention combines low-rank tuning with independent attention branches to maintain pre-trained knowledge and reduce overfitting, solving the difficulties of existing models in cross-perspective pedestrian matching due to the diversity of postures and perspectives.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of pattern recognition, and in particular to an unsupervised cross-view pedestrian re-identification method. Background Art

[0002] Re-identification (ReID) is a method for identifying pedestrians or vehicles in images from non-overlapping cameras. Its goal is to match the same pedestrian or vehicle in photos taken by multiple cameras, which has wide applications in the fields of intelligent monitoring, autonomous driving, intelligent surveillance, and tracking. With the rapid development of deep learning and the release of large-scale re-identification datasets, re-identification research has made significant progress. In general, re-identification algorithms need to be fully trained in the target domain before deployment. However, collecting enough annotated data for each target is time-consuming, labor-intensive, and inefficient.

[0003] In order to promote the application of ReID models, the domain generalization re-identification (DGReID) task is proposed, which aims to train a ReID model that can adapt to unknown environments (domains). However, the existing limited annotated data may not be sufficient to provide sufficient effective knowledge for the ReID model to adapt to the unknown target environment (domain). Therefore, the unlabeled LUPerson dataset is usually used to train the DGReID model in an unsupervised manner. However, the model trained on LUPerson is insufficient in solving the cross-camera matching problem: the pre-trained model easily mismatches images of different pedestrians with similar perspectives and postures, resulting in no ideal generalization performance on some large-scale multi-camera datasets. This is because, in the monocular video inside LUPerson, the perspective and posture changes between images of the same pedestrian are very small, which may mislead the pre-trained model to regard perspective and posture as significant clues for recognition.

[0004] In order to make the pre-trained model better adapt to the environment (domain) of downstream tasks, the Lora (low-rank adaptation) method is newly proposed, which integrates the trainable low-rank decomposition matrix into a frozen pre-trained model to adapt it. Using this method, the cross-camera capability of the pre-trained ReID model can be enhanced, and the model can be prevented from overfitting to downstream tasks. Summary of the invention

[0005] In order to overcome the deficiencies of the prior art, the present invention provides a target re-identification method based on a viewpoint adaptation mechanism.

[0006] The present invention proposes a secondary enhancement module based on a pre-trained model to effectively implement a target re-identification technology with a perspective adaptive mechanism in unlabeled data. First, in the training stage, the image is sent to a transformer tuned using low-rank adaptation (Lora). The transformer uses the parameters of a pre-trained model of domain generalization re-identification (DG-ReID). The pre-trained model can already well match monocular unlabeled data. The low-rank adaptation module optimizes the pre-trained model through a side module. During the entire feature extraction process, the parameters of the pre-trained model remain unchanged, and only the parameters in the low-rank adaptation module are adjusted, so that the pre-trained knowledge is retained and can better adapt to the training data. Re-identification technology is a method for re-identifying pedestrians or vehicles in images from non-overlapping cameras. By utilizing the knowledge of domain generalizable re-identification algorithms and pre-trained models, combined with low-rank adaptive tuning and attention mechanisms, a perspective adaptive target re-identification technology can be achieved.

[0007] Then, the features are enhanced twice, and the features are passed through an attention module to enable them to fit the training data and predict pseudo labels. Using the spatial information of vision, convolution operations are used to embed visual features into query vectors, key vectors, and value vectors. Pseudo labels are then generated for the features that have passed the attention mechanism. First, the features are clustered. Because the pre-trained domain generalization re-identification model (DG-ReID) has a strong matching ability for pedestrian images taken by the same camera, images captured by the same camera can be accurately clustered, but there are certain limitations for pedestrian images taken across cameras, which results in different pseudo labels being incorrectly assigned to the same pedestrian images taken by different cameras. In order to alleviate this problem, the present invention introduces a customized camera-aware pseudo-label optimization strategy, namely the secondary enhancement module. This module is used to align the pseudo-labels of images of the same individual captured by different cameras. Pseudo-label pairs are used for training and the entire model is dynamically updated.

[0008] The technical solution adopted by the present invention to solve the technical problem includes the following steps:

[0009] Step 1: Build a baseline network for re-identification;

[0010] Step 2: Construct a low-rank adaptation (Lora) tuning module;

[0011] Step 3: Attention branch;

[0012] An independent attention branch is added after the pre-trained model to adapt to the training data and predict pseudo labels. The attention branch includes a self-attention module and a multi-layer perceptron module. Convolution is used to embed visual features into the query vector Q, key vector K and value vector V. Given the feature f extracted from the Transformer backbone, the feature extraction performed by the attention branch is written as:

[0013] [Q, K, V] = Conv.(f)

[0014]

[0015] Conv. is the convolution projection operation, f t is the feature extracted by the attention branch, scale is the scale parameter, Softmax is an activation function that converts any real number into a probability between 0 and 1, MLP is a multi-layer perceptron, and then uses f t Predefine pseudo labels and use the generated pseudo labels to guide the backbone network after low-rank adaptation;

[0016] Step 4: Generate pseudo labels and perform secondary optimization;

[0017] First, we use the feature f generated in step 3 t Predict pseudo labels and use density clustering algorithm to cluster features f t Clustering is performed because the domain generalization re-identification model has a strong matching ability in pedestrian images taken by the same camera; accurate clustering of images captured by the same camera view has significant limitations in matching pedestrian images from different cameras, resulting in the same pedestrian images from different cameras being incorrectly assigned to different pseudo-labels; secondary optimization is used to alleviate this situation, to align images of the same individual captured by different cameras to ensure that they are consistent;

[0018] Step 5: Overall tuning of loss function and model;

[0019] The calculation process of the loss function is as follows: the features extracted in the last layer of the backbone network pass through an average pooling layer, and the pseudo-labels generated in step 4 and the image features extracted by the backbone network are used to calculate the triplet loss; the features that have passed the attention mechanism are used to calculate the triplet loss; the pseudo-label predictions of the features that have passed the attention mechanism are calculated once every ten rounds; only the parameters of the low-rank adaptation module and the attention module are tuned, and the rest of the modules are frozen; the total loss The calculation function is expressed as:

[0020]

[0021] in represents the triplet loss; f is the feature extracted from the Transformer backbone, ft is the feature extracted by the attention branch;

[0022] Step 6: Testing the Model

[0023] After steps 1 to 5, the pre-trained DG-ReID model is optimized twice to improve the cross-view capability of the model;

[0024] In the test phase, the attention branch module is directly discarded, and the DG-ReID model optimized in the training phase is used to test different data sets or scenarios to evaluate its performance and generalization ability, that is, the features extracted from the last layer of the backbone network are used for testing.

[0025] In the step 1, the benchmark network is composed of an ISR (Image-Image Similarity Regularization) variant, namely, a DG-ReID network. DG-ReID is a pre-trained model for unsupervised person re-identification, which can effectively re-identify the same person from the same camera under the same perspective. The backbone network of the DG-ReID model is Swin Transformer, which is a deep learning model based on the Transformer architecture, including a hierarchical feature structure, a sliding window operation, and linear complexity, so that Swin Transformer has higher accuracy when processing complex image data;

[0026] At the image input end, the image is divided into a series of image blocks according to a fixed-size grid. An embedding layer is used for each image block to convert the image block into a low-dimensional feature vector, which is then input into the SwinTransformer network.

[0027] In step 2, after the baseline network is constructed, a low-rank adaptive tuning module is added to each encoding layer of the Swin Transformer; the role of the low-rank adaptive tuning module is to ensure that the inherent knowledge of the pre-trained model remains unchanged and then fit the current training data; the low-rank adaptive tuning module is integrated into the projection layer and multi-layer perceptron module in each Transformer layer of the pre-trained model; in the projection layer, for the feature f of the i-th layer of the image i ∈R H×W,C , R represents the feature, H is the height of the image, W is the width of the image, and C is the channel dimension. The feature extraction using the low-rank adaptation module is expressed as:

[0028] [Q, K, V] = Proj.(f i )+αFC 1 (FC 2 (f i ))

[0029] Where Q represents the query vector, K represents the key vector, V represents the value vector, [] represents the join operation, α represents the scaled value of the trade-off, Proj. represents the projection module inside the transformer, which is a fully connected layer, and FC 1 and FC 2 It is a fully connected layer inside the low-rank adaptation module. It freezes the backbone parameters when optimizing the low-rank adaptation layer to avoid the loss of generalized knowledge.

[0030] In step 2, the weighted scaling value α is set to α=0.25.

[0031] In step 4, firstly, the pseudo labels generated by the density clustering algorithm are divided into two categories, one category is the labels assigned to images from multiple cameras, and the second category is the labels assigned only to images from a single camera; in view of the fact that the first category of labels assigns pedestrian images taken by different cameras together, thereby providing valuable cross-view matching knowledge, the first category of labels is retained; for the second category of labels, the goal is to align the second category of labels on the camera, and the second category of label pseudo labels are grouped according to the camera;

[0032] Specifically, the pseudo label of camera i is denoted as Cam i , using the collection Indicates in Cam i Pseudo labels for a set of pedestrian images captured under It represents the nth image of the pedestrian captured by the i-th camera; calculate Cam i The centroid of the pedestrian image cluster is obtained by averaging all image features onto the same pseudo label. The centroid is recorded as in is the average feature of the image taken by camera n;

[0033] For two arbitrary cameras Cam i With Cam j , in Y i and Y j to identify the pseudo-label pairs in the two camera views; the association is formulated as a bipartite graph maximum matching problem. represents a binary incidence matrix, where n and m represent Cam i With Cam j The number of pseudo labels under i Pseudo labels and from Cam j Pseudo labels If the two items are related, set the item π(a,b) in the matrix to 1, otherwise set it to 0; set n <= m, otherwise swap the two groups; force the sum of the rows of π(a,b) to be 1, and the sum of the columns to be 0 or 1, to match and The cost function is defined as the cosine distance between the corresponding centroids is the average feature of the image taken by camera a, is the average feature of the image taken by camera b. The goal is to find the optimal match that minimizes the total cost, thereby achieving the optimal cross-camera matching of pseudo labels;

[0034]

[0035] The Hungarian algorithm is used to solve the optimal association, and the pseudo labels are aligned according to the associated results to effectively mine pedestrian images across perspectives. After the pseudo labels are added across each pair, some unmatched pseudo label pairs are inevitably generated. A threshold is introduced to discard all associations whose costs exceed the threshold. The threshold is set as:

[0036]

[0037] where mean(ω) is the average cost of all pseudo-label associations in all camera pairs, and min(ω) represents the one with the lowest cost. The average cost of pseudo-label association; after the tuning process in this step, all related pseudo-labels are aligned to be unified, so that the cross-view recognition ability of the model can be effectively trained.

[0038] The beneficial effect of the present invention is that an innovative unsupervised post-enhancement method is proposed to enhance cross-view matching using unlabeled monitoring data. The strategies proposed in the present invention include density-based clustering classification methods for pseudo-label generation and for cross-view matching. Figure 1 In addition, an adaptive preservation method is implemented, which combines low-rank tuning and independent attention branches to preserve pre-trained knowledge and reduce overfitting. This solves the difficulties of existing models in cross-view pedestrian matching due to the diversity of postures and perspectives.

[0039] The proposed method significantly improves the pre-trained DG-ReID model, with an average mAP improvement of 10.7%. The present invention emphasizes the effectiveness of unsupervised pre-training in promoting robust and generalizable pedestrian re-identification systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 Schematic diagram of the network structure in the method of the present invention.

[0041] Figure 2 Detailed structural diagram of the low-rank tuning module in the network structure.

[0042] Figure 3 Schematic diagram of attention branches and optimization in the network structure. DETAILED DESCRIPTION

[0043] The present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0044] The technical solution adopted by the present invention to solve the technical problem includes the following steps:

[0045] Step 1: Build a baseline network for re-ID

[0046] The baseline network is composed of an ISR (Image-Image Similarity Regularization) variant, namely the DG-ReID network. DG-ReID is a pre-trained model for unsupervised person re-identification, which can effectively re-identify the same person from the same camera under the same view. The backbone network of the DG-ReID model is SwinTransformer, which is a deep learning model based on the Transformer architecture, including hierarchical feature structure, sliding window operation and linear complexity, making Swin Transformer have higher accuracy when processing complex image data;

[0047] At the image input end, the image is divided into a series of image blocks according to a fixed-size grid. An embedding layer is used for each image block to convert the image block into a low-dimensional feature vector, which is then input into the SwinTransformer network.

[0048] Step 2: Construct a low-rank adaptation (Lora) tuning module;

[0049] After the baseline network is built, a low-rank adaptive tuning module is added to each encoding layer of the Swin Transformer. The function of the low-rank adaptive tuning module is to ensure that the inherent knowledge of the pre-trained model remains unchanged and then fit the current training data. The low-rank adaptive tuning module is integrated into the projection layer and multi-layer perceptron module in each Transformer layer of the pre-trained model. In the projection layer, for the feature f of the i-th layer of the image, i ∈R H×W,C , R represents the feature, H is the height of the image, W is the width of the image, and C is the channel dimension. The feature extraction using the low-rank adaptation module is expressed as:

[0050] [Q, K, V] = Proj.(f i )+αFC 1 (FC 2 (f i ))

[0051] Where Q represents the query vector, K represents the key vector, V represents the value vector, [] represents the connection operation, α represents the scaled value of the trade-off, and the present invention takes α=0.25, Proj· represents the projection module inside the transformer, which is a fully connected layer, and FC 1 and FC 2 It is a fully connected layer inside the low-rank adaptation module. Freezing the backbone parameters when optimizing the low-rank adaptation layer can avoid the loss of generalized knowledge.

[0052] The baseline network fine-tuned by the low-rank adaptive fine-tuning module effectively preserves the existing knowledge of pre-training and also limits the model from overfitting to the perspective and style of the training data.

[0053] Step 3: Attention Branch

[0054] An independent attention branch is added after the pre-trained model to adapt to the training data and predict pseudo labels. The attention branch includes a self-attention module and a multi-layer perceptron module. Convolution is used to embed visual features into the query vector Q, key vector K and value vector V. Given the feature f extracted from the Transformer backbone, the feature extraction performed by the attention branch is written as:

[0055] [Q, K, V] = Conv.(f)

[0056] Conv. is the convolution projection operation, f t is the feature extracted by the attention branch, scale is the scale parameter, Softmax is an activation function that converts any real number into a probability between 0 and 1, MLP is a multi-layer perceptron, which is used to transform a semantic space and effectively use the sequence information, and then use f t Predefine pseudo labels and use the generated pseudo labels to guide the backbone network that has been tuned for low-rank adaptation; generate better pseudo labels through the attention branch, which can minimize the risk of overfitting;

[0057] Step 4: Generate pseudo labels and perform secondary optimization;

[0058] First, we use the feature f generated in step 3 t Predict pseudo labels and use the density clustering algorithm (DBSCAN) to cluster the features f t Clustering is performed because the domain generalization re-identification model has a strong matching ability in pedestrian images taken by the same camera; accurate clustering of images captured by the same camera view has significant limitations in matching pedestrian images from different cameras, resulting in the same pedestrian images from different cameras being incorrectly assigned to different pseudo-labels; secondary optimization is used to alleviate this situation, to align images of the same individual captured by different cameras to ensure that they are consistent;

[0059] First, the pseudo labels generated by the density clustering algorithm are divided into two categories: one is the labels assigned to images from multiple cameras, and the second is the labels assigned only to images from a single camera. Given that the first category of labels assigns pedestrian images taken by different cameras together, thus providing valuable cross-view matching knowledge, the first category of labels is retained. For the second category of labels, the goal is to align the second category of labels on the camera and group the second category of pseudo labels according to the camera.

[0060] Specifically, the pseudo label of camera i is denoted as Cam i , using the collection Indicates in Cam i Pseudo labels for a set of pedestrian images captured under It represents the nth image of the pedestrian captured by the i-th camera; calculate Cam i The centroid of the pedestrian image cluster is obtained by averaging all image features onto the same pseudo label. The centroid is recorded as is the average feature of the image taken by camera n;

[0061] For two arbitrary cameras Cam i With Cam j , in Y i and Y j to identify the pseudo-label pairs in the two camera views; the association is formulated as a bipartite graph maximum matching problem. represents a binary incidence matrix, where n and m represent Cam i With Cam j The number of pseudo labels under i Pseudo labels and from Cam j Pseudo labels If the two are related, set the item π(a, b) in the matrix to 1, otherwise set it to 0; set n <= m, otherwise swap the two groups; force the sum of the rows of π(a, b) to be 1, and the sum of the columns to be 0 or 1, to match and The cost function is defined as the cosine distance between the corresponding centroids is the average feature of the image taken by camera a, is the average feature of the image taken by camera b. The goal is to find the optimal match that minimizes the total cost, thereby achieving the optimal cross-camera matching of pseudo labels;

[0062]

[0063] The Hungarian algorithm is used to solve the optimal association, and the pseudo labels are aligned according to the associated results to effectively mine pedestrian images across perspectives. After the pseudo labels are added across each pair, some unmatched pseudo label pairs are inevitably generated. A threshold is introduced to discard all associations whose costs exceed the threshold. The threshold is set as:

[0064]

[0065] where mean(ω) is the average cost of all pseudo-label associations in all camera pairs, and min(ω) represents the one with the lowest cost. The average cost of pseudo-label association; after the tuning process in this step, all relevant pseudo-labels are aligned to be unified, so that the cross-view recognition ability of the model can be effectively trained;

[0066] Step 5: Overall tuning of loss function and model

[0067] The calculation process of the loss function is as follows: the features extracted in the last layer of the backbone network pass through an average pooling layer, and the pseudo-labels generated in step 4 and the image features extracted by the backbone network are used to calculate the triplet loss; the features that have passed the attention mechanism are used to calculate the triplet loss; the pseudo-label predictions of the features that have passed the attention mechanism are calculated once every ten rounds; only the parameters of the low-rank adaptation module and the attention module are tuned, and the rest of the modules are frozen; the total loss The calculation function is expressed as:

[0068]

[0069] in represents the triplet loss; f is the feature extracted from the Transformer backbone, f t is the feature extracted by the attention branch;

[0070] Step 6: Testing the Model

[0071] After steps 1-5, the pre-trained DG-ReID model is optimized twice to improve the cross-view capability of the model;

[0072] In the test phase, the attention branch module is directly discarded, and the DG-ReID model optimized in the training phase is used to test different data sets or scenarios to evaluate its performance and generalization ability, that is, the features extracted from the last layer of the backbone network are used for testing.

[0073] The following is a specific example of the present invention in cross-view pedestrian re-identification

[0074] In this embodiment, a re-identification method based on category generalization and dynamic model updating is described, and the specific process is as follows:

[0075] Step 1: Prepare the dataset

[0076] The MSMT17 dataset is a large-scale person re-identification dataset containing 4101 identities and 126441 photos. In the implementation process, the MSMT17 dataset is used and its identity annotations are discarded to simulate real-world unlabeled surveillance data to enhance the DG-ReID model. Since each individual appears in at least two views in the MSMT17 dataset, 75% of the cross-view data of individuals are deleted in MSMT17, and only images under a single view are retained. In addition, four other widely used ReID datasets Market-1501, Cuhk03, Sensereid, and VIPeR are prepared to evaluate the generalization ability of the model.

[0077] Step 2: Data preprocessing and optimizer setup

[0078] First, perform data preprocessing. The images of the training categories are uniformly processed and scaled to a size of 224×224. The training images are enhanced using random horizontal flipping, random padding, random cropping, random erasing and other operations. Set the optimizer, adjust the optimizer momentum to 0.9, and set the weight decay to 1e-4. Use the data set prepared in step 1 to train the network, and use the Adam optimizer to update the network parameters.

[0079] Step 3: Training

[0080] In the pre-training stage, ISR (Swin Transformer) pre-trained on LUPerson is used as the backbone.

[0081] During the training phase, all models were trained for 120 rounds. We average-pooled the output features of the last layer of the backbone model and extracted the final pedestrian features for loss calculation. In this phase, triplet loss was implemented. In addition, triplet loss was applied to the output features of the attention branch in the model.

[0082] The loss function is calculated as follows: the prediction of the pseudo-label of the feature passed through the attention mechanism is calculated every ten rounds. Only the parameters of the low-rank module and the attention module are tuned, and the rest are frozen. The total loss function is expressed as:

[0083]

[0084] in represents the triplet loss; f represents the feature extracted by the last layer of the backbone network, f t is the feature extracted by the attention branch.

[0085] Step 4: Testing

[0086] In the test phase, the attention mechanism module is directly discarded, and only the features extracted from the last layer of the backbone network are used for testing.

[0087] The UVRE model is compared with other state-of-the-art domain generalization methods, as shown in Table 1:

[0088] Table 1 Comparison results of UVRE and other REID methods

[0089]

[0090] The compared methods are simply divided into three groups, namely, supervised methods that train DG-ReID models on labeled datasets (DTIN-Net, M 3 L, RaMoE, and PAT), pre-training methods that train DG-ReID models on large-scale unlabeled datasets such as LUPerson (MoCo, LUPnl, CycAs, and ISR in Table 1), and unsupervised methods that post-enhance the pre-trained DG-ReID models on the modified MSMT17 dataset (ICE and PPLR in Table 1).

[0091] According to the results in Table 1, it can be found that the UVRE model has been significantly improved compared with other methods.

[0092] The above are only preferred implementation examples of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention are within the protection scope of the present invention.

Claims

1. A target re-identification method based on a viewpoint adaptation mechanism, characterized in that The steps include: Step 1: Build a baseline network for re-identification; In the step 1, the baseline network is composed of an ISR variant, namely, a DG-ReID network. DG-ReID is a pre-trained model for unsupervised person re-identification, which can effectively re-identify the same person from the same camera under the same view. The backbone network of the DG-ReID model is Swin Transformer, which is a deep learning model based on the Transformer architecture, including a hierarchical feature structure, a sliding window operation, and linear complexity, so that Swin Transformer is accurate when processing complex image data; At the image input end, the image is divided into a series of image blocks according to a fixed-size grid. An embedding layer is used for each image block to convert the image block into a low-dimensional feature vector, which is then input into the Swin Transformer network. Step 2: Construct a low-rank adaptation tuning module; In step 2, after the baseline network is constructed, a low-rank adaptive tuning module is added to each encoding layer of the Swin Transformer; the role of the low-rank adaptive tuning module is to ensure that the inherent knowledge of the pre-trained model remains unchanged and then fit the current training data; the low-rank adaptive tuning module is integrated into the projection layer and multi-layer perceptron module in each Transformer layer of the pre-trained model; in the projection layer, for the feature f of the i-th layer of the image i ∈R H×W,C , R represents the feature, H is the height of the image, W is the width of the image, and C is the channel dimension. The feature extraction using the low-rank adaptation module is expressed as: [Q,K,V]=Proj.(f i )+αFC1(FC2(f i )) Where Q represents the query vector, K represents the key vector, V represents the value vector, [] represents the connection operation, α represents the scaled value of the trade-off, Proj. represents the projection module inside the transformer, which is a fully connected layer, FC1 and FC2 are fully connected layers inside the low-rank adaptation module, and the backbone parameters are frozen when optimizing the low-rank adaptation layer to avoid the loss of generalized knowledge; Step 3: Attention branch; An independent attention branch is added after the pre-trained model to adapt to the training data and predict pseudo labels. The attention branch includes a self-attention module and a multi-layer perceptron module. Convolution is used to embed visual features into the query vector Q, key vector K and value vector V. Given the feature f extracted from the Transformer backbone, the feature extraction performed by the attention branch is written as: [Q, K, V] = Conv.(f) Conv. is the convolution projection operation, f t is the feature extracted by the attention branch, scale is the scale parameter, Softmax is an activation function that converts any real number into a probability between 0 and 1, MLP is a multi-layer perceptron, and then uses f t Predefine pseudo labels and use the generated pseudo labels to guide the backbone network after low-rank adaptation; Step 4: Generate pseudo labels and perform secondary optimization; First, we use the feature f generated in step 3 t Predict pseudo labels and use density clustering algorithm to cluster features f t Clustering is performed because the domain generalization re-identification model has matching capabilities in pedestrian images taken by the same camera; images captured by the same camera view are accurately clustered, but have limitations in matching pedestrian images from different cameras, resulting in the same pedestrian images from different cameras being incorrectly assigned to different pseudo-labels; secondary optimization is used to alleviate this situation, to align images of the same individual captured by different cameras to ensure that they are consistent; In step 4, firstly, the pseudo labels generated by the density clustering algorithm are divided into two categories, one category is the labels assigned to images from multiple cameras, and the second category is the labels assigned only to images from a single camera; Given that the first-class labels assign pedestrian images taken by different cameras together, thus providing valuable cross-view matching knowledge, the first-class labels are retained; for the second-class labels, the goal is to align the second-class labels on the camera and group the second-class label pseudo-labels according to the camera; Specifically, the pseudo label of camera i is denoted as Cam i , using the collection Indicates in Cam i Pseudo labels for a set of pedestrian images captured under It represents the nth image of the pedestrian captured by the i-th camera; Calculate Cam i The centroid of the pedestrian image cluster is obtained by averaging all image features onto the same pseudo label. The centroid is recorded as in is the average feature of the image taken by camera n; For two arbitrary cameras Cam i With Cam j , in Y i and Y j to identify the pseudo-label pairs in the two camera views; the association is formulated as a bipartite graph maximum matching problem. represents a binary incidence matrix, where n and m represent Cam i With Cam j The number of pseudo labels under i Pseudo-labels and from Cam j Pseudo labels If the two are related, set the item π(a, b) in the matrix to 1, otherwise set it to 0; set n <= m, otherwise swap the two groups; force the sum of the rows of π(a, b) to be 1, and the sum of the columns to be 0 or 1, to match and The cost function is defined as the cosine distance between the corresponding centroids is the average feature of the image taken by camera a, is the average feature of the image taken by camera b. The goal is to find the optimal match that minimizes the total cost, thereby achieving the optimal cross-camera matching of pseudo labels; The Hungarian algorithm is used to solve the optimal association, and the pseudo labels are aligned according to the associated results to effectively mine pedestrian images across perspectives. After the pseudo labels are added across each pair, some unmatched pseudo label pairs are inevitably generated. A threshold is introduced to discard all associations whose costs exceed the threshold. The threshold is set as: where mean(ω) is the average cost of all pseudo-label associations in all camera pairs, and min(ω) represents the one with the lowest cost. The average cost of pseudo-label association; After the tuning process in this step, all relevant pseudo labels are aligned to be unified, so that the cross-view recognition ability of the model can be effectively trained; Step 5: Overall tuning of loss function and model; The calculation process of the loss function is as follows: the features extracted in the last layer of the backbone network pass through an average pooling layer, and the pseudo-labels generated in step 4 and the image features extracted by the backbone network are used to calculate the triplet loss; the features that have passed the attention mechanism are used to calculate the triplet loss; the pseudo-label predictions of the features that have passed the attention mechanism are calculated once every ten rounds; only the parameters of the low-rank adaptation module and the attention module are tuned, and the rest of the modules are frozen; the total loss The calculation function is expressed as: in represents the triplet loss; f is the feature extracted from the Transformer backbone, f t is the feature extracted by the attention branch; Step 6: Testing the Model After steps 1 to 5, the pre-trained DG-ReID model is optimized twice to improve the cross-view capability of the model; In the test phase, the attention branch module is directly discarded, and the DG-ReID model optimized in the training phase is used to test different data sets or scenarios to evaluate its performance and generalization ability, that is, the features extracted from the last layer of the backbone network are used for testing.

2. The object re-identification method based on the perspective adaptation mechanism according to claim 1, characterized in that: In step 2, the weighted scaling value α is set to α=0.25.

Citation Information

Patent Citations

  • Unsupervised pedestrian re-identification method

    CN114299543A

  • Unsupervised domain adaptive pedestrian re-identification method based on camera perception and deep learning

    CN115578746A