Domain generalization pedestrian re-identification method based on self-prompt learning

By generating high-quality segmentation masks through self-suggestion learning, the problem of insufficient generalization ability of pedestrian re-identification models in cross-camera scenarios is solved, improving accuracy and adaptability, especially the recognition effect when the target domain is not visible.

CN118918610BActive Publication Date: 2026-11-24UESTC (SHENZHEN) ADVANCED RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411020428.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2026-11-24
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

Existing pedestrian re-identification models lack generalization ability in cross-camera scenarios, especially when the target domain is not visible and is affected by background and occlusion interference, which affects the discriminative ability.

Method used

We employ a self-prompting learning method to automatically generate high-quality segmentation mask images, perform pixel-level target-scene separation, construct an image segmentation model and a pedestrian re-identification model, and use attention-guided generation of self-prompting sets for feature extraction and classification.

Benefits of technology

It improves the accuracy and generalization ability of pedestrian re-identification, and can be effectively applied in situations where privacy protection or annotation costs are high. It automatically locates the pedestrian identity area, filters out identity-irrelevant information, and generates fine segmentation prompts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918610B_ABST
    Figure CN118918610B_ABST
Patent Text Reader

Abstract

This invention discloses a domain-generalized person re-identification method based on self-prompt learning. First, an image segmentation model is constructed to segment the input image into a foreground image based on prompts, and this model is pre-trained using a large-scale image segmentation task dataset. Then, based on the pre-trained image segmentation model, a self-prompt-based person re-identification model is constructed. In this model, a set of self-prompts is generated through attention-guided processing to produce segmentation prompts. Based on the obtained segmentation results, the feature map is processed using soft masking techniques, and then pedestrian features are extracted a second time. Person re-identification is then performed based on these secondary pedestrian features. This invention improves the accuracy of person re-identification by automatically generating a high-quality prompt set and performing pixel-level target-scene separation, thus mitigating the poor generalization ability of the model in unfamiliar camera scenes caused by background and occlusion interference.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of pedestrian re-identification technology, and more specifically, relates to a domain generalization pedestrian re-identification method based on self-prompt learning. Background Technology

[0002] Person re-identification aims to retrieve individuals with the same identity from multiple disjoint camera views. It has a wide range of applications, such as video security and human-centered understanding analytics, primarily focusing on the identification and retrieval of pedestrians across different cameras and scenes. When it is difficult to obtain clear facial video clips, person re-identification can fill the technological gap in face recognition, enhancing the spatiotemporal continuity of cross-camera data.

[0003] Pedestrian re-identification possesses immense potential value in both public safety and commercial economics. In public safety, pedestrian re-identification technology can replace manual methods for tracing the paths of suspects and missing persons, significantly preventing safety incidents. In commercial economics, by converting collected customer trajectories into revenue statistics, market managers can gain valuable insights and in-depth analysis of customer behavior. A major challenge in pedestrian re-identification is dealing with variations across camera scenes, such as background, occlusion, lighting, and shooting angles. Thanks to advancements in deep learning, pedestrian re-identification under the independent and identically distributed (ICD) assumption has achieved excellent results.

[0004] However, when deploying person re-identification models to real-world security scenarios, target domain data is often unavailable due to privacy concerns and annotation costs. Therefore, improving the generalization ability of person re-identification models is a key technical challenge. Because the target domain is invisible, the model is affected by background and occlusion in unseen scenes, impacting its discriminability. To address this issue, researchers have proposed two main approaches. The first focuses on feature deentanglement, aiming to separate identity-related information from identity-independent information; the second is based on semantic segmentation, separating the person portion from interfering factors at the image level. Previously used segmentation models in person re-identification were typically pre-trained on human parsing datasets, but traditional segmentation models exhibit poor performance. With the emergence of large-scale pre-trained visual models, segmentation-based person re-identification has become increasingly valuable. However, these large-scale pre-trained semantic segmentation models heavily rely on high-resolution images and high-quality cues to achieve stable segmentation results; satisfactory performance on person re-identification images is only achievable with high-quality manual cues. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of the prior art and provide a domain generalization pedestrian re-identification method based on self-prompt learning. By automatically generating a high-quality prompt set, pixel-level target-scene separation is performed to alleviate the poor generalization ability of the model caused by interference from background and occlusion in unseen camera scenes, thereby improving the accuracy of pedestrian re-identification.

[0006] To achieve the above objectives, the present invention's domain-generalized person re-identification method based on self-prompting learning includes the following steps:

[0007] S1: Construct an image segmentation model to generate a segmentation mask image from the input image based on prompts. Each pixel value in the segmentation mask image represents the probability that the corresponding pixel in the input image belongs to the foreground or background. Set up a large-scale image segmentation task dataset according to actual needs and pre-train the image segmentation model. The image segmentation model includes an embedding module, a Transformer encoder, a pooling module, a prompt encoder, and a mask decoder, where:

[0008] The embedding module divides an input pedestrian image X of size C×H×W into N non-overlapping image patches, where C represents the number of channels in the input pedestrian image and H×W represents the size of the input pedestrian image. Each patch is then mapped to a vector as an image token, resulting in N image tokens x. n n = 1, 2, ..., N; simultaneously obtain the position embedding p of each image patch. n Then use N image tokens x n and position embedding p n The images are superimposed to form an image token sequence Y = [x1+p1, x2+p2, ..., x N +p N And output to the Transformer encoder;

[0009] The Transformer encoder contains L stacked Transformer coding blocks for encoding the received image token sequence Y. Each Transformer coding block extracts a hidden representation Z from the input features. j Let j = 1, 2, ..., L, and let the hidden representation Z of the last layer's output be... L The hidden representation f(Z) of the image token sequence Y is sent to the pooling module;

[0010] The pooling module is used to perform pooling operations on the hidden representation f(Z) to obtain the feature vector z = pooling(f(Z)) and output it to the decoder;

[0011] The prompt encoder is used to encode the prompt information to obtain the prompt vector t, and output it to the mask decoder;

[0012] The mask decoder is used to decode the segmentation mask based on the feature vector z and the cue vector t;

[0013] S2: Based on the image segmentation model pre-trained in step S1, construct a self-prompt-based person re-identification model, including the image segmentation model pre-trained in step S1, an attention-guided prompt generation module, a scene-independent feature extraction module, and a classifier, wherein:

[0014] The embedding module, Transformer encoder, and pooling module in the image segmentation model are used to extract features from the input image X to obtain pedestrian features z.

[0015] The attention-guided cue generation module is used to extract the attention of each image token in the input image token and the output hidden representation from the L-layer Transformer encoder of the image segmentation model, respectively. It then generates a set of self-cues and outputs it to the cue encoder of the image segmentation model. The specific method is as follows:

[0016] Let Z be the hidden representation of each Transformer coded block. j The N image tokens are z j,n Each input image token x in the input image token sequence Y n Each image token z in each Transformer encoded block of each layer j,n The feature vector z output by the pooling module is used as a node. The attention value between each input image token and the output image token extracted by each Transformer coding block is used as the weight of the edge between the corresponding image tokens. The image token Z output by the last layer is used as the weight of the edge. L,n The weights of the edges between the input image and the feature vector z are set to 1 / N, forming a weighted directed acyclic graph; then, the maximum flow algorithm is used to obtain the token x for each input image. n The maximum flow path r to the eigenvector z n Let its flow rate be w. n Select the input image tokens corresponding to the M largest flows. m = 1, 2, ..., M, n m This represents the index of the input image token corresponding to the m-th maximum flow; then from the M input image tokens... Several images are selected as cue image tokens, and their corresponding location information is used as self-cues to form a self-cues set. The method for selecting cue image tokens is as follows:

[0017] 1) Input image token As the first prompt image token, its location information is recorded as S1;

[0018] 2) Let the sequence number k = 2, m = 2;

[0019] 3) Determine whether Indicates input image token The position is d(), where d() represents the distance to be calculated and α represents the preset distance threshold. If α is the threshold, proceed to step 4); otherwise, proceed to step 6.

[0020] 4) Input image token As the kth prompt image token;

[0021] 5) Let k = k + 1, then proceed to step 6);

[0022] 6) Determine if m < M. If yes, proceed to step 7); otherwise, the filtering ends.

[0023] 7) Let m = m + 1, then return to step 3);

[0024] In an image segmentation model, the cue decoder encodes the cue information from the self-cue set to obtain a cue vector t;

[0025] The mask decoder in the image segmentation model is used to decode the segmentation mask based on the feature vector z and the cue vector t;

[0026] The scene-independent feature extraction module is used to extract the j-th segment of the Transformer encoder based on the segmentation mask output by the mask decoder. * The hidden representation output by the Transformer coded block is processed, j * Configure according to actual needs, then re-enter the j-th... * A +1 layer Transformer encoding block is used for secondary feature extraction. Finally, the pooling module obtains the secondary pedestrian feature z′ and sends it to the classifier. The specific method for hidden representation processing is as follows:

[0027] Performing a Gaussian convolution on the segmentation mask maps the classification results of the segmentation edges to floating-point values ​​between 0 and 1, obtaining the pixel set segmentation soft mask mask′; selecting the j-th... * Hidden representation of the output of the Transformer coded block Hidden representation Perform deconvolution to obtain features of the same size as the segmentation soft mask 'mask'. Use segmentation soft mask 'mask' for features Features are obtained by performing filtering operations. Then features Convolution to restore the hidden representation The size of the feature is obtained Then hide the representation and characteristics By merging, a new hidden representation is obtained.

[0028]

[0029] The classifier is used to classify pedestrians based on the quadratic pedestrian feature z′ to obtain the pedestrian ID;

[0030] S3: Obtain the training sample set based on the actual deployment scenario. Each training sample image is represented as... i = 1, 2, ..., D, where D represents the number of training sample images and f is the label of the training sample. i Indicates the ID of a pedestrian in a pedestrian image;

[0031] S4: Fix the parameters of other modules in the self-prompt-based person re-identification model, input each training sample from step S3 into the self-prompt-based person re-identification model, optimize and train the Transformer encoder, and obtain the trained self-prompt-based person re-identification model.

[0032] S5: When pedestrian re-identification is required, input the pedestrian image into the self-prompting pedestrian re-identification model trained in step S4 to obtain the pedestrian identification result.

[0033] This invention presents a domain-generalized person re-identification method based on self-prompt learning. First, an image segmentation model is constructed to segment the input image into a foreground image based on prompts. This model is pre-trained using a large-scale image segmentation task dataset. Then, based on the pre-trained image segmentation model, a self-prompt-based person re-identification model is constructed. In this model, a set of self-prompts is generated through attention-guided processing to produce segmentation prompts. Based on the segmentation results obtained, the feature map is processed using soft masking techniques, and then pedestrian features are extracted a second time. Finally, person re-identification is performed based on these secondary pedestrian features.

[0034] The present invention has the following beneficial effects:

[0035] 1) By introducing an attention-guided prompt generation method, this invention can automatically locate the area containing pedestrian identity identification information, generate more refined segmentation prompts, improve the ability to filter out identity-irrelevant information, and thus improve the accuracy of pedestrian re-identification.

[0036] 2) This invention employs scene-independent feature extraction, which can generate reliable segmentation results while minimizing the loss of edge information;

[0037] 3) This invention has high practical application value in situations where there is a lack of target domain data due to privacy protection or high annotation costs. Attached Figure Description

[0038] Figure 1 This is a flowchart illustrating a specific implementation of the self-prompting learning-based domain generalization pedestrian re-identification method of the present invention.

[0039] Figure 2 This is a structural diagram of the image segmentation model in this invention;

[0040] Figure 3 This is a structural diagram of the pedestrian re-identification model based on self-prompt in this invention;

[0041] Figure 4 This is a comparison result between the segmentation mask generated by the attention-based prompts of the present invention and a single manual prompt in this embodiment. Detailed Implementation

[0042] The specific embodiments of the present invention will now be described with reference to the accompanying drawings to enable those skilled in the art to better understand the invention. It should be particularly noted that in the following description, detailed descriptions of known functions and designs that might obscure the main content of the invention will be omitted here.

[0043] Example

[0044] Figure 1 This is a flowchart illustrating a specific implementation of the domain generalization person re-identification method based on self-prompting learning according to the present invention. Figure 1 As shown, the specific steps of the domain generalization person re-identification method based on self-prompting learning of the present invention include:

[0045] S101: Construct and pre-train an image segmentation model:

[0046] An image segmentation model is constructed to generate a segmentation mask image from an input image based on prompts. Each pixel value in the segmentation mask image represents the probability that the corresponding pixel in the input image belongs to the foreground or background. A large-scale image segmentation task dataset is set up according to actual needs, and the image segmentation model is pre-trained.

[0047] Figure 2 This is a structural diagram of the image segmentation model in this invention. For example... Figure 2 As shown, the image segmentation model in this invention includes an embedding module, a Transformer encoder, a pooling module, a cue encoder, and a mask decoder, wherein:

[0048] The embedding module divides an input pedestrian image X of size C×H×W into N non-overlapping image patches, where C represents the number of channels in the input pedestrian image and H×W represents the size of the input pedestrian image. Each patch is then mapped to a vector as an image token, resulting in N image tokens x. n n = 1, 2, ..., N. Simultaneously, obtain the position embedding p of each image patch. n Then use N image tokens x n and position embedding p n The images are superimposed to form an image token sequence Y = [x1+p1, x2+p2, ..., x N +p N It is then output to the Transformer encoder.

[0049] The Transformer encoder contains L stacked Transformer coding blocks for encoding the received image token sequence Y. Each Transformer coding block extracts a hidden representation Z from the input features. j The hidden representation Z of the last layer output. L The hidden representation f(Z) of the image token sequence Y is sent to the pooling module.

[0050] The Transformer encoder block is a commonly used neural network architecture, and its specific structure and operation will not be elaborated here. In this embodiment, the L-layer Transformer encoder block alternately uses local attention (window attention) and global attention mechanisms to process the input features of the current Transformer encoder block. Local attention and global attention are two commonly used attention mechanisms, and their specific processes will not be elaborated here. In summary, when the Transformer encoder block uses local attention, the input features are divided into different windows on the two-dimensional plane, and then attention operations are performed within the windows. When the Transformer encoder block uses global attention, it will perform the operation on all image tokens in the input features.

[0051] The pooling module performs pooling operations on the hidden representation f(Z) to obtain the feature vector z = pooling(f(Z)) and outputs it to the decoder. This is because the image token output by the Transformer encoder in this invention does not contain a class token, so a pooling operation is required.

[0052] The prompt encoder is used to encode the prompt information to obtain the prompt vector t, and output it to the mask decoder.

[0053] The mask decoder is used to decode the segmentation mask based on the feature vector z and the cue vector t.

[0054] S102: Construct a pedestrian re-identification model based on self-prompt:

[0055] Based on the image segmentation model pre-trained in step S101, a pedestrian re-identification model based on self-prompt is constructed. Figure 3 This is a structural diagram of the self-prompt-based pedestrian re-identification model in this invention. (See diagram below.) Figure 3 As shown, the self-prompt-based pedestrian re-identification model in this invention includes a pre-trained image segmentation model (step S101), an attention-guided prompt generation module, a scene-independent feature extraction module, and a classifier, wherein:

[0056] The embedding module, Transformer encoder, and pooling module in the image segmentation model are used to extract features from the input image X to obtain pedestrian features z.

[0057] The attention-guided cue generation module is used to extract the attention of each image token in the input image token and the output hidden representation from the L-layer Transformer encoder of the image segmentation model, respectively. It then generates a set of self-cues and outputs it to the cue encoder of the image segmentation model. The specific method is as follows:

[0058] Let Z be the hidden representation of each Transformer coded block. j The N image tokens are z j,n Each input image token x in the input image token sequence Y n Each image token z in each Transformer encoded block of each layer j,n The feature vector z output by the pooling module is used as a node. The attention value between each input image token and the output image token extracted by each Transformer coding block is used as the weight of the edge between the corresponding image tokens. The image token Z output by the last layer is used as the weight of the edge. L,n The weights of the edges between the input image token xn and the feature vector z are set to 1 / N, forming a weighted directed acyclic graph. Then, the maximum flow algorithm is used to obtain the maximum flow path r from each input image token xn to the feature vector z. n Let its flow rate be w. n Select the input image tokens corresponding to the top M largest traffic volumes. m = 1, 2, ..., M, n m This represents the index of the input image token corresponding to the m-th maximum flow. Then, from the M input image tokens... Several images are selected as cue image tokens, and their corresponding location information is used as self-cues to form a self-cues set. The method for selecting cue image tokens is as follows:

[0059] 1) Select the first prompt image token:

[0060] Enter image token As the first prompt image token, its location information is denoted as S1.

[0061] 2) Let the sequence number k = 2, m = 2.

[0062] 3) Determine whether Indicates input image token The position is given by d(), where d() represents the distance to be calculated and α represents the preset distance threshold. If α is the threshold, proceed to step 4; otherwise, proceed to step 6.

[0063] 4) Determine the k-th cue image token:

[0064] Enter image token As the kth prompt image token.

[0065] 5) Let k = k + 1, then proceed to step 6).

[0066] 6) Determine if m < M. If yes, proceed to step 7); otherwise, end the filtering process.

[0067] 7) Let m = m + 1, then return to step 3).

[0068] The cue decoder in the image segmentation model is used to encode the cue information in the self-cue set to obtain the cue vector t.

[0069] The mask decoder in the image segmentation model is used to decode the segmentation mask based on the feature vector z and the cue vector t.

[0070] The scene-independent feature extraction module is used to extract the j-th segment of the Transformer encoder based on the segmentation mask output by the mask decoder. * The hidden representation output by the Transformer coded block is processed, j * Configure according to actual needs, then re-enter the j-th... * A +1 layer Transformer encoding block is used for secondary feature extraction. Finally, the pooling module obtains the secondary pedestrian feature z′ and sends it to the classifier. The specific method for hidden representation processing is as follows:

[0071] A Gaussian convolution is performed on the segmentation mask to map the classification results of the segmentation edges into floating-point values ​​between 0 and 1, yielding the pixel set segmentation soft mask mask′. The j-th pixel is selected...* Hidden representation of the output of the Transformer coded block Hidden representation Perform deconvolution to obtain features of the same size as the segmentation soft mask 'mask'. Use segmentation soft mask 'mask' for features Features are obtained by performing filtering operations. Then features Convolution to restore the hidden representation The size of the feature is obtained Then hide the representation and characteristics By merging, a new hidden representation is obtained.

[0072]

[0073] As described above, in the self-suggestion image segmentation model, an input image generates two feature vectors. The first is generated based on the input image itself, and the second is generated based on a hidden representation layer processed by the segmentation mask. It is evident that the second-generated feature vector can better filter the background and thus enhance foreground features. Using this second-generated feature vector for person re-identification can effectively improve recognition accuracy. Experiments have shown that j * ≤0.5L, meaning that using shallow hidden representation for segmentation soft masking is better.

[0074] The classifier is used to classify pedestrians based on the quadratic pedestrian feature z′ to obtain the pedestrian ID.

[0075] As described above, in the self-suggestion learning process of this invention, attention-guided suggestion generation is used, specifically, attention flow is used to locate the region of an instance and generate sparse suggestions. The sparse suggestions and image embeddings are jointly input into a mask decoder, outputting a pedestrian-related mask. Scene-independent feature extraction is employed, and the mask guides the model to filter background information, thereby effectively improving the accuracy of pedestrian re-identification.

[0076] S103: Obtain the training sample set:

[0077] The training sample set is obtained based on the actual deployment scenario, and each training sample pedestrian image is represented as follows: i = 1, 2, ..., D, where D represents the number of training sample images and f is the label of the training sample. i This represents the ID of the pedestrian in the pedestrian image.

[0078] S104: Training a self-prompt-based person re-identification model:

[0079] Fix the parameters of other modules in the self-prompt-based person re-identification model, input each training sample in step S103 into the self-prompt-based person re-identification model, optimize and train the Transformer encoder, and obtain the trained self-prompt-based person re-identification model.

[0080] Setting the loss function is crucial for optimizing the training of the Transformer encoder. In this embodiment, to improve training performance, a comprehensive loss function calculation method is proposed, as follows:

[0081] The ID loss L of the training samples is calculated using the following formula. ce :

[0082]

[0083] Where B represents the number of training samples in a training batch, f b z represents the label of the b-th training sample in the current batch. b ′ represents the secondary pedestrian feature obtained from the b-th training sample in the current batch, and C() represents the classification result of the classifier.

[0084] The triplet loss L for the training samples is calculated using the following formula. tri :

[0085]

[0086] Where, d p d represents the Euclidean distance between the b-th training sample in the current batch and the same pedestrian sample in the current batch, where d is the quadratic pedestrian feature. n ε represents the Euclidean distance between the b-th training sample in the current batch and different pedestrian samples in the current batch, where ε represents the difference boundary between positive and negative samples.

[0087] The consistency loss L of the training samples is calculated using the following formula. con :

[0088]

[0089] in, Z represents the new hidden representation obtained from the b-th training sample in the current batch. b,L This represents the hidden representation of the b-th training sample in the current batch, output by the Transformer encoder, where ||||2 represents the L2 norm. Representation and Hiding Representation Matching classifier, C L () represents the hidden representation Z b,LThe matching classifier, KL() represents the KL divergence between the two classification results, and λ represents the preset hyperparameter.

[0090] The consistency loss can achieve two goals: first, to improve the model's deep perception of pedestrians and reduce interference from background and occlusion; and second, to increase the ID discriminability of the hidden representation after segmentation soft masking.

[0091] Then, the final loss (LOSS) is calculated using the following formula:

[0092] LOSS = αL ce +βL tri +γL con

[0093] Where α, β, and γ represent preset weights.

[0094] S105: Pedestrian Re-identification:

[0095] When pedestrian re-identification is required, the pedestrian image is input into the self-prompting pedestrian re-identification model trained in step S104 to obtain the pedestrian identification result.

[0096] To better illustrate the technical effects of the present invention, two specific examples are used to experimentally verify the present invention.

[0097] Example 1

[0098] In this embodiment, the experimental conditions are set as follows: System: Ubuntu 20.04, Software: Python 3.6, Graphics Card: NVIDIA GeForce RTX 3090×4, Video Memory: 24576MB.

[0099] To comprehensively evaluate the reliability and effectiveness of attention-based cue generation (APG) segmentation masks in pedestrian re-identification tasks, this invention conducted a series of visualization experiments, comparing and analyzing the segmentation results obtained by the traditional manual single cue (SP) method with those obtained by the attention-based cue generation (APG) method of this invention. In traditional manual single cue methods, due to a lack of in-depth understanding of identity-discriminating information in pedestrian images, it is often difficult to adapt to the diversity and complexity of pedestrian re-identification images, leading to difficulties in accurately locating pedestrians and their related accessories in practical applications. For example, manual single cue may fail to distinguish between decorative items and key identity-discriminating items on a pedestrian, and may also fail to accurately identify changes in pedestrian posture and occlusion.

[0100] To overcome these challenges, this invention proposes a self-cue learning method based on attention flow. This method first uses a visual foundational model to analyze the attention distribution in an image, identifying regions relevant to pedestrian identification. Then, guided by attention flow, it automatically generates a set of sparse cues that accurately cover the pedestrian's entire body and identity-related accessories such as backpacks, handbags, and handheld items. Figure 4 This is a comparison image of the segmentation mask generated by the attention-based prompting method of this invention and a single manual prompt in this embodiment. From Figure 4 As can be seen, the automated prompting set generated by the self-prompting learning of this invention not only comprehensively covers the entire pedestrian but also accurately locates pedestrian accessories with identification capabilities. For example... Figure 4 As shown in the first row, self-suggestion learning can accurately identify backpacks and handbags carried by travelers, even if these accessories are small in proportion or partially obscured in the image. Similarly, in the second row, self-suggestion learning can also identify items held by travelers, which is usually a significant challenge for manual prompting. Furthermore, the prompts generated by self-suggestion learning can effectively filter out interfering information caused by occlusion. Figure 4 As shown in the third column, in complex scenarios, when the target pedestrian is partially obscured by other pedestrians, self-suggestion learning can still accurately locate the target pedestrian and filter out the interfering information of the obscuring pedestrian, which is crucial for improving the accuracy of pedestrian re-identification.

[0101] In summary, the experimental results of this invention fully demonstrate the reliability and effectiveness of self-suggestion learning in generating high-quality segmentation masks, providing an innovative solution for pedestrian re-identification tasks. Through self-suggestion learning, this invention can significantly improve the generalization ability and accuracy of pedestrian re-identification systems in complex scenarios, and has broad application prospects.

[0102] Example 2

[0103] In this embodiment, the experimental conditions are set as follows: System: Ubuntu 20.04, Software: Python 3.6, Graphics Card: NVIDIA GeForce RTX 3090×4, Video Memory: 24576MB.

[0104] To more accurately evaluate the effectiveness of this invention in pedestrian re-identification data, this embodiment conducts a series of generalization experiments on pedestrian re-identification. Market1501(M), MSMT17(MS), CUHK02(C2), CUHK03(C3), CUHK-SYSU(CS), and Duke-MTMC(D) are used as source domains (training sets), and M+CS+C2+C3 is used as the source domain for training. This invention is compared with 12 existing comparison methods on four target domains: PRID, GRID, VIPeR, and iLIDs. The comparison methods include:

[0105] MLDG, for details, please see the paper "D.Li, Y.Yang, Y.-Z.Song, and T.Hospedales, "Learning togeneralize: Meta-learning for domain generalization," in Proceedings of the AAAI conference on artificial intelligence, vol.32, no.1, 2018.";

[0106] For details on PPA, please refer to the paper "S. Qiao, C. Liu, W. Shen, and AL Yuille, "Few-shot image recognition by predicting parameters from activations," in Proceedings of the IEEE conference on computer vision and pattern recognition, 2018, pp. 7229–7238."

[0107] DIMN, for details, please see the paper "J.Song, Y.Yang, Y.-Z.Song, T.Xiang, and TMHospedales, "Generalizable person re-identification by domain-invariant mapping network," in IEEE Conference on Computer Vision and Pattern Recognition, 2019.";

[0108] SNR, for details, refer to the paper "X. Jin, C. Lan, W. Zeng, Z. Chen, and L. Zhang, "Style normalization and restitution for generalizable person re-identification," in IEEE Conference on Computer Vision and Pattern Recognition, 2020.";

[0109] RaMoE, for details, refer to the paper "Y. Dai, X. Li, J. Liu, Z. Tong, and L.-Y. Duan, "Generalizable person re-identification with relevance-aware mixture of experts," in Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition, 2021.";

[0110] DMG-Net, for details, refer to the paper "Y. Bai, J. Jiao, W. Ce, J. Liu, Y. Lou, X. Feng, and L.-Y. Duan, "Person30k: A dual-meta generalization network for person re-identification," in Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition, 2021, pp. 2123–2132.";

[0111] DIR-ReID, for details, refer to the paper "Y.-F. Zhang, Z. Zhang, D. Li, Z. Jia, L. Wang, and T. Tan, "Learning domain invariant representations for generalizable person re-identification," IEEE Transactions on Image Processing, vol. 32, pp. 509–523, 2022.";

[0112] QAConv, for details, see the paper "S. Liao and L. Shao, “Interpretable and generalizable person re-identification with query-adaptive convolution and temporal lifting,” in European Conference on Computer Vision. Springer, 2020, pp. 456–474.";

[0113] M3L, for details, see the paper "Y. Zhao, Z. Zhong, F. Yang, Z. Luo, Y. Lin, S. Li, and N. Sebe, “Learning to generalize unseen domains via memory-based multi-source meta-learning for person re-identification,” in Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition, 2021, pp. 6277–6286.";

[0114] MetaBIN, for details, see the paper "S. Choi, T. Kim, M. Jeong, H. Park, and C. Kim, “Meta batch instance normalization for generalizable person re-identification,” in Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition, 2021, pp. 3425–3435.";

[0115] META, for details, see the paper "B. Xu, J. Liang, L. He, and Z. Sun, “Mimic embedding via adaptive aggregation: learning generalizable person re-identification,” in European Conference on Computer Vision. Springer, 2022, pp. 372–388.";

[0116] For details on ACL, please refer to the paper “P. Zhang, H. Dou, Y. Yu, and X. Li, “Adaptive cross-domain learning for generalizable person re-identification,” in European Conference on Computer Vision. Springer, 2022, pp. 215–232.

[0117] Table 1 is a comparison table of the pedestrian re-identification performance of the present invention and the comparison method in this embodiment. The mean accuracy mAP (%) and the first-order accuracy R1 (%) were tested respectively. The present invention is divided into two models, B and L, which represent the standard (ViT-B) and large (ViT-L) pre-trained models used respectively.

[0118]

[0119] Table 1

[0120] As shown in Table 1, the performance of this invention significantly outperforms state-of-the-art methods. This invention achieves higher mAP and R1 on PRID, which uses ViT-B as its backbone, by 12.2% and 16.9% respectively, compared to ACL. On average, across the four datasets, this invention outperforms state-of-the-art methods by 5.7% in mAP and 7.4% in R1. Notably, this invention surpasses previous methods, even those that use Duke-MTMC as part of their training set; for example, on the GRID dataset, this invention achieves a 12.7% higher mAP than DMG-Net.

[0121] Then, to further verify the invention's performance in scenarios with larger and more challenging test domain data, this embodiment conducted a leave-one-out experiment on four datasets: CUHK03, MSMT17, Market1501, and CUHK-SYSU. Specifically, three datasets were selected as the source domain, and the remaining dataset was used as the target domain for testing. Table 2 compares the image classification performance of the present invention and the comparative method in this embodiment under two settings: Protocol 1 (only the source domain training set) and Protocol 2 (both the training and test sets are used).

[0122]

[0123] Table 2

[0124] For Protocol 1, training is performed using only the training set of the dataset, as shown in Table 2. Due to the existence of numerous evaluation datasets for domain-generalized person re-identification, no single method currently achieves state-of-the-art performance across all datasets. For example, META and ACL perform best on the MSMT17 and Market1501 datasets, respectively. When using ViT-B as the backbone, this invention outperforms ACL or META. Furthermore, when using ViT-L as the backbone, this invention consistently outperforms all state-of-the-art methods. For instance, compared to the current state-of-the-art CUHK03 dataset, this invention shows advantages of 4.6% and 3.1% in mAP, respectively.

[0125] Compared to Protocol 1, Protocol 2 involves the integration of training and test sets during training, resulting in a significant increase in training data. As shown in Table 2, SPL maintains a significant lead on the increased training data. Specifically, this invention outperforms ACL by 6.7% in mAP and 5.9% in R1. Compared to the recently proposed SuA-SpML method, this invention outperforms it by 20.1% in mAP and 19.2% in Rank 1.

[0126] Through the above data analysis and comparison, it can be seen that the present invention has a stronger generalization ability for pedestrian re-identification compared with other methods, and has a broader application prospect.

[0127] Although the illustrative specific embodiments of the present invention have been described above to enable those skilled in the art to understand the invention, it should be understood that the invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the invention as defined and determined by the appended claims, and all inventions utilizing the concept of the present invention are protected.

Claims

1. A domain-generalized person re-identification method based on self-prompt learning, comprising the following steps: S1: Construct an image segmentation model to generate a segmentation mask image from the input image based on prompts. Each pixel value in the segmentation mask image represents the probability that the corresponding pixel in the input image belongs to the foreground or the background. A large-scale image segmentation task dataset is set up according to actual needs, and the image segmentation model is pre-trained. The image segmentation model includes an embedding module, a Transformer encoder, a pooling module, a cue encoder, and a mask decoder, wherein: Embedded modules are used to store items of size 1000. Input pedestrian image Divided into Non-overlapping image patches This indicates the number of channels in the input pedestrian image. This represents the size of the input pedestrian image; then each patch is mapped to a vector as an image token, thus obtaining... Image token , Simultaneously, the location embedding of each image patch is obtained. Then Image token and position embedding Superimpose to form an image token sequence And output to the Transformer encoder; Transformer encoders contain stacks. Layer Transformer encoding blocks are used to process the received image token sequence. Encoding is performed, with each Transformer encoding block extracting hidden representations from the input features. , The hidden representation of the last layer's output As an image token sequence Hidden representation Send to the pooling module; The pooling module is used for the hidden representation Perform pooling operation to obtain feature vectors. And output to the mask decoder; The prompt encoder is used to encode the prompt information to obtain the prompt vector. And output it to the mask decoder; The mask decoder is used to determine the feature vector. and hint vector Decoding yields the segmentation mask. ; S2: Based on the image segmentation model pre-trained in step S1, construct a self-prompt-based person re-identification model, including the image segmentation model pre-trained in step S1, an attention-guided prompt generation module, a scene-independent feature extraction module, and a classifier, wherein: The embedding module, Transformer encoder, and pooling module in the image segmentation model are used to process the input image. Feature extraction is performed to obtain pedestrian features. ; The attention-guided cue generation module is used to generate cuees from the Transformer encoder in the image segmentation model. The attention of each image token in the input image token and the output hidden representation is obtained in the Transformer encoding block, and then a set of self-prompts is generated and output to the prompt encoder of the image segmentation model. The specific method is as follows: Describe the hidden representation of each Transformer coded block. middle The image tokens are respectively Input image token sequence Each input image token Each image token in each Transformer encoded block and the feature vector output by the pooling module As nodes, the attention value between each input image token extracted from each Transformer coding block and the output image token is used as the weight of the edge between the corresponding image tokens. The image tokens output from the last layer are then used as the weights. With feature vectors The weight of the edge between them is set to The input image is composed of a weighted directed acyclic graph; then the maximum flow algorithm is used to obtain the token for each input image. to feature vector Maximum flow path Record its flow rate as Before selection The input image token corresponding to the largest traffic , , Indicates the first The sequence number of the input image token corresponding to the maximum flow; then from Input image token Several images are selected as cue image tokens, and their corresponding location information is used as self-cues to form a self-cueset set. The method for selecting cue image tokens is as follows: 1) Input image token As the first prompt image token, its location information is recorded as follows. ; 2) Order number , ; 3) Determine whether , Indicates input image token Location, This indicates calculating the distance. This indicates a preset distance threshold; if so, proceed to step 4; otherwise, proceed to step 6. 4) Input image token As the first A prompt image token; 5) Order Proceed to step 6). 6) Determine if If yes, proceed to step 7; otherwise, the filtering process ends. 7) Order (Return to step 3) The cue encoder in an image segmentation model is used to encode cue information from a set of self-cues to obtain a cue vector. ; The mask decoder in the image segmentation model is used to determine the feature vector. and hint vector Decoding yields the segmentation mask. ; The scene-independent feature extraction module is used to extract the segmentation mask output by the mask decoder. For the Transformer encoder The hidden representation output by the Transformer coded block is processed. Configure according to actual needs, then re-enter the number. The Transformer encoding block performs secondary feature extraction, and finally the pooling module obtains the secondary pedestrian features. And send it to the classifier. The specific method for handling hidden representations is as follows: For segmentation mask Gaussian convolution is used to map the classification results of segmented edges into floating-point values ​​between 0 and 1 to obtain pixel-level segmentation soft masks. Select the first Hidden representation of the output of the Transformer coded block , for hidden representation Perform deconvolution to obtain the segmentation soft mask. Features of the same size Use segmented soft mask Features Features are obtained by performing filtering operations. Then the features Convolution to restore the hidden representation The size of the feature is obtained Then hide the representation and characteristics By merging, a new hidden representation is obtained. : , The classifier is used to classify pedestrian features. The pedestrians are categorized to obtain their IDs. S3: Obtain the training sample set based on the actual deployment scenario. Each training sample pedestrian image is represented as follows: , , This indicates the number of training sample images and the labels of the training samples. Indicates the ID of a pedestrian in a pedestrian image; S4: Fix the parameters of other modules in the self-prompt-based person re-identification model, input each training sample from step S3 into the self-prompt-based person re-identification model, optimize and train the Transformer encoder, and obtain the trained self-prompt-based person re-identification model. S5: When pedestrian re-identification is required, input the pedestrian image into the self-prompting pedestrian re-identification model trained in step S4 to obtain the pedestrian identification result.

2. The domain-generalized pedestrian re-identification method according to claim 1, characterized in that, In step S1, the Transformer encoder The Transformer coding blocks alternately use local attention and global attention mechanisms to process the input features of the current Transformer coding block.

3. The domain generalization pedestrian re-identification method according to claim 1, characterized in that, The hidden representation in step S2 refers to the Transformer coding block number selected during the processing. .

4. The domain generalization pedestrian re-identification method according to claim 1, characterized in that, The method for calculating the loss function during Transformer encoder optimization training in step S4 is as follows: The ID loss of the training samples is calculated using the following formula. : , in, This indicates the number of training samples in a training batch. Indicates the first in the current batch Labels of each training sample Indicates the first in the current batch The secondary pedestrian features obtained from the training samples This represents the classification result of the classifier; The triplet loss of the training samples is calculated using the following formula. : , in, Indicates the first in the current batch The Euclidean distance between the quadratic pedestrian features of each training sample and the same pedestrian samples in the current batch of training samples. Indicates the first in the current batch The Euclidean distance between the quadratic pedestrian features of each training sample and different pedestrian samples in the current batch of training samples. This represents the boundary of the difference between positive and negative samples; The consistency loss of the training samples is calculated using the following formula. : , in, Indicates the first in the current batch The new hidden representation obtained from each training sample Indicates the first in the current batch The hidden representation of each training sample is output by the Transformer encoder. This indicates the search for the L2 norm. Representation and Hiding Representation Matching classifiers Representation and Hiding Representation Matching classifiers This represents calculating the KL divergence between two classification results. Indicates the preset hyperparameters; Then, the final loss is calculated using the following formula. : , in, , , This indicates the preset weights.