Unsupervised field adaptive pedestrian re-identification method based on Gaussian feature fusion
By introducing Swin-Transformer and Gaussian feature fusion modules in unsupervised adaptive pedestrian re-identification, and using Gaussian distribution to simulate noise, the problem of feature extraction instability in pedestrian re-identification is solved, and the accuracy and features of pedestrian re-identification are improved. of robustness.
Patent Information
- Application Number
- CN202410445225.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-15
- Publication Date
- 2024-09-06
AI Technical Summary
When existing unsupervised adaptive pedestrian re-identification methods deal with pedestrian images under different postures, viewing angles and lighting conditions, feature extraction is unstable and ignores the uncertainty in the sample data, resulting in performance degradation.
Swin-Transformer and Gaussian feature fusion modules are introduced to enhance the robustness of feature extraction by introducing the uncertainty perturbation of Gaussian distribution in the feature extraction process. The K-means++ network is used to generate pseudo labels, slices and position codes to build an EMA model. , and use Gaussian distribution to simulate noise in the feature space and learn image data uncertainty.
It improves the accuracy of pedestrian re-identification, enhances the robustness and interpretability of feature extraction, and solves the problem of feature instability caused by the feature extraction method ignoring the uncertainty of sample images.
Smart Images

Figure CN118609155A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of pedestrian re-identification, and in particular to an unsupervised domain adaptive pedestrian re-identification based on Gaussian feature combination. Background Art
[0002] Person re-identification technology uses image retrieval technology to retrieve images of specific pedestrians taken by different devices in different environments and at different times. Unlike ordinary pedestrian detection, pedestrian re-identification needs to deal with more complex problems. When a pedestrian appears under different postures, perspectives, lighting conditions, etc., the system still needs to determine that it is the same person. This requires more powerful feature extraction and matching capabilities. Current unsupervised adaptive person re-identification methods usually use RestNet for feature extraction. However, the person re-identification task is a fine-grained and sensitive problem, and the CNN-based method will lose some spatial details, which ultimately affects the performance of the model. In addition, traditional unsupervised person re-identification methods use deterministic feature extraction of sample data, ignoring the uncertainty in the sample data. Summary of the invention
[0003] In view of this, the present invention proposes an unsupervised domain adaptive pedestrian re-identification technology based on Gaussian feature fusion. This technology introduces Swin-Transformer and Gaussian feature fusion modules. By introducing uncertainty perturbations of Gaussian distribution in the feature extraction process, the robustness of feature extraction is enhanced, and the problem that the feature extraction method ignores the uncertainty factors of the sample image and ultimately leads to unstable extracted features is solved.
[0004] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0005] An unsupervised domain adaptive person re-identification based on Gaussian feature combination includes the following steps:
[0006] Step 1: Pedestrian images captured by different devices in different environments at different times are used as inputs to the Swin-Transformer network and the K-means++ network, and the pedestrian image dataset is divided into source domain and target domain according to the amount of label information;
[0007] Step 2: Use the K-means++ network to generate pseudo labels for the unlabeled target domain pedestrian data that conform to the source domain data distribution.
[0008] Step 3: Use YOLOv5 to slice and position-encode the pedestrian images in the source domain, build a Swin-Transformer network to obtain different attention to different pedestrian feature points, and retain the training model parameters;
[0009] Step 4: Use YOLOv5 to slice and position-encode the pedestrian image in the target domain, and use it together with the source domain image as the input of the Swin-Transformer network. This method is used to migrate the Swin-Transformer network from the source domain to the target domain.
[0010] Step 5: Construct a Gaussian feature fusion module. The features of the data set extracted by the Swin-Transformer network are input into the Gaussian feature fusion module to fuse the input image noise, thereby enhancing the reliability and interpretability of the image data features.
[0011] Step 6: Generate image features of the source domain and the target domain from the trained Swin-Transformer network and match them to find the same pedestrian appearing on the target device through the surveillance image of the source device.
[0012] Furthermore, the step 3 specifically includes:
[0013] In the first stage of training of the present invention, each pedestrian image in the source domain data is extracted using YOLOv5 and divided into blocks, that is, the nth image X of the data set is divided into n It is divided into m blocks containing pedestrians, and then each block is encoded to obtain the word embedding representation, recorded as {(x n ) 1 ,(x n ) 2 ,(x n ) 3 ,...,(x n ) m}, use the periodic function (sin) to encode and calculate the position information contained in each pedestrian block. The calculation formula is:
[0014]
[0015] where d model represents the dimension of the mth pedestrian block, and p represents the word embedding representation of the mth pedestrian block, so the input of the Swin-Transformer network can be expressed as:
[0016] (x n ) m =(x n ) m +PE((x n ) m )
[0017] SwinTransformer is a model based on VisionTransformer. It improves VisionTransformer by using sliding windows while maintaining its structure, so that it can better process image data. Compared with VisionTransformer, SwinTransformer uses sliding windows of different sizes and improves computational efficiency through Shifted Windows' Multi-headSelf-Attention technology and more efficient computing methods. This improved method can achieve better performance in classification tasks.
[0018] Furthermore, the step 4 specifically includes:
[0019] In the second training phase of the present invention, the method constructs two models of exactly the same structure, one is the training model, and the other is the EMA model (i.e., weighted moving average model), which is an averaging method that gives higher weights to recent data. The two models have the same initialization conditions. The role of the training model is to obtain the model parameters of the current training batch, while the role of the EMA model is to obtain the mean of the model parameters of the past training batch and the model parameters of the current batch, thereby representing the state of the optimal model.
[0020] Furthermore, the step 5 specifically includes:
[0021] The Gaussian feature fusion module transforms each image x i ∈X in the feature space Z i The feature representation in is defined as Gaussian distribution G, as shown in the following formula:
[0022]
[0023] where μ i and σ i denote the current image mean and variance obtained by jointly learning parameters and image features, respectively, where and θ1 and θ2 represent learnable parameters, x i represents the basic features of sample data extracted by the multi-domain Swin-Transformer. In the feature space of Gaussian distribution, the proposed algorithm converts the image mean μ i As the ideal feature of pedestrian image, the image variance σ i Considered as pedestrian image noise to learn image data uncertainty.
[0024] The Gaussian feature fusion module first samples a random noise ∈ from a normal distribution independent of the model parameters, and then i The feature representation z ini Can be broken down into:
[0025] z i =μ i +∈σ i ,∈~N(0,1)
[0026] Where N(0,1) represents the standard Gaussian normal distribution. The Gaussian feature fusion module used in this method introduces image data uncertainty learning into the unsupervised adaptive person re-identification task, enhancing the reliability and interpretability of image data features. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:
[0028] Figure 1 This is a flow chart of the first stage of training for the present invention;
[0029] Figure 2 The second stage flow chart of training for the present invention;
[0030] Figure 3 It is the structure diagram of Swin-Transformer;
[0031] Figure 4 This is the structure diagram of the Gaussian feature fusion module; DETAILED DESCRIPTION
[0032] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0033] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", and the like may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0034] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood by specific circumstances.
[0035] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0036] This paper proposes an unsupervised domain adaptive person re-identification method based on Gaussian feature fusion. The technology introduces Swin-Transformer and Gaussian feature fusion modules. The training of the model of this method requires two stages. Figure 1 As shown in , in the first stage of training, pedestrian data with a large number of labels taken by multiple different monitoring devices at different time periods are used for model pre-training, and the model parameters obtained by training are retained. Figure 2 As shown in the figure, in the second stage of training, the model parameters of the first stage are imported into the network, and the model is fine-tuned using the same label data as the first stage and unlabeled pedestrian data taken by additional target monitoring equipment. By introducing Gaussian distribution uncertainty disturbance in the feature extraction process, the robustness of feature extraction is enhanced, and the problem that the feature extraction method ignores the uncertainty factors of the sample image and ultimately leads to unstable extracted features is solved, so as to find the same pedestrian appearing in different time periods and different locations on the target source device.
[0037] The present invention provides an unsupervised domain adaptive person re-identification method based on Gaussian feature fusion, comprising the following steps:
[0038] Step 1: Pedestrian images captured by different devices in different environments at different times are used as inputs to the Swin-Transformer network and the K-means++ network, and the pedestrian image dataset is divided into source domain and target domain according to the amount of label information;
[0039] Specifically, we take x groups of surveillance device images as an example, where there are y groups of surveillance device images with complete labels and xy groups of surveillance device images without labels. We regard the surveillance device images with complete labels as source domain data and define them as Contains k samples, where the corresponding data labels are We regard the unlabeled surveillance device images as target domain data. Defined as, contains l samples.
[0040] Step 2: Use the K-means++ network to generate pseudo labels for the unlabeled target domain pedestrian data that conform to the source domain data distribution.
[0041] Specifically, since the target domain data lacks label information, a clustering algorithm is needed to generate labels for the target domain. The K-means++ algorithm is an optimization of the K-means clustering algorithm. The algorithm can select the initial cluster center. The specific steps are as follows:
[0042] (1) Randomly select a sample from the sample as the first cluster center
[0043] (2) Calculate each sample x i The shortest distance to the current cluster center is D(x i ) represents; then calculate the probability of each sample being selected as the next cluster center Select the point with the highest probability as the next cluster center
[0044] (3) Repeat (2) until K cluster centers are selected.
[0045] (4) For each sample x in the data set i , calculate x i The distance to the K cluster centers, and x i Assign to the category corresponding to the cluster center with the smallest distance
[0046] (5) For each category c i , recalculate its cluster center
[0047] (6) Repeat (4) and (5) until the location of the cluster center no longer changes.
[0048] Step 3: In the first stage of training, the pedestrian images in the source domain are sliced and position-encoded using YOLOv5, and a Swin-Transformer network is built to obtain different attention to different pedestrian feature points, and the training model parameters are retained;
[0049] Specifically, each pedestrian image in the source domain data is extracted using YOLOv5 and divided into blocks, that is, the nth image X of the dataset is n It is divided into m blocks containing pedestrians, and then each block is encoded to obtain the word embedding representation, recorded as {(x n ) 1 ,(x n ) 2 ,(x n ) 3 ,...,(x n ) m}, use the periodic function (sin) to encode and calculate the position information contained in each pedestrian block. The calculation formula is:
[0050]
[0051] where d model represents the dimension of the mth pedestrian block, and p represents the word embedding representation of the mth pedestrian block, so the input of the Swin-Transformer network can be expressed as:
[0052] (x n ) m =(x n ) m +PE((x n ) m )
[0053] SwinTransformer is a model based on VisionTransformer, and its structure is shown in the figure Figure 3 As shown in the figure, while maintaining the structure of VisionTransformer, it is improved by sliding windows so that it can better process image data. Compared with VisionTransformer, SwinTransformer uses sliding windows of different sizes and improves computational efficiency through ShiftedWindows' Multi-headSelf-Attention technology and more efficient calculation methods. This improvement can achieve better performance in classification tasks.
[0054] Step 4: In the second stage of training, the pedestrian images in the target domain are sliced and position-encoded using YOLOv5, and used together with the source domain images as the input of the Swin-Transformer network. This method is used to migrate the Swin-Transformer network from the source domain to the target domain.
[0055] In the second training phase of this method, two models with exactly the same structure are constructed, one is the training model and the other is the EMA model (i.e., weighted moving average model), which is an averaging method that gives higher weights to recent data. The two models have the same initialization conditions. The role of the training model is to obtain the model parameters of the current training batch, while the role of the EMA model is to obtain the mean of the model parameters of the past training batches and the model parameters of the current batch, thereby representing the state of the optimal model.
[0056] Step 5: Construct a Gaussian feature fusion module. The features of the data set extracted by the Swin-Transformer network are input into the Gaussian feature fusion module to fuse the input image noise, thereby enhancing the reliability and interpretability of the image data features.
[0057] Specifically:
[0058] Assume that the pedestrian re-identification dataset has a continuous mapping space, denoted as X→Y, where the re-identification label is denoted as y i ∈Y, the pedestrian image is denoted as x i ∈X. Usually, in the process of collecting pedestrian images, due to factors such as low clarity of the monitoring equipment or too far distance from the pedestrian, the pedestrian image is blurred, making it difficult for the model to identify the pedestrian in the image. Therefore, the accuracy of the pedestrian re-identification label is affected by the noise in the input image, which is recorded as noise(x i ). It is assumed that all noises have superimposable properties and the noises corresponding to the input images all satisfy the Gaussian distribution. In order to obtain robust pedestrian image features, the proposed algorithm constructs a learnable parameter model during the image feature extraction process, combines the current parameter module and image features, and uses the Gaussian distribution to simulate and fuse the input image noise. Therefore, it is assumed that the image sample feature space is represented by Z i And each image sample contains the ideal feature representation f(x i ), then in the process of re-identifying pedestrian images using deep learning methods, the feature space of each image can be expressed as:
[0059] Z i =f(x i )+noise(x i )
[0060] Where noise(x i ) represents the uncertainty factor in the sample feature space, and f(·) is the feature extraction function.
[0061] Gaussian feature fusion module such as Figure 4 As shown, each image x i ∈X in the feature space Z i The feature representation in is defined as Gaussian distribution G, as shown in the following formula:
[0062]
[0063] where μ i and σ i denote the current image mean and variance obtained by jointly learning parameters and image features, respectively, where and θ1 and θ2 represent learnable parameters, xi represents the basic features of sample data extracted by the multi-domain Swin-Transformer. In the feature space of Gaussian distribution, the proposed algorithm converts the image mean μ i As the ideal feature of pedestrian image, the image variance σ i Considered as pedestrian image noise to learn image data uncertainty.
[0064] The Gaussian feature fusion module first samples a random noise ∈ from a normal distribution independent of the model parameters, and then i The feature representation z in i Can be broken down into:
[0065] z i =μ i +∈σ i ,∈~N(0,1)
[0066] Where N(0,1) represents the standard Gaussian normal distribution. The Gaussian feature fusion module used in this method introduces image data uncertainty learning into the unsupervised adaptive person re-identification task, enhancing the reliability and interpretability of image data features.
[0067] Step 6: Generate image features of the source domain and the target domain from the trained Swin-Transformer network and match them to find the same pedestrian appearing on the target device through the surveillance image of the source device.
[0068] Specifically, after obtaining the optimal model through the above steps, we can match the image features collected by different devices and measure the similarity between image features through Euclidean distance, so as to find a specific pedestrian in images taken by different devices at different times and complete the pedestrian re-identification task.
[0069] The method proposed in the present invention is preliminarily compared with the CNN-based algorithm in the pedestrian re-identification problem of four data sets. The average accuracy of the algorithm of the present invention is 64.8%, while the average accuracy of the algorithm based on the Swin-Transformer algorithm alone is 63.7%, and the average accuracy of the algorithm based on the CNN algorithm alone is 56.3%. The method of the present invention improves the accuracy of pedestrian re-identification.
[0070] 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 principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An unsupervised multi-domain fusion adaptive person re-identification method, characterized by: The steps include: Step 1: Pedestrian images captured by different devices in different environments and at different times are used as inputs to the Swin-Transformer network and the K-means++ network, and the pedestrian image dataset is divided into source domain and target domain according to the amount of label information; Step 2: Use the K-means++ network to generate pseudo labels for the unlabeled target domain pedestrian data that conform to the source domain data distribution. Step 3: Use YOLOv5 to slice and position-encode the pedestrian images in the source domain, build a Swin-Transformer network to obtain different attention to different pedestrian feature points, and retain the training model parameters; Step 4: Use YOLOv5 to slice and position-encode the pedestrian image in the target domain, and use it together with the source domain image as the input of the Swin-Transformer network. This method is used to migrate the Swin-Transformer network from the source domain to the target domain. Step 5: Construct a Gaussian feature fusion module. The features of the data set extracted by the Swin-Transformer network are input into the Gaussian feature fusion module to fuse the input image noise, thereby enhancing the reliability and interpretability of the image data features. Step 6: Generate image features of the source domain and the target domain from the trained Swin-Transformer network and match them to find the same pedestrian appearing on the target device through the surveillance image of the source device.
2. The unsupervised domain adaptive person re-identification method based on Gaussian feature fusion according to claim 1, characterized in that: The step 3 specifically includes: In the first stage of training, YOLOv5 is used to extract pedestrians from each pedestrian image in the source domain data and divide them into blocks, that is, the nth image in the dataset is divided into m blocks containing pedestrians, and then each block is encoded to obtain the word embedding representation, which is recorded as {(x n ) 1 ,(x n ) 2 ,(x n ) 3 , ..., (x n ) m }, use the periodic function (sin) to encode and calculate the position information contained in each pedestrian block. The calculation formula is: Where represents the dimension of the mth pedestrian block, p represents the word embedding representation of the mth pedestrian block, so the input of the Swin-Transformer network can be expressed as: (x n ) m =(x n ) m +PE((x n ) m ) Swin Transformer is a model based on Vision Transformer. It improves the Vision Transformer structure by using sliding windows, which enables it to better process image data. Compared with Vision Transformer, Swin Transformer uses sliding windows of different sizes and improves computational efficiency through Shifted Windows' Multi-head Self-Attention technology and more efficient calculation methods. This improvement can achieve better performance in classification tasks.
3. The unsupervised domain adaptive person re-identification method based on Gaussian feature fusion according to claim 1, characterized in that: The step 4 specifically includes: In the second stage of training, this method constructs two models with exactly the same structure, one is the training model, and the other is the EMA model (i.e., weighted moving average model), which is an averaging method that gives higher weights to recent data. The two models have the same initialization conditions. The role of the training model is to obtain the model parameters of the current training batch, while the role of the EMA model is to obtain the mean of the model parameters of the past training batches and the model parameters of the current batch, thereby representing the state of the optimal model.
4. The unsupervised domain adaptive person re-identification method based on Gaussian feature fusion according to claim 1, characterized in that: The step 5 specifically includes: The Gaussian feature fusion module defines the feature representation of each image in the feature space as a Gaussian distribution, as shown in the following formula: where μ i and σ i denote the current image mean and variance obtained by jointly learning parameters and image features, respectively, where and θ1 and θ2 represent learnable parameters, x i represents the basic features of sample data extracted by multi-domain Swin-Transfonner. In the feature space of Gaussian distribution, the proposed algorithm converts the image mean μ i As the ideal feature of pedestrian image, the image variance σ i Considered as pedestrian image noise to learn image data uncertainty. The Gaussian feature fusion module first samples a random noise from a normal distribution independent of the model parameters. Then the image feature space Z i The feature representation z in i Can be refined into: Where N(0, 1) represents the standard Gaussian normal distribution. The Gaussian feature fusion module used in this method introduces image data uncertainty learning into the unsupervised adaptive pedestrian re-identification task, enhancing the reliability and interpretability of image data features.
