Pedestrian re-identification method based on camera diversity constraint
By incorporating camera diversity constraints and dynamically updating the agent into DBSCAN clustering, the problems of inconsistent feature distribution and non-robust clustering in cross-camera recognition are solved, thereby improving the cross-camera generalization performance and clustering stability of person re-identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-22
- Publication Date
- 2026-03-17
AI Technical Summary
Existing unsupervised pedestrian re-identification methods suffer from significant differences across cameras, as well as substantial variations in feature space distribution due to differences in illumination and angle. Clustering is not robust, and the traditional DBSCAN algorithm does not consider camera diversity, resulting in single-camera pseudo-clusters and weak cross-camera discrimination capabilities.
By acquiring pedestrian image datasets from different cameras, feature extraction and normalization are performed, cosine similarity between samples is defined, a neighbor set is constructed, and camera diversity conditions are added to DBSCAN clustering to obtain an improved DBSCAN clustering. Global cluster agents and camera cluster agents are defined, dynamic weights are set, and agent dispersion regularization terms are introduced to construct intra-camera loss and cross-camera loss, which are then dynamically updated.
It effectively improves the cross-camera generalization performance and clustering stability of unsupervised pedestrian re-identification, and enhances the consistency of feature distribution and the model's generalization ability.
Smart Images

Figure CN121686521A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep learning technology, and in particular to a pedestrian re-identification method based on camera diversity constraints. Background Technology
[0002] Pedestrian re-identification is a key task in intelligent surveillance and video analytics, aiming to match the identity of the same pedestrian across different cameras. Existing unsupervised pedestrian re-identification methods generally rely on clustering and contrastive learning, but they suffer from several problems, such as large cross-camera differences. Differences in lighting, angle, and resolution between different cameras lead to significant variations in the distribution of the same pedestrian in the feature space, making cross-camera alignment difficult. Furthermore, clustering is not robust. The traditional density-based clustering algorithm DBSCAN determines core points based solely on similarity thresholds and the number of neighbors, failing to consider camera diversity and easily generating pseudo-clusters in single cameras, thus weakening cross-camera discrimination capabilities. Summary of the Invention
[0003] In view of this, the present invention provides a pedestrian re-identification method based on camera diversity constraints, which can effectively improve the cross-camera generalization performance and clustering stability of unsupervised pedestrian re-identification.
[0004] In a first aspect, the present invention provides a pedestrian re-identification method based on camera diversity constraints, the method comprising: Step 1: Obtain pedestrian image datasets from different cameras, perform feature extraction and normalization, and obtain normalized feature vectors; Step 2: Define the cosine similarity between samples based on the normalized feature vectors and construct a neighbor set; and add camera diversity conditions to DBSCAN clustering to obtain improved DBSCAN clustering; Step 3: Based on the improved DBSCAN clustering, obtain the global cluster agent, define the dynamic weight of the camera, obtain the camera cluster agent, and then dynamically update each agent; Step 4: Based on the global cluster agent and the camera cluster agent, construct the intra-camera loss and cross-camera loss, set dynamic weights, and then introduce the agent dispersion regularization term to obtain the total loss.
[0005] Optionally, step 1 includes: make Represents the unlabeled training dataset, where Indicates the input image. This indicates the number of input images, and the camera ID corresponding to each image is represented as: ,in The eigenvector is represented as ,in Represents a network. The parameters are then normalized to obtain the samples. Normalized eigenvectors .
[0006] Optionally, step 2 includes: Based on the normalized feature vectors, the cosine similarity between samples is defined as follows: ; in, Indicates the first With the Cosine similarity of samples; Indicates sample Normalized feature vectors; construct the neighbor set, its expression is: ; in, Representation and Sample Similarity refers to the set of neighbors that meet the threshold. Indicates camera to The similarity threshold; Subsequently, camera diversity conditions were added to the core point determination of DBSCAN clustering. The core determination conditions are as follows: and ; in, This represents the number of neighbors, i.e., the number of samples that meet the threshold. This represents the minimum number of neighbors threshold for DBSCAN clustering. This represents the set of cameras corresponding to a neighbor; This represents the minimum value for camera diversity.
[0007] Optionally, step 3 includes: Based on the improved DBSCAN clustering, a global cluster agent is defined, whose expression is: ; in, This represents the global cluster proxy for the k-th cluster; Represents the set of all samples in the k-th cluster; Define a camera cluster proxy, its expression is: ; in, Indicates in camera The camera cluster proxy for the k-th cluster; Indicates camera The sample set of the k-th cluster; Represents a set The number of samples; The dynamic weights of the camera are represented by the following expression: ; in, , which represents the reliability of camera c; An index representing the influence of the number of samples on the weights; Indicates camera The sample set of the k-th cluster; Represents a set The number of samples; Subsequently, the Exponential Mean Economic Index (EMA) is used to dynamically update the global cluster agent and the camera cluster agent. Its expression is: ; ; in, This represents the EMA attenuation coefficient.
[0008] Optionally, step 4 includes: Based on the global cluster proxy and the camera cluster proxy, the intra-camera loss and cross-camera loss are calculated, and their expressions are as follows: ; in, Indicates sample Normalized feature vectors; Indicates in camera Lower sample The Individual camera cluster agents, Indicates camera Next Individual camera cluster agents, Indicates temperature parameter; ; in, Indicates sample Belonging to Global cluster proxy for each cluster; Indicates the first Global cluster proxy for each cluster; The dynamic weights are set, and the expressions for the in-camera dynamic weights and cross-camera dynamic weights are as follows: ; ; in, This indicates the current training epoch. and These represent the initial weights within the camera and the initial weights across cameras, respectively. A coefficient representing the rate of decay; Subsequently, a proxy dispersion regular expression is introduced, the expression of which is: ; in, , These respectively represent the camera Next The, the A cluster of cameras acting as a proxy; This represents the cosine similarity between two camera cluster proxies. This means that the high similarity term is amplified by an exponential function to increase the penalty when agents are too close. The total loss is expressed as: ; in, Indicates the total number of samples in the training batch; This represents the dispersion regularity balance coefficient.
[0009] In a second aspect, embodiments of the present invention provide a computer-readable storage medium comprising a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to execute the pedestrian re-identification method based on camera diversity constraints in the first aspect or any possible implementation thereof.
[0010] Thirdly, embodiments of the present invention provide an electronic device, including: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the device, cause the device to perform the pedestrian re-identification method based on camera diversity constraints in the first aspect or any possible implementation of the first aspect.
[0011] The technical solution provided by this invention includes acquiring pedestrian image datasets from different cameras, performing feature extraction and normalization to obtain normalized feature vectors; defining cosine similarity between samples based on the normalized feature vectors to construct a neighbor set; adding camera diversity conditions to DBSCAN clustering to obtain an improved DBSCAN cluster; obtaining a global cluster agent based on the improved DBSCAN cluster, defining dynamic weights for the cameras to obtain a camera cluster agent, and then dynamically updating each agent; constructing intra-camera loss and cross-camera loss based on the global cluster agent and the camera cluster agent, setting dynamic weights, and then introducing an agent dispersion regularization term to obtain the total loss. This method effectively improves the cross-camera generalization performance and clustering stability of unsupervised pedestrian re-identification. Attached Figure Description
[0012] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 A flowchart illustrating a pedestrian re-identification method based on camera diversity constraints provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0015] It should be understood that the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0016] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” used in the embodiments of this invention are also intended to include the plural forms unless the context clearly indicates otherwise.
[0017] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0018] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0019] Figure 1 A flowchart of a pedestrian re-identification method based on camera diversity constraints provided in an embodiment of the present invention is shown below. Figure 1 As shown, the method includes: Step 1: Obtain pedestrian image datasets from different cameras, perform feature extraction and normalization, and obtain normalized feature vectors.
[0020] In this embodiment of the invention, step 1 includes: make Represents the unlabeled training dataset, where Indicates the input image. This indicates the number of input images, and the camera ID corresponding to each image is represented as: ,in The eigenvector is represented as ,in Represents a network. The parameters are then normalized to obtain the samples. Normalized eigenvectors .
[0021] Step 2: Define the cosine similarity between samples based on the normalized feature vectors and construct a neighbor set; and add camera diversity conditions to DBSCAN clustering to obtain improved DBSCAN clustering.
[0022] In this embodiment of the invention, step 2 includes: Based on the normalized feature vectors, the cosine similarity between samples is defined as follows: ; in, Indicates the first With the Cosine similarity of samples; Indicates sample Normalized feature vectors; construct the neighbor set, its expression is: ; in, Representation and Sample Similarity refers to the set of neighbors that meet the threshold. Indicates camera to The similarity threshold; Subsequently, camera diversity conditions were added to the core point determination of DBSCAN clustering. The core determination conditions are as follows: and ; in, This represents the number of neighbors, i.e., the number of samples that meet the threshold. This represents the minimum number of neighbors threshold for DBSCAN clustering. This represents the set of cameras corresponding to a neighbor; This represents the minimum value for camera diversity.
[0023] Step 3: Based on the improved DBSCAN clustering, obtain the global cluster agent and define the dynamic weights of the cameras to obtain the camera cluster agent. Then, each agent is dynamically updated.
[0024] In this embodiment of the invention, step 3 includes: Based on the improved DBSCAN clustering, a global cluster agent is defined, whose expression is: ; in, This represents the global cluster proxy for the k-th cluster; Represents the set of all samples in the k-th cluster; Define a camera cluster proxy, its expression is: ; in, Indicates in camera The camera cluster proxy for the k-th cluster; Indicates camera The sample set of the k-th cluster; Represents a set The number of samples; The dynamic weights of the camera are represented by the following expression: ; in, , which represents the reliability of camera c; An index representing the influence of the number of samples on the weights; Indicates camera The sample set of the k-th cluster; Represents a set The number of samples; Subsequently, the Exponential Mean Economic Index (EMA) is used to dynamically update the global cluster agent and the camera cluster agent. Its expression is: ; ; in, This represents the EMA attenuation coefficient.
[0025] Step 4: Based on the global cluster agent and the camera cluster agent, construct the intra-camera loss and cross-camera loss, set dynamic weights, and then introduce the agent dispersion regularization term to obtain the total loss.
[0026] In this embodiment of the invention, step 4 includes: Based on the global cluster proxy and the camera cluster proxy, the intra-camera loss and cross-camera loss are calculated, and their expressions are as follows: ; in, Indicates sample Normalized feature vectors; Indicates in camera Lower sample The Individual camera cluster agents, Indicates camera Next Individual camera cluster agents, Indicates temperature parameter; ; in, Indicates sample Belonging to Global cluster proxy for each cluster; Indicates the first Global cluster proxy for each cluster; The dynamic weights are set, and the expressions for the in-camera dynamic weights and cross-camera dynamic weights are as follows: ; ; in, This indicates the current training epoch. and These represent the initial weights within the camera and the initial weights across cameras, respectively. A coefficient representing the rate of decay; Subsequently, a proxy dispersion regular expression is introduced, the expression of which is: ; in, , These respectively represent the camera Next The, the A cluster of cameras acting as a proxy; This represents the cosine similarity between two camera cluster proxies. This means that the high similarity term is amplified by an exponential function to increase the penalty when agents are too close. The total loss is expressed as: ; in, Indicates the total number of samples in the training batch; This represents the dispersion regularity balance coefficient.
[0027] This invention enables a pedestrian re-identification method that introduces camera diversity constraints under unsupervised conditions, achieves cross-camera clustering stability and dynamic adaptive agent updates. By introducing camera diversity judgment conditions in the clustering stage, designing dynamic weights that integrate sample quantity and camera reliability in the agent construction stage, and adopting a joint loss of cross-camera and intra-camera contrastive learning in the optimization stage, the method effectively improves feature distribution consistency and model generalization ability.
[0028] This invention addresses the issues of inconsistent feature distribution across cameras and unstable pseudo-labels by proposing a unified framework that integrates clustering constraints and proxy comparison. First, pedestrian features from multiple cameras are extracted and normalized, and a neighbor set is constructed using cosine similarity. Second, camera diversity conditions are added to DBSCAN clustering to improve cross-camera robustness. Then, global cluster proxies and camera cluster proxies are constructed, and dynamic camera weights are designed based on the number of samples and camera reliability to achieve adaptive proxy updates. EMA mechanism is used to maintain proxy stability, and a dynamic scheduling strategy combining cross-camera and intra-camera contrast loss balances the training process. Finally, a proxy dispersion regularization term is introduced to enhance inter-class discriminability. This invention effectively improves the cross-camera generalization performance and clustering stability of unsupervised pedestrian re-identification, and has broad application value.
[0029] The technical solution provided by this invention includes acquiring pedestrian image datasets from different cameras, performing feature extraction and normalization to obtain normalized feature vectors; defining cosine similarity between samples based on the normalized feature vectors to construct a neighbor set; adding camera diversity conditions to DBSCAN clustering to obtain an improved DBSCAN cluster; obtaining a global cluster agent based on the improved DBSCAN cluster, defining dynamic weights for the cameras to obtain a camera cluster agent, and then dynamically updating each agent; constructing intra-camera loss and cross-camera loss based on the global cluster agent and the camera cluster agent, setting dynamic weights, and then introducing an agent dispersion regularization term to obtain the total loss. This method effectively improves the cross-camera generalization performance and clustering stability of unsupervised pedestrian re-identification.
[0030] The various steps in the embodiments of the present invention can be performed by an electronic device. This electronic device includes, but is not limited to, tablet computers, portable PCs, and desktop computers.
[0031] This invention provides a computer-readable storage medium including a stored program, wherein, when the program is running, it controls the electronic device containing the computer-readable storage medium to execute the above-described embodiment of the pedestrian re-identification method based on camera diversity constraints.
[0032] Figure 2A schematic diagram of an electronic device provided in an embodiment of the present invention, such as... Figure 2 As shown, the electronic device 21 includes a processor 211, a memory 212, and a computer program 213 stored in the memory 212 and executable on the processor 211. When the computer program 213 is executed by the processor 211, it implements the pedestrian re-identification method based on camera diversity constraints in the embodiment. To avoid repetition, it will not be described in detail here.
[0033] Electronic device 21 includes, but is not limited to, processor 211 and memory 212. Those skilled in the art will understand that... Figure 2 This is merely an example of electronic device 21 and does not constitute a limitation on electronic device 21. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device may also include input / output devices, network access devices, buses, etc.
[0034] The processor 211 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0035] The memory 212 can be an internal storage unit of the electronic device 21, such as a hard disk or RAM of the electronic device 21. The memory 212 can also be an external storage device of the electronic device 21, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or FlashCard equipped on the electronic device 21. Furthermore, the memory 212 can include both internal and external storage units of the electronic device 21. The memory 212 is used to store computer programs and other programs and data required by network devices. The memory 212 can also be used to temporarily store data that has been output or will be output.
[0036] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0037] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A pedestrian re-identification method based on camera diversity constraint, characterized in that, The method comprises: Step 1, obtaining pedestrian image data sets from different cameras, performing feature extraction and normalization, and obtaining normalized feature vectors; Step 2, defining the cosine similarity between samples according to the normalized feature vectors, constructing a neighbor set, and adding a camera diversity condition in DBSCAN clustering to obtain an improved DBSCAN clustering; Step 3, obtaining global cluster agents according to the improved DBSCAN clustering, defining camera dynamic weights, obtaining camera cluster agents, and then dynamically updating each agent; Step 4, constructing intra-camera loss and cross-camera loss according to the global cluster agents and the camera cluster agents, setting dynamic weights, then introducing a proxy dispersion regularization term to obtain a total loss.
2. The method of claim 1, wherein, The step 1 comprises: Let denote the unlabeled training dataset, where denote the input image, denote the number of input images, and the camera ID corresponding to each image is denoted as , where , the feature vector is denoted as , where denotes the network, denotes the parameters; then normalization is performed to obtain the sample normalized feature vector .
3. The method of claim 2, wherein, The step 2 comprises: According to the normalized feature vectors, the cosine similarity between samples is defined, and the expression is: ; wherein, denotes the cosine similarity of the sample; denotes the normalized feature vector; a neighborhood set is constructed, which is expressed as: ; wherein, denotes a similarity to the sample i.e. a set of neighbors satisfying a threshold value; denotes a similarity threshold for the camera pair of the camera pair. Then, the camera diversity condition is added in the core point determination of DBSCAN clustering, and the core determination condition is as follows: and ; wherein, represents the number of neighbors, i.e. the number of samples that satisfy the threshold; represents the minimum neighbor number threshold of DBSCAN clustering; represents the camera set corresponding to the neighbor; represents the minimum value of camera diversity.
4. The method of claim 3, wherein, The step 3 comprises: According to the improved DBSCAN clustering, the global cluster agent is defined, and the expression is: ; wherein, represents a global cluster proxy of the kth cluster; represents a set of all samples of the kth cluster; The camera cluster agent is defined, and the expression is: ; wherein, represents the camera under the kth cluster of cameras; represents the camera under the kth cluster of samples; represents the number of samples in the set of samples; represents the camera dynamic weight, which is expressed as: ; wherein, represents the reliability of the camera c; represents an index controlling the sample number influence weight; represents the reliability of the camera the sample set of the kth cluster; represents the sample number of the set of clusters. Then, the exponential moving average index EMA is used to dynamically update the global cluster agent and the camera cluster agent, and the expression is: ; ; wherein, denotes the EMA attenuation coefficient.
5. The method of claim 4, wherein, The step 4 comprises: According to the global cluster agent and the camera cluster agent, the intra-camera loss and the cross-camera loss are calculated, and the expressions are respectively: ; wherein, representing a sample normalized feature vector; representing a camera downsampled the first cluster of the camera representing a camera the first cluster of the camera representing a temperature parameter; ; wherein, representing a sample the global cluster proxy of the cluster; representing a global cluster proxy of the cluster; The dynamic weights are set, and the intra-camera dynamic weight and the cross-camera dynamic weight are expressed respectively: ; ; wherein, denotes the current trained epoch, with denote the initial intra-camera weights and the initial cross-camera weights, respectively, denotes a coefficient that controls the speed of decay; Then, the proxy dispersion regularization term is introduced, and the expression is: ; wherein, , respectively represent the camera first, second, and third camera cluster agent of the first, second, and third cluster, respectively; represents the cosine similarity between two camera cluster agents; represents the amplification of high similarity terms by an exponential function to make the penalty for excessive closeness between agents stronger. The total loss is expressed as: ; wherein, represents the total number of training batch samples; represents a dispersion regular balance coefficient.
6. A computer-readable storage medium, characterized in that, The computer readable storage medium comprises a stored program, wherein when the program runs, the device where the computer readable storage medium is located executes the pedestrian re-identification method based on camera diversity constraint in any one of claims 1-5.
7. An electronic device, comprising: Comprise: One or more processors; Memory; And one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprise instructions, when the instructions are executed by the device, the device executes the pedestrian re-identification method based on camera diversity constraint in any one of claims 1-5.