A dual-memory dynamic contrastive learning method for clothes-changing pedestrian re-identification

By employing a dual-memory architecture and multi-scale temporal differential feature extraction, combined with similarity-first and diversity-complete strategies, the stability and temporal feature extraction issues of pedestrian re-identification in clothing-changing scenarios are resolved, thereby improving the accuracy of pedestrian re-identification.

CN122023847BActive Publication Date: 2026-07-21SHIJIAZHUANG TIEDAO UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHIJIAZHUANG TIEDAO UNIV
Filing Date
2026-02-03
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing pedestrian re-identification methods lack a stable memory mechanism in clothing-changing scenarios, making it difficult to continuously integrate feature representations of the same pedestrian at different times and with different appearances on a global scale. Furthermore, they do not make sufficient use of temporal information, and the problem of appearance changes interfering with identity learning has not been properly addressed.

Method used

A dual-memory dynamic contrastive learning method is adopted to construct an identity memory prototype library and a temporal memory prototype library respectively. Through multi-scale temporal differential feature extraction and adaptive fusion, combined with similarity-first and diversity completion strategies, the joint optimization and decoupling of identity and temporal features are achieved.

Benefits of technology

It significantly improves the stability of identity representation and the ability to distinguish temporal features, reduces recognition confusion caused by clothing changes, and improves the accuracy of pedestrian re-identification in clothing changing scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122023847B_ABST
    Figure CN122023847B_ABST
Patent Text Reader

Abstract

The application discloses a double memory dynamic contrast learning clothes-changing pedestrian re-identification method. First, the pedestrian video sequence with an identity label is acquired, and a three-dimensional space-time feature map is extracted through a backbone network; then, spatial aggregation features and time sequence difference features are extracted from the feature map; then, the two types of features are projected to identity and time sequence subspaces respectively, and attention weighted aggregation is performed through double memory banks to generate identity enhanced features and time sequence enhanced features; a similarity priority and diversity completion strategy is used to construct a positive and negative sample set, and a weighted contrast loss is calculated to jointly optimize the double memory banks; a sliding average strategy with diversity regularization is used to update the memory prototype; finally, the double path enhanced features are adaptively fused to generate discriminative feature representation, and a pedestrian matching list is returned through similarity sorting. The application focuses on stable identity features independent of clothes through the design of double memory banks and the use of multiple memory prototypes combined dynamically to represent pedestrians.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a dual-memory dynamic contrast learning method for re-identifying pedestrians changing clothes, belonging to the field of computer vision technology. Background Technology

[0002] Person re-identification (ReID) is an important research area in computer vision, aiming to identify the same person across multiple cameras or over long periods. Traditional ReID methods primarily rely on appearance features of single-frame images, such as clothing color and texture, extracting features and performing metric learning through deep convolutional networks. However, in real-world scenarios, pedestrians often change clothing or carry items, leading to significant changes in the visual characteristics of the same person, which severely degrades the performance of traditional appearance-based ReID models.

[0003] To address the issue of appearance changes, researchers have proposed two typical improvement directions. Appearance invariance modeling methods achieve feature alignment at the appearance level by explicitly separating clothing features from identity features or introducing structured priors such as human anatomy analysis and keypoint estimation. Temporal feature modeling methods leverage the inter-frame continuity in video sequences, using models such as 3D convolution, RNNs, or Transformers to model the temporal dynamic patterns of pedestrians and extract identity-related motion representations. However, existing methods still have significant limitations when dealing with clothing-changing scenarios.

[0004] Existing methods lack a stable memory mechanism for identity representation. Model training relies solely on batch-based sample optimization, making it difficult to continuously integrate features of the same pedestrian at different times and with different appearances globally, resulting in an inability to form a stable identity feature representation. Furthermore, existing methods are insufficient in utilizing temporal information, failing to adequately mine dynamic changes across different time scales. In addition, the interference of appearance changes on identity learning has not been properly addressed. In clothing-changing scenarios, clothing features and identity features have a complex coupling relationship. Explicit appearance separation methods introduce additional supervision and noise, while indiscriminate processing is easily dominated by non-identity factors, causing recognition confusion. Achieving implicit decoupling between identity and appearance has become a pressing challenge. Summary of the Invention

[0005] To address the above problems, this invention proposes a dual-memory dynamic contrastive learning method for re-identifying pedestrians changing clothes, comprising the following steps: S1: Obtain pedestrian video sequences with identity tags, and use the backbone network to extract the three-dimensional spatiotemporal feature map of the pedestrian video sequences; S2: Extract spatial aggregation features and temporal difference features from the three-dimensional spatiotemporal feature map respectively; S3: Project the spatial aggregation features and temporal difference features to the identity and temporal subspaces respectively, calculate the similarity with the memory prototypes in their respective memory banks, and generate identity enhancement features and temporal enhancement features based on similarity-weighted aggregation. S4: Employ a similarity-first and diversity-complete strategy to determine the positive sample set and construct the corresponding negative sample set; the size of the positive and negative sample sets and the selection strategy are dynamically adjusted during the training phase. S5: Calculate the weighted positive sample convergence loss and the interval negative sample distance loss for the identity enhancement feature and the temporal enhancement feature respectively. Optimize the discrimination performance of the dual memory database of identity and temporal data by weighted summation of the weight coefficients. S6: For the memory prototypes selected as positive samples, a moving average update strategy with diversity regularization is adopted, while maintaining the update count and the record of the most recent update step of the prototype. S7: Adaptively fuse the identity enhancement features and temporal enhancement features obtained after processing the pedestrian video sequence to be identified through the network model, and obtain the final discriminative feature representation through subsequent network processing; calculate the similarity between the discriminative feature representation and the features in the image library, and generate a pedestrian matching list based on the similarity ranking.

[0006] Furthermore, S2 includes: first, averaging the three-dimensional spatiotemporal feature map extracted from the pedestrian video sequence by the backbone network to generate spatial attention weights; then, multiplying the attention weights element-wise with the original spatiotemporal feature map; and finally, performing temporal and spatial dimensional average pooling on the weighted feature map to obtain spatial aggregated features; simultaneously, constructing multi-scale temporal variation features from the three-dimensional spatiotemporal feature map through adjacent frame differences, window differences, and global differences, and obtaining temporal difference features through convolution and weighted fusion.

[0007] Furthermore, S3 includes: constructing an identity memory prototype library and a temporal memory prototype library, the former storing identity memory prototypes with different appearances, and the latter storing temporal memory prototypes with different behavioral patterns; in each training iteration, projecting spatial aggregation features onto the identity subspace and calculating their similarity to each identity memory prototype in the identity memory prototype library; selecting identity memory prototypes that meet preset similarity conditions and generating identity enhancement features through attention-weighted aggregation; simultaneously, projecting temporal difference features onto the temporal subspace and calculating their similarity to each temporal memory prototype in the temporal memory prototype library, introducing a time decay factor to increase the weight of recent temporal memory prototypes, selecting temporal memory prototypes that meet preset similarity conditions and generating temporal enhancement features through attention-weighted aggregation; introducing feature orthogonality constraints, by calculating the normalized similarity between identity enhancement features and temporal enhancement features, using the mean of the absolute values ​​of similarity as the orthogonal loss, constraining the linear independence of identity and temporal features; wherein, the identity enhancement features strengthen stable appearance features, and the temporal enhancement features retain temporal action information, so as to achieve joint enhancement and decoupling of identity and temporal information.

[0008] Furthermore, the identity memory prototype library and the temporal memory prototype library adopt a dual-memory library architecture design. The identity memory prototype library stores identity memory prototypes through a parameter matrix, and the temporal memory prototype library stores temporal memory prototypes through a parameter matrix. The initialization of the two libraries adopts a hierarchical initialization strategy: the memory prototype parameter matrix of the identity memory prototype library is randomly initialized using a normal distribution with a mean of 0 and a standard deviation of 0.01, and the memory prototype parameter matrix of the temporal memory prototype library is randomly initialized using a normal distribution with a mean of 0 and a standard deviation of 0.02. The access statistics parameters are initialized with zero values, including the update count and the most recent update step of each memory prototype. Each memory prototype does not have a fixed identity label, but rather forms a semantic clustering center dynamically based on its similarity relationship with labeled samples during training. The features of each pedestrian are represented by a combination of multiple memory prototypes, thereby achieving efficient modeling of pedestrian identity representation and implicit decoupling of appearance changes under limited capacity conditions.

[0009] Furthermore, S4 includes: dynamically determining the target number of positive samples in stages based on the identity similarity matrix and the temporal similarity matrix; constructing the positive sample set adopts a similarity-first and diversity-completion strategy, first screening memory prototypes with similarity higher than the threshold, and supplementing the memory prototypes with the fewest updates when insufficient to ensure diversity; the negative sample set is constructed by selecting the memory prototypes with the highest similarity from the non-positive samples with the target of a fixed multiple of the number of positive samples.

[0010] Furthermore, S5 includes: calculating contrast loss for identity enhancement features and temporal enhancement features respectively, with each memory bank containing positive sample convergence loss and negative sample divergence loss; wherein, the positive sample convergence loss is weighted by a weight matrix to strengthen the constraint of high-value positive samples; the negative sample divergence loss adopts an interval threshold mechanism to ensure the distinguishability of positive and negative samples; and the identity memory bank loss and temporal memory bank loss are weighted and summed by weight coefficients to achieve joint optimization of the discrimination performance of the dual memory banks.

[0011] Furthermore, S6 includes: applying a moving average update strategy with diversity regularization to the memory prototypes selected as positive samples, retaining historical information while absorbing current query features, and suppressing excessive aggregation by penalizing excessively high similarity between prototypes; at the same time, maintaining the update count and the most recent update step record of each memory prototype to support subsequent sample screening and diversity completion.

[0012] Compared with the prior art, the present invention has the following beneficial effects: First, this invention proposes a dual-memory architecture. By constructing an identity memory prototype library and a temporal memory prototype library respectively, identity-related features and temporal dynamic features are independently modeled. Combined with the continuous update mechanism of the dual-memory library, continuous learning of pedestrian features across batches is achieved, which significantly improves the stability of identity representation. Second, this invention proposes a multi-scale temporal differential feature extraction and adaptive fusion mechanism, which combines the collaborative modeling of adjacent frame differential, sliding window differential and global differential, and generates information at different time scales through weighted adaptive fusion, fully mining the dynamic change features of pedestrians and improving the discrimination ability of temporal features; Third, this invention proposes a similarity-first and diversity-complete strategy. It dynamically constructs a set of positive and negative samples based on the similarity between query features and memory prototypes, and combines a moving average update strategy with diversity regularization to achieve implicit decoupling between identity and appearance without the need for appearance annotation. This allows the model to automatically focus on stable identity features and reduce recognition confusion caused by clothing changes. Fourth, experimental results on the publicly available video person re-identification dataset VCCR show that significant improvements have been achieved in both mAP and Rank-1 key evaluation metrics, fully demonstrating the effectiveness of the present invention. Attached Figure Description

[0013] To make the technical solution and beneficial effects of the present invention clearer, the specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the accompanying drawings are only for illustrating structural examples of the present invention and are not intended to limit the scope of protection of the present invention.

[0014] Figure 1The flowchart of the steps of the dual-memory dynamic contrast learning method for re-identifying pedestrians changing clothes provided by the present invention is shown below; Figure 2 This invention provides an overall framework diagram of a dual-memory dynamic contrast learning method for re-identifying pedestrians changing clothes. Figure 3 A schematic diagram of adjacent frame difference for a dual-memory dynamic contrast learning method for re-identifying pedestrians changing clothes, provided by the present invention; Figure 4 A window difference diagram illustrating a dual-memory dynamic contrast learning method for re-identifying pedestrians changing clothes, provided by this invention; Figure 5 The flowchart shows the positive and negative sample selection process for a dual-memory dynamic contrastive learning method for re-identifying pedestrians changing clothes, as provided in this invention. Detailed Implementation

[0015] To enable those skilled in the art to more intuitively and comprehensively understand the technical solution and implementation process of the present invention, the present invention will now be further described in conjunction with specific embodiments. It should be understood that the following embodiments are only used to illustrate the principles and technical details of the present invention and do not constitute a limitation on the scope of protection of the present invention.

[0016] like Figure 1 The diagram shows a flowchart of the steps in a dual-memory dynamic contrastive learning method for re-identifying pedestrians changing clothes, provided by the present invention. The steps include: S1: Obtain pedestrian video sequences with identity tags, and use the backbone network to extract the three-dimensional spatiotemporal feature map of the pedestrian video sequences; S2: Extract spatial aggregation features and temporal difference features from the three-dimensional spatiotemporal feature map respectively; S3: Project the spatial aggregation features and temporal difference features to the identity and temporal subspaces respectively, calculate the similarity with the memory prototypes in their respective memory banks, and generate identity enhancement features and temporal enhancement features based on similarity-weighted aggregation. S4: Employ a similarity-first and diversity-complete strategy to determine the positive sample set and construct the corresponding negative sample set; the size of the positive and negative sample sets and the selection strategy are dynamically adjusted during the training phase. S5: Calculate the weighted positive sample convergence loss and the interval negative sample distance loss for the identity enhancement feature and the temporal enhancement feature respectively. Optimize the discrimination performance of the dual memory database of identity and temporal data by weighted summation of the weight coefficients. S6: For the memory prototypes selected as positive samples, a moving average update strategy with diversity regularization is adopted, while maintaining the update count and the record of the most recent update step of the prototype. S7: Adaptively fuse the identity enhancement features and temporal enhancement features obtained after processing the pedestrian video sequence to be identified through the network model, and obtain the final discriminative feature representation through subsequent network processing; calculate the similarity between the discriminative feature representation and the features in the image library, and generate a pedestrian matching list based on the similarity ranking.

[0017] like Figure 2 The diagram shown illustrates the overall framework of a dual-memory dynamic contrastive learning-based pedestrian re-identification method for changing clothes, provided by this invention. It mainly comprises four parts: feature separation, memory retrieval, positive and negative sample selection, and memory update.

[0018] This invention provides a preferred embodiment for executing S2. This embodiment aims to extract spatial aggregation features and temporal difference features from the three-dimensional spatiotemporal feature map, respectively, to provide high-quality input features for subsequent memory retrieval.

[0019] S21: Using three-dimensional spatiotemporal feature maps As input, the feature maps are first averaged over time, and then spatial attention weights are generated using two convolutional layers and a sigmoid activation function. The calculation formula is as follows: , Obtain attention weights Then, it is compared with the input feature map. Perform element-wise multiplication to obtain the weighted feature map. The calculation formula is as follows: ,

[0020] Subsequently, the weighted feature maps were processed in both time and space dimensions. Spatial aggregation features are obtained by performing average pooling. The calculation formula is as follows: , in, This represents the convolution operation. This indicates that the average is taken over the time dimension. This represents element-wise multiplication. This represents the average pooling operation in both the time and space dimensions.

[0021] S22: As Figure 3 The diagram shown illustrates the adjacent frame difference of a dual-memory dynamic contrastive learning-based pedestrian re-identification method for changing clothes provided by this invention. For each time step... , will the Feature map at each time step Features of the next time step Perform element-wise difference operations and combine them with spatial attention weights. Weighting is performed to obtain the difference between adjacent frames. The calculation formula is as follows: .

[0022] like Figure 4 The diagram shown is a window difference schematic of a dual-memory dynamic contrastive learning method for pedestrian re-identification after clothing changes, provided by this invention. For each time step... , the features of the current time step Features of window start time step Perform element-wise difference operations and combine them with spatial attention weights. Weighting is performed to obtain the window difference. The calculation formula is as follows: , Features of the first frame of the sequence Features of the last frame Perform element-wise differencing and combine it with spatial attention weights. By weighting, we obtain the global difference. The calculation formula is as follows: .

[0023] S23: Inter-frame difference After 3D convolution, average pooling is performed in both temporal and spatial dimensions to obtain aggregated features of adjacent frames. The calculation formula is as follows: , Window difference After 3D convolution, average pooling is performed in both temporal and spatial dimensions to obtain window aggregation features. The calculation formula is as follows: , Global difference After convolutional encoding, average pooling is performed in both temporal and spatial dimensions to obtain the global aggregated features. The calculation formula is as follows: , in, This represents a 3D convolution operation.

[0024] S26: Concatenate the aggregated features of the three scales along the channel dimension to form a fused input. The calculation formula is as follows: , Will The input is fed into the weight generation module, first passing through two layers of one-dimensional convolution and GELU activation, and then through Softmax normalization to generate a fused weight matrix. The calculation formula is as follows: , Finally, weighted fusion is performed using the weight matrix to obtain the temporal difference features. The calculation formula is as follows: , in, This indicates a splicing operation. This is the temperature coefficient.

[0025] This invention provides a preferred embodiment for executing S3. This embodiment aims to enhance spatial aggregation features and temporal difference features respectively through dual memories.

[0026] S31: Identity Memory Prototype Library Retrieval S311: Spatial Aggregation Features For each identity memory prototype in the identity memory prototype library, an identity type constraint projection operation is performed. This projection function consists of two layers of linear transformation and ReLU activation. Its calculation formula is as follows: , , in, This is the set of learnable parameters for the projection function; For identity memory prototype library; For identity lookup features; This is a prototype library for projected identity memory.

[0027] S312: Calculate identity query features Similarity matrix with the projected identity memory prototype library Introducing a temperature coefficient Control the similarity distribution. The calculation formula is: , in, Represents matrix multiplication operation; For identity similarity matrix (elements) Indicates the first Individual pedestrian identity query features and index values (Similarity of identity memory prototypes).

[0028] S313: Identity similarity for each pedestrian Sort in descending order and select the top-ranked items. Constructing an effective prototype mask for the identity memory prototype of a bit. And calculate the attention weight matrix of the effective identity memory prototype. The calculation formula is: , , , in, Indicates the first Individual pedestrian identity query features and index values Ranking of similarity between identity memory prototypes; This indicates sorting in descending order and returning the index; Attention weight matrix (elements) for effective identity memory prototype Indicates the first Individual pedestrian identity query features and index values Attention weights of identity memory archetypes); This is the capacity of the identity memory prototype library.

[0029] S314: Attention Weight Matrix Based on Effective Identity Memory Prototype For the selected first Weighted summation of identity memory prototypes with high similarity is performed to generate identity enhancement features. The calculation formula is as follows: .

[0030] S32: Time-series memory prototype library retrieval S321: Temporal difference features Each temporal memory prototype in the temporal memory prototype library is subjected to a temporal type-constrained projection operation. This projection function consists of two layers of linear transformation and ReLU activation. Its calculation formula is as follows: , , in, This is the set of learnable parameters for the projection function; For sequential memory prototype library; This is a time-series query feature; This is a prototype library of projected temporal memories.

[0031] S322: Compute Time-Series Query Features Similarity matrix with the projected temporal memory prototype library Introducing a time decay factor Increase the weight of recently stored memory prototypes and use temperature coefficients. Scaling is applied to adjust the similarity distribution. The calculation formula is: , , in, The attenuation coefficient is... The storage duration of the temporal memory prototype with the index value; The temporal similarity matrix (elements) Indicates the first Individual pedestrian query and index value (Similarity of the temporal memory prototype).

[0032] S323: Temporal similarity for each pedestrian Sort in descending order and select the top-ranked items. Constructing an effective prototype mask for the temporal memory prototype of a bit. And calculate the attention weight matrix of the effective temporal memory prototype. The calculation formula is: , , , in, Indicates the first Individual pedestrian time-series query features and index values Ranking of similarity between temporal memory prototypes; Attention weight matrix (elements) for effective temporal memory prototypes Indicates the first Individual pedestrian time-series query features and index values Attention weights of the temporal memory prototype). This is the capacity of the temporal memory prototype library.

[0033] S324: Attention weight matrix based on effective temporal memory prototype For the selected first Weighted summation of temporal memory prototypes based on positional similarity is performed to generate temporal enhancement features. The calculation formula is as follows: .

[0034] S33: Characteristic Orthogonality Constraint To ensure the decoupling of identity features and temporal features in the feature space and to prevent feature interference and information redundancy, a feature orthogonality constraint loss is introduced. The calculation formula is as follows: , in, For batch size, This indicates the L2 normalization operation. This represents the enhanced identity feature of the i-th pedestrian; This represents the temporal enhancement feature of the i-th pedestrian.

[0035] This invention provides a preferred embodiment for executing S4. This embodiment aims to balance similarity reliability and sample diversity, constructing a set of positive and negative samples for contrastive learning. Figure 5 The diagram shows the positive and negative sample selection process of a dual-memory dynamic contrastive learning method for re-identifying pedestrians changing clothes, provided by this invention.

[0036] S41: Construction of the Positive Sample Set S411: Divide the training into stages based on the number of steps (steps), and calculate the number of positive target samples in the identity memory prototype library and the temporal memory prototype library respectively, using the proportional coefficients for different stages. The calculation results are rounded down to ensure they are integers. The calculation formula is as follows: , , in, This indicates a round-down operation; The number of positive target samples representing the identity memory prototype library. The number of positive target samples in the temporal memory prototype library; step is the current training step number; , Define the boundaries for each stage; , , These are the proportional coefficients for each stage.

[0037] S412: Identity Memory Prototype Library Similarity Priority Phase Set similarity threshold From the identity memory prototype library Filter out the identity similarity matrix The element value is greater than or equal to Identity memory prototypes were selected and sorted in descending order of similarity. The top-ranked prototypes were then selected. Each identity memory prototype forms a preliminary positive sample subset. The calculation formula is as follows: , , in, This indicates selecting the first [order] after sorting. One element; The number of positive samples in the identity memory prototype library similarity priority stage.

[0038] S413: Identity Memory Prototype Library Diversity Completion Phase If the number of positive samples obtained in the similarity-first phase The number of positive target samples is less than that of the identity memory prototype library. Calculate the number of items needed to complete the task. From the identity memory prototype library Excluding the initial positive sample subset This yields the set of remaining identity memory prototypes; first, the remaining identity memory prototypes are sorted in ascending order by update count, then the top ones in the sorted set are selected. Each identity memory prototype forms a subset of the completed positive samples. ; the initial positive sample subset With the complete positive sample subset By merging, we obtain a set of positive identity samples. The calculation formula is as follows: , , , , in, The number of positive samples representing the diversity completion stage of the identity memory prototype library; Indicates that the index value is The number of times j's identity memory prototype is updated; The set of indices for the remaining identity memory prototypes, sorted in ascending order by the number of updates. This indicates selecting the first few items in the sorted index. Each element.

[0039] S414: Temporal Memory Prototype Library Similarity Priority Phase Set similarity threshold From the temporal memory prototype library Selecting the temporal similarity matrix The element value is greater than or equal to The temporal memory prototypes were selected and sorted in descending order of similarity. The top-ranked prototypes were then selected. A temporal memory prototype was used to form a preliminary positive sample subset. The calculation formula is as follows: , , in, This indicates selecting the first [order] after sorting. One element; This represents the number of positive samples in the similarity-priority phase of the temporal memory prototype library.

[0040] S415: Diversity Completion Phase of the Temporal Memory Prototype Library If the number of positive samples obtained in the similarity-first phase The number of positive samples less than the number of time-series memory prototype libraries Calculate the number of items needed to complete the task. From the temporal memory prototype library Excluding the initial positive sample subset This yields the remaining temporal memory prototype set; first, the remaining temporal memory prototypes are sorted in ascending order by update count, then the top ones in the sorted set are selected. A prototype, forming a subset of complete and corrected samples. ; the initial positive sample subset With the complete positive sample subset By merging, we obtain a set of positive time-series samples. The calculation formula is as follows: , , , , in, The number of positive samples representing the diversity completion stage of the temporal memory prototype library; Indicates the first The number of times a temporal memory prototype is updated; The set of indices for the remaining temporal memory prototypes, sorted in ascending order by the number of updates. This indicates selecting the first few items in the sorted index. Each element.

[0041] S416: For the first Individual pedestrian identity query features, in the positive sample set The index value is The identity memory prototype is used to calculate the update sparsity weight based on the difference between its update count and the maximum update count in the identity memory prototype library. The calculation formula is as follows: , in, For the set of positive identity samples The index value is The cumulative number of updates to the identity memory prototype. This represents the maximum number of updates for all identity memory prototypes in the current identity memory prototype library.

[0042] For the positive sample set of identity The similarity value of each identity memory prototype is superimposed with a frequency compensation term, and then normalized using the Softmax function to generate the final identity positive sample weights. A weight matrix is ​​constructed based on these positive sample weights, with the positions belonging to positive samples assigned the corresponding weights, and the remaining positions assigned 0. The calculation formula is as follows: , , in, Indicates the first Individual pedestrian identity query features and index values The weight of the identity memory prototype; Indicates the sparsity compensation coefficient; Represents the natural exponential function; This represents the identity memory weight matrix.

[0043] S417: Regarding the first Individual pedestrian time-series query features, in the time-series positive sample set The index value is For the temporal memory prototype, the update sparsity weight is calculated based on the difference between its update count and the maximum update count in the temporal memory prototype library. The calculation formula is as follows: , in, For the time series positive sample set The index value is The cumulative number of updates to the temporal memory prototype. This represents the maximum number of updates for all time-series memory prototypes in the current time-series memory prototype library.

[0044] For the time series positive sample set The similarity value of each temporal memory prototype is superimposed with a frequency compensation term, and then normalized using the Softmax function to generate the final temporal positive sample weights. A weight matrix is ​​constructed based on the temporal positive sample weights, with the positions belonging to positive samples in the matrix assigned the corresponding weights, and the remaining positions assigned 0. The calculation formula is as follows: , , in, Indicates the first Individual pedestrian identity query features and index values The weight of the temporal memory prototype; Indicates the sparsity compensation coefficient; This represents the weight matrix of the time-series memory.

[0045] S42: Construction of Negative Sample Set S421: Based on the number of positive target samples in the identity memory bank, determine the number of negative target samples by a ratio of 5. Then, exclude the selected positive identity samples from the identity memory prototype library. For the remaining non-positive samples, sort them by "compared to the current number". Identity similarity for individual pedestrian queries Sort in descending order, select the first few rows after sorting. The identity memory prototypes with the highest similarity directly constitute the final negative sample set of the identity memory prototype library. The calculation formulas are as follows: , , in, Indicates before selection One sample.

[0046] S422: Based on the target number of positive samples in the temporal memory prototype library, determine the target number of negative samples in the temporal memory prototype library by a ratio of 5. Then, the selected positive samples are excluded from the temporal memory prototype library. For the remaining non-positive samples, sort them by "compared to the current number". Temporal similarity of individual pedestrian queries Sort in descending order, select the first few rows after sorting. The temporal memory prototypes with the highest similarity directly constitute the final negative sample set of the temporal memory prototype library. The calculation formula is as follows: , , in, Indicates before selection One sample.

[0047] This invention provides a preferred embodiment for executing S5. This embodiment aims to optimize the discriminative power of memory enhancement features and the representation accuracy of memory prototypes in the memory bank by calculating the positive and negative sample comparison loss between the identity memory prototype bank and the temporal memory prototype bank.

[0048] S51: Loss Calculation of Identity Memory Prototype Library S511: Regarding the first Individual pedestrian identity query features, targeting the identity memory prototype index Through the identity memory weight matrix Extract corresponding weights ; Calculate identity enhancement features Identity memory prototypes in this exclusive set of positive identity samples of The norm squared, multiplied by the distance value and the weight, yields the first... The loss for narrowing down the positive identity samples of each pedestrian is calculated by summing the positive identity sample narrowing losses of all pedestrians in the current batch and taking the average. The calculation formula is as follows: , Where N is the total number of pedestrians in the current batch; express Norm square, Let represent the set of positive samples representing the unique identity of the i-th pedestrian.

[0049] S512: For the first Individual pedestrian identity query features, targeting the identity memory prototype index Calculate identity enhancement features With the index value in the identity memory bank Identity Memory Prototype of Norm squared, calculating the interval threshold The difference from this distance value is the first The identity negative sample distance loss for each pedestrian is calculated by summing and averaging the identity negative sample distance losses for all pedestrians in the current batch. The calculation formula is as follows: , in, Let represent the set of negative samples representing the unique identity of the i-th pedestrian.

[0050] S513: Bring positive samples closer to the loss Multiply by the positive sample weight coefficient Negative sample distance loss Multiply by the negative sample weight coefficient The sum of the two yields the total loss of the identity memory bank. .

[0051] S52: Calculation of Temporal Memory Loss S521: Regarding the first Individual pedestrian time-series query features, targeting the time-series memory prototype index Through the positive sample weight matrix of the time-series memory Extract corresponding weights ; Computation of temporal enhancement features With the index value in the temporal memory prototype library The prototype of temporal memory of The norm squared is used to multiply the distance value by the weight to obtain the temporal positive sample convergence loss for the i-th pedestrian; finally, the temporal positive sample convergence losses of all pedestrians in the current batch are summed and averaged to obtain the temporal positive sample convergence loss. The calculation formula is as follows: , in, Let represent the set of positive temporal samples specific to the i-th pedestrian.

[0052] S522: For the first Individual pedestrian time-series query features, targeting the time-series memory prototype index Calculate temporal enhancement features With the temporal memory prototype in this exclusive negative sample set of Norm squared, calculating the interval threshold The difference from this distance value yields the temporal negative sample retraction loss for the i-th pedestrian; finally, the temporal negative sample retraction losses of all pedestrians in the current batch are summed and averaged to obtain the temporal negative sample retraction loss. The calculation formula is as follows: , in, Let represent the set of time-series negative samples specific to the i-th pedestrian.

[0053] S523: Bring positive samples closer to the loss Multiply by the time series positive sample weighting coefficient Negative sample distance loss Multiply by the time series negative sample weighting coefficient The sum of the two yields the total loss of the temporal memory. The formula for its calculation is: .

[0054] This invention provides a preferred embodiment for executing S6. This embodiment aims to optimize the memory prototype using a moving average update strategy with diversity regularization, while maintaining the update state parameters.

[0055] S61: Identity Memory Prototype Update and Internal Diversity Constraints S611: For the set of positive identity samples All within satisfy , and Different identity memory prototype pairs, calculate the two identity memory prototypes in the first... Step characteristics and cosine similarity The calculation formula is as follows: , in, The index value in the identity memory prototype library is [value]. The characteristics of the identity memory prototype at step t; This represents the similarity between identity memory prototypes with indices m and k within the set of positive identity samples.

[0056] S612: Sum all similarity results, then divide the sum by the number of elements in the positive sample set. The square of the result is used to calculate the internal diversity loss of the positive identity sample set. The calculation formula is as follows: .

[0057] S613: Combining learning rate With diversity balance coefficient Calculate the index value in the positive sample set of identity. The updated results of the identity memory prototype: Preserve historical information, Absorb query features, with Suppressing prototype dependence on similar identity memories; the sum of the three terms yields the first. Step characteristics The calculation formula is as follows: , in, This indicates the query features absorbed during the memory prototype update.

[0058] S614: Update the identity memory prototype update counter Compared with the most recently updated step counter This records the prototype update status to support subsequent management. The calculation formula is: , in, This indicates the number of times the identity memory prototype with index value m is updated at time step t; This represents the most recent update step of the identity memory prototype with index value m.

[0059] S62: Temporal Memory Prototype Update and Internal Diversity Constraints S621: For the time series positive sample set All within satisfy , and Different temporal memory prototype pairs, calculate the two temporal memory prototypes in the first... Step characteristics and cosine similarity The calculation formula is as follows: , in, This indicates that the index value in the temporal memory prototype library is... The characteristics of the temporal memory prototype at step t; This represents the similarity between temporal memory prototypes with indices m and k within the set of temporal positive samples.

[0060] S622: Sum all similarity results, then divide the sum by the number of elements in the time-series positive sample set. The square of this value is used to calculate the internal diversity loss of the time-series positive sample set through normalization. The calculation formula is: .

[0061] S623: Combining learning rate With diversity balance coefficient Calculate the first positive sample in the time series. Update results of a temporal memory prototype: Preserve historical information, Absorb query features, with Suppressing prototype dependence of similar temporal memories; the sum of the three terms yields the first... Step characteristics The calculation formula is as follows: .

[0062] S624: Update counter for updating the prototype of the time sequence memory Compared with the most recently updated step counter This records the prototype update status to support subsequent management. The calculation formula is: , in, This indicates the number of times the temporal memory prototype with index value m is updated at time step t; This represents the most recent update step of the temporal memory prototype with index value m.

[0063] This embodiment conducts experimental validation on the publicly available and challenging VCCR video person re-identification dataset, which supports both clothing-changing and standard scenarios, providing comprehensive validation of the model's performance. The model's effectiveness is evaluated using common metrics in the person re-identification field: mean average precision (mAP) and Rank-1 of cumulative matching features (CMC).

[0064] As shown in Table 1, the proposed dual-memory dynamic contrastive learning method for re-identifying pedestrians changing clothes, in both the changing and standard scenarios of the VCCR dataset, outperforms the comparative methods in terms of mean accuracy and Rank-1 index in the cumulative matching features. This fully demonstrates the effectiveness of this method in the task of re-identifying pedestrians changing clothes.

[0065] Table 1. Comparison of experimental results of the proposed method on the VCCR dataset

Claims

1. A dual-memory dynamic contrast learning method for pedestrian re-identification after clothing change, characterized in that, Includes the following steps: S1: Obtain pedestrian video sequences with identity tags, and use the backbone network to extract the three-dimensional spatiotemporal feature map of the pedestrian video sequences; S2: Extract spatial aggregation features and temporal difference features from the three-dimensional spatiotemporal feature map respectively; S3: Project the spatial aggregation features and temporal difference features to the identity and temporal subspaces respectively, calculate the similarity with the memory prototypes in their respective memory banks, and generate identity enhancement features and temporal enhancement features based on similarity-weighted aggregation. S4: Employ a similarity-first and diversity-complete strategy to determine the positive sample set and construct the corresponding negative sample set; the size of the positive and negative sample sets and the selection strategy are dynamically adjusted during the training phase. S5: Calculate the weighted positive sample convergence loss and the interval negative sample distance loss for the identity enhancement feature and the temporal enhancement feature respectively. Optimize the discrimination performance of the dual memory database of identity and temporal data by weighted summation of the weight coefficients. S6: For the memory prototypes selected as positive samples, a moving average update strategy with diversity regularization is adopted, while maintaining the update count and the record of the most recent update step of the prototype. S7: Adaptively fuse the identity enhancement features and temporal enhancement features obtained after the video sequence of the pedestrian to be identified is processed by the network model, and then obtain the final discriminative feature representation through subsequent network processing; Calculate the similarity between the discriminative feature representation and the features in the image library, and generate a pedestrian matching list based on the similarity ranking.

2. The method for re-identifying pedestrians changing clothes using dual-memory dynamic contrastive learning as described in claim 1, characterized in that, S2 includes: first, averaging the three-dimensional spatiotemporal feature map extracted from the pedestrian video sequence by the backbone network to generate spatial attention weights; then, multiplying the attention weights element-wise with the original spatiotemporal feature map; and finally, performing temporal and spatial dimensional average pooling on the weighted feature map to obtain spatial aggregated features. Simultaneously, constructing multi-scale temporal variation features from the three-dimensional spatiotemporal feature map through adjacent frame differences, window differences, and global differences, and obtaining temporal difference features through convolution and weighted fusion.

3. The method for re-identifying pedestrians changing clothes using dual-memory dynamic contrastive learning as described in claim 1, characterized in that... S3 includes: constructing an identity memory prototype library and a temporal memory prototype library, the former storing identity memory prototypes with different appearances and the latter storing temporal memory prototypes with different behavioral patterns; in each training iteration, projecting spatial aggregation features onto the identity subspace and calculating their similarity with each identity memory prototype in the identity memory prototype library; selecting identity memory prototypes that meet preset similarity conditions and generating identity enhancement features through attention-weighted aggregation; simultaneously, projecting temporal difference features onto the temporal subspace and calculating their similarity with each temporal memory prototype in the temporal memory prototype library, introducing a time decay factor to increase the weight of recent temporal memory prototypes, selecting temporal memory prototypes that meet preset similarity conditions and generating temporal enhancement features through attention-weighted aggregation; introducing feature orthogonality constraints, by calculating the normalized similarity between identity enhancement features and temporal enhancement features, using the mean of the absolute values ​​of similarity as the orthogonal loss, constraining the linear independence between identity and temporal features; wherein, the identity enhancement features strengthen stable appearance features, and the temporal enhancement features retain temporal action information, so as to achieve joint enhancement and decoupling of identity and temporal information.

4. The dual-memory dynamic contrast learning method for pedestrian re-identification after clothing change, as described in claim 3, is characterized in that... The identity memory prototype library and the temporal memory prototype library adopt a dual-memory library architecture design. The identity memory prototype library stores identity memory prototypes through a parameter matrix, while the temporal memory prototype library stores temporal memory prototypes through a parameter matrix. The initialization of the two memory banks adopts a hierarchical initialization strategy: the memory prototype parameter matrix of the identity memory prototype bank is randomly initialized using a normal distribution with a mean of 0 and a standard deviation of 0.01, and the memory prototype parameter matrix of the time sequence memory prototype bank is randomly initialized using a normal distribution with a mean of 0 and a standard deviation of 0.02; the access statistics parameters are initialized with zero values, including the update count and the most recent update step of each memory prototype; each memory prototype does not have a fixed identity label, but dynamically forms semantic cluster centers based on the similarity relationship with labeled samples during training; the features of each pedestrian are represented by a combination of multiple memory prototypes, thereby achieving efficient modeling of pedestrian identity representation and implicit decoupling of appearance changes under limited capacity conditions.

5. The method for re-identifying pedestrians changing clothes using dual-memory dynamic contrastive learning as described in claim 1, characterized in that, S4 includes: dynamically determining the target number of positive samples in stages based on the identity similarity matrix and the temporal similarity matrix; constructing the positive sample set adopts a similarity-first and diversity-completion strategy, first screening memory prototypes with similarity higher than the threshold, and supplementing the memory prototypes with the fewest updates when insufficient to ensure diversity; the negative sample set is constructed by selecting the memory prototypes with the highest similarity from the non-positive samples with the target of a fixed multiple of the number of positive samples.

6. The method for re-identifying pedestrians changing clothes using dual-memory dynamic contrastive learning as described in claim 1, characterized in that, S5 includes: calculating contrast loss for identity enhancement features and temporal enhancement features respectively, with each memory bank containing positive sample convergence loss and negative sample distance loss; wherein, the positive sample convergence loss is weighted by a weight matrix to strengthen the constraint of high-value positive samples; the negative sample distance loss adopts an interval threshold mechanism to ensure the distinguishability of positive and negative samples; and the identity memory bank loss and temporal memory bank loss are weighted and summed by weight coefficients to achieve joint optimization of the discrimination performance of the dual memory banks.

7. The dual-memory dynamic contrast learning method for pedestrian re-identification after clothing change, as described in claim 1, is characterized in that... S6 includes: applying a moving average update strategy with diversity regularization to the memory prototypes selected as positive samples, retaining historical information while absorbing current query features, and suppressing excessive aggregation by penalizing excessively high similarity between prototypes; at the same time, maintaining the update count and the most recent update step record of each memory prototype to support subsequent sample screening and diversity completion.