A Person Re-identification Method and System Based on Feature Fusion and Concatenation
By using a feature fusion and splicing method, deep residual networks and multi-head attention mechanisms are employed to extract pedestrian features, thus solving the problem of noise information affecting unsupervised learning. This improves the accuracy of pedestrian re-identification and model performance, while reducing the need for manual annotation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2026-04-03
AI Technical Summary
Existing unsupervised learning methods contain a lot of noisy information during feature extraction in pedestrian re-identification, which affects model performance. Traditional methods require large-scale manual annotation, which is difficult to meet practical needs.
A feature fusion and concatenation-based approach is adopted, which constructs two network models using a deep residual network and a multi-head attention mechanism to extract global and local features respectively. Weighted features are obtained through feature fusion algorithm and cross-union ratio calculation, and the model is trained using the cross-entropy loss function.
It improves the accuracy and performance of pedestrian re-identification, reduces the reliance on manual annotation, and enhances the effectiveness of unsupervised learning.
Smart Images

Figure CN119942637B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to a method and system for pedestrian re-identification based on feature fusion and stitching. Background Technology
[0002] With the rapid development of artificial intelligence, managing and processing massive amounts of video and image data has become a significant challenge. Due to the limitations of manual processing of large-scale data, computer-based person re-identification technology is typically used for identification.
[0003] Pedestrian re-identification systems primarily use convolutional neural networks (CNNs) to retrieve matching images of individuals from a database based on given portraits. Traditional supervised learning methods require large-scale manual annotation, which is impractical. To address this issue, unsupervised learning methods can perform pedestrian re-identification tasks without manual image annotation. Most existing unsupervised training methods typically utilize CNNs or CNNs with attention mechanisms for feature extraction. While this improves model performance to some extent, the extracted features contain noisy information, which can negatively impact the final model performance. Summary of the Invention
[0004] In view of this, the present invention provides a pedestrian re-identification method and system based on feature fusion and stitching, in order to improve the accuracy of re-identification and enhance the performance of the model.
[0005] In a first aspect, the present invention provides a pedestrian re-identification method based on feature fusion and splicing, the method comprising:
[0006] Step 1: Obtain pedestrian images using the collected dataset, and preprocess the pedestrian images to obtain a pedestrian re-identification dataset;
[0007] Step 2: Construct two network models. The first network model is a deep residual network, and the second network model adds a multi-head attention mechanism to the first network model.
[0008] Step 3: Process the pedestrian re-identification dataset through the first and second network models respectively, obtaining the corresponding global and local features. Sort the features by similarity of the feature vectors to obtain four corresponding top k nearest neighbor feature index lists. Then, using a feature fusion algorithm, fuse the two global feature index lists and the two local feature index lists pairwise to obtain the merged global feature index list. and local feature index list ;
[0009] Step 4: Utilize the global feature index list and local feature index list The intersection-union ratio yields the local characteristic coefficients. ; Using the local features obtained from the second network model weighted by feature coefficients, we obtain the weighted local features. Then, the weighted local features are concatenated along the channel dimension to obtain the weighted global features. ;
[0010] Step 5: Weight the global features Input the fully connected layer to obtain the class probabilities. Then, the model is trained using the cross-entropy loss function, and the trained model is used for pedestrian re-identification.
[0011] Optionally, step 1 includes:
[0012] Pedestrian images include different backgrounds and lighting conditions. First, the pedestrian images are converted to the required size. Then, the pedestrian images are enhanced by horizontal flipping, filling, and random cropping to obtain a pedestrian re-identification dataset.
[0013] Optionally, step 2 includes:
[0014] The first network model is a deep residual network, which includes multiple residual blocks. Each residual block contains multiple residual units. Each residual unit includes two 3×3 convolutional layers and the ReLU activation function. Its main structure consists of an input layer, an initial convolutional layer, a max pooling layer, a first residual block, a second residual block, a third residual block, a fourth residual block, a global average pooling layer, a fully connected layer, and an output layer.
[0015] The second network model, based on the first network model, adds a multi-head attention mechanism after each residual block. Specifically, for the input features... Where B is the batch size, C is the number of channels, and H and W are the height and width of the feature map, respectively; given h heads, each head has a corresponding query Q, key K, value V weight matrix; for the input feature The corresponding query Q, key K, and value V weight matrix are obtained through convolution operations; the self-attention of each head is calculated using the following formula: ,in , , Let Q be the query, K be the key, and V be the weight matrix corresponding to the i-th attention head. The dimension of the key is used to scale the dot product and prevent gradient explosion; then the self-attention of all heads is concatenated and merged into the final weight matrix through a linear transformation. The weight matrix is then compared with the input features. Multiplying yields the final weighted feature. .
[0016] Optionally, step 3 includes:
[0017] The pedestrian re-identification dataset is processed by the first network model to obtain global features. and local features Based on the similarity ranking between feature vectors, a list of feature indices representing the top k nearest neighbors is obtained. , The pedestrian re-identification dataset is processed by a second network model to obtain global features. and local features Similarly, the feature index list of the top k nearest neighbors is represented as follows: , ;
[0018] Through feature fusion algorithms, for two global feature index lists and Two local feature index lists and The feature fusion algorithm involves pairwise feature fusion. First, for each feature, the first k indices are extracted from the index list, and values are assigned from the first to the last index, with the first index assigned k and each subsequent index decremented by 1. Second, the two lists are merged based on the assigned indices, and then sorted in descending order. The merging method is as follows: if there are identical indices, the values are added together, and one index is retained; if different indices have the same value, they are sorted according to their index order. Finally, the first k indices of the merged list are extracted to form the final index list. The resulting global feature index list is obtained through the feature fusion algorithm. and local feature index list .
[0019] Optionally, step 4 includes:
[0020] By calculating the global feature index list and local feature index list The crossover and union ratio yields the coefficients of the local features. The formula for the intersection-union ratio is:
[0021] ;
[0022] in and These represent the global feature index list. and local feature index list ;
[0023] Then, the local features obtained by the second network model with feature coefficient weighting are used. Obtain the weighted local features The specific formula is as follows: i=1, 2, 3; then concatenate the weighted local features along the channel dimension. The weighted global features are obtained. .
[0024] Optionally, step 5 includes:
[0025] Weighted global features The original score was obtained by adding a fully connected layer. The specific formula is as follows:
[0026] , where U is the weight matrix of the fully connected layer and b is the bias term;
[0027] Subsequently, the original scores were... Activation is performed using the Softmax activation function to obtain the class probabilities. For class probabilities, the cross-entropy loss function is used to optimize the model. The specific formula is as follows: ,in K represents the true label of the sample, and K is the total number of categories.
[0028] Secondly, the present invention provides a pedestrian re-identification system based on feature fusion and stitching, the system comprising:
[0029] The data acquisition and processing module is used to acquire pedestrian images using the collected dataset, and to preprocess the pedestrian images to obtain a pedestrian re-identification dataset.
[0030] The network construction module is used to construct two network models. The first network model is a deep residual network, and the second network model adds a multi-head attention mechanism to the first network model.
[0031] The feature fusion module processes the person re-identification dataset through the first and second network models, respectively, to obtain the corresponding global and local features. Based on the similarity of the feature vectors, it generates four corresponding top-k nearest neighbor feature index lists. Then, through a feature fusion algorithm, the two global feature index lists and the two local feature index lists are merged pairwise to obtain a combined global feature index list. and local feature index list ;
[0032] The feature concatenation module is used to utilize a global feature index list. and local feature index list The intersection-union ratio yields the local characteristic coefficients. ; Using the local features obtained from the second network model weighted by feature coefficients, we obtain the weighted local features. Then, the weighted local features are concatenated along the channel dimension to obtain the weighted global features. ;
[0033] The data training module is used to train the weighted global features. Input the fully connected layer to obtain the class probabilities. Then, the model is trained using the cross-entropy loss function, and the trained model is used for pedestrian re-identification.
[0034] Thirdly, 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 where the computer-readable storage medium is located to execute the pedestrian re-identification method based on feature fusion and stitching in the first aspect or any possible implementation thereof.
[0035] Fourthly, 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 feature fusion and stitching in the first aspect or any possible implementation of the first aspect.
[0036] The technical solution provided by this invention includes the following steps: First, obtain pedestrian images using a collected dataset and preprocess the images to obtain a pedestrian re-identification dataset. Second, construct two network models: a first network model is a deep residual network, and a second network model adds a multi-head attention mechanism to the first network model. Third, process the pedestrian re-identification dataset through the first and second network models respectively, obtaining corresponding global and local features. Sort these features by similarity to obtain four corresponding top-k nearest neighbor feature index lists. Fourth, use a feature fusion algorithm to fuse the two global feature index lists and the two local feature index lists pairwise to obtain a merged global feature index list and a local feature index list. Finally, utilize the full... The method involves calculating the intersection-union ratio (IUU) of the local feature index list and the local feature index list to obtain local feature coefficients. These coefficients are then used to weight the local features obtained from the second network model, resulting in weighted local features. These weighted local features are then concatenated along the channel dimension to obtain weighted global features. The weighted global features are input into a fully connected layer to obtain class probabilities. The model is then trained using the cross-entropy loss function, and the trained model is used for pedestrian re-identification. This method, by introducing a feature fusion and concatenation algorithm, selects appropriate global and local feature index lists, uses the IUU coefficients to weight local features to obtain weighted global features, and finally uses the global features for model training, thus improving the accuracy of re-identification and enhancing model performance. Attached Figure Description
[0037] 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.
[0038] Figure 1 A flowchart of the pedestrian re-identification method provided in an embodiment of the present invention;
[0039] Figure 2 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0040] 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.
[0041] 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.
[0042] 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.
[0043] 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.
[0044] 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)."
[0045] Figure 1 A flowchart of the pedestrian re-identification method provided in the embodiments of the present invention is shown below. Figure 1 As shown, the method includes:
[0046] Step 1: Use the collected dataset to obtain pedestrian images and preprocess the pedestrian images to obtain a pedestrian re-identification dataset.
[0047] In this embodiment of the invention, step 1 includes:
[0048] Pedestrian images include different backgrounds and lighting conditions. First, the pedestrian images are converted to the required size. Then, the pedestrian images are enhanced by horizontal flipping, filling, and random cropping to obtain a pedestrian re-identification dataset.
[0049] Step 2: Construct two network models. The first network model is a deep residual network, and the second network model adds a multi-head attention mechanism to the first network model.
[0050] In this embodiment of the invention, step 2 includes:
[0051] The first network model is a deep residual network, which includes multiple residual blocks. Each residual block contains multiple residual units. Each residual unit includes two 3×3 convolutional layers and the ReLU activation function. Its main structure consists of an input layer, an initial convolutional layer, a max pooling layer, a first residual block, a second residual block, a third residual block, a fourth residual block, a global average pooling layer, a fully connected layer, and an output layer.
[0052] The second network model, based on the first network model, adds a multi-head attention mechanism after each residual block. Specifically, for the input features... Where B is the batch size, C is the number of channels, and H and W are the height and width of the feature map, respectively; given h heads, each head has a corresponding query Q, key K, value V weight matrix; for the input feature The corresponding query Q, key K, and value V weight matrix are obtained through convolution operations; the self-attention of each head is calculated using the following formula: ,in , , Let Q be the query, K be the key, and V be the weight matrix corresponding to the i-th attention head. The dimension of the key is used to scale the dot product and prevent gradient explosion; then the self-attention of all heads is concatenated and merged into the final weight matrix through a linear transformation. The weight matrix is then compared with the input features. Multiplying yields the final weighted feature. .
[0053] Step 3: Process the pedestrian re-identification dataset through the first and second network models respectively, obtaining the corresponding global and local features. Sort the features by similarity of the feature vectors to obtain four corresponding top k nearest neighbor feature index lists. Then, using a feature fusion algorithm, fuse the two global feature index lists and the two local feature index lists pairwise to obtain the merged global feature index list. and local feature index list .
[0054] In this embodiment of the invention, step 3 includes:
[0055] The pedestrian re-identification dataset is processed by the first network model to obtain global features. and local features Based on the similarity ranking between feature vectors, a list of feature indices representing the top k nearest neighbors is obtained. , The pedestrian re-identification dataset is processed by a second network model to obtain global features. and local features Similarly, the feature index list of the top k nearest neighbors is represented as follows: , ;
[0056] Through feature fusion algorithms, for two global feature index lists and Two local feature index lists and The feature fusion algorithm involves pairwise feature fusion. First, for each feature, the first k indices are extracted from the index list, and values are assigned from the first to the last index, with the first index assigned k and each subsequent index decremented by 1. Second, the two lists are merged based on the assigned indices, and then sorted in descending order. The merging method is as follows: if there are identical indices, the values are added together, and one index is retained; if different indices have the same value, they are sorted according to their index order. Finally, the first k indices of the merged list are extracted to form the final index list. The resulting global feature index list is obtained through the feature fusion algorithm. and local feature index list .
[0057] Step 4: Utilize the global feature index list and local feature index list The intersection-union ratio yields the local characteristic coefficients. ; Using the local features obtained from the second network model weighted by feature coefficients, we obtain the weighted local features. Then, the weighted local features are concatenated along the channel dimension to obtain the weighted global features. .
[0058] In this embodiment of the invention, step 4 includes:
[0059] By calculating the global feature index list and local feature index list The crossover and union ratio yields the coefficients of the local features. The formula for the intersection-union ratio is:
[0060] ;
[0061] in and These represent the global feature index list. and local feature index list ;
[0062] Then, the local features obtained by the second network model with feature coefficient weighting are used. Obtain the weighted local features The specific formula is as follows: i=1, 2, 3; then concatenate the weighted local features along the channel dimension. The weighted global features are obtained. .
[0063] Step 5: Weight the global features Input the fully connected layer to obtain the class probabilities. Then, the model is trained using the cross-entropy loss function, and the trained model is used for pedestrian re-identification.
[0064] In this embodiment of the invention, step 5 includes:
[0065] Weighted global features The original score was obtained by adding a fully connected layer. The specific formula is as follows:
[0066] , where U is the weight matrix of the fully connected layer and b is the bias term;
[0067] Subsequently, the original scores were... Activation is performed using the Softmax activation function to obtain the class probabilities. For class probabilities, the cross-entropy loss function is used to optimize the model. The specific formula is as follows: ,in K represents the true label of the sample, and K is the total number of categories.
[0068] This invention provides a pedestrian re-identification system based on feature fusion and stitching, the system comprising:
[0069] The system comprises a data acquisition and processing module 1, a network construction module 2, a feature fusion module 3, a feature splicing module 4, and a data training module 5. The data acquisition and processing module 1 is connected to the network construction module 2, the network construction module 2 is connected to the feature fusion module 3, the feature fusion module 3 is connected to the feature splicing module 4, and the feature splicing module 4 is connected to the data training module 5.
[0070] The data acquisition and processing module 1 is used to acquire pedestrian images from the collected dataset and preprocess the pedestrian images to obtain a pedestrian re-identification dataset. The network construction module 2 is used to construct two network models: the first network model is a deep residual network, and the second network model adds a multi-head attention mechanism to the first network model. The feature fusion module 3 is used to process the pedestrian re-identification dataset through the first network model and the second network model respectively, obtaining the corresponding global and local features. Based on the similarity of the feature vectors, four corresponding top k nearest neighbor feature index lists are obtained. Through the feature fusion algorithm, the two global feature index lists and the two local feature index lists are fused pairwise to obtain a merged global feature index list. and local feature index list Feature concatenation module 4 is used to utilize the global feature index list. and local feature index list The intersection-union ratio yields the local characteristic coefficients. ; Using the local features obtained from the second network model weighted by feature coefficients, we obtain the weighted local features. Then, the weighted local features are concatenated along the channel dimension to obtain the weighted global features. Data training module 5 is used to train the weighted global features. Input the fully connected layer to obtain the class probabilities. Then, the model is trained using the cross-entropy loss function, and the trained model is used for pedestrian re-identification.
[0071] The cross-entropy loss function is used to measure the difference between the predicted probability distribution and the true label, thereby continuously improving model performance.
[0072] Traditional pedestrian re-identification systems often fail to distinguish between the quality of features obtained with and without attention, or rely solely on attention-added features for training, ignoring the varying importance of different image regions. This invention introduces a feature fusion and stitching algorithm. It selects appropriate global and local feature index lists, uses the coefficient obtained from their intersection-union ratio (IUU) to weight local features, and finally uses these global features for model training, continuously improving accuracy.
[0073] The technical solution provided by this invention includes the following steps: First, obtain pedestrian images using a collected dataset and preprocess the images to obtain a pedestrian re-identification dataset. Second, construct two network models: a first network model is a deep residual network, and a second network model adds a multi-head attention mechanism to the first network model. Third, process the pedestrian re-identification dataset through the first and second network models respectively, obtaining corresponding global and local features. Sort these features by similarity to obtain four corresponding top-k nearest neighbor feature index lists. Fourth, use a feature fusion algorithm to fuse the two global feature index lists and the two local feature index lists pairwise to obtain a merged global feature index list and a local feature index list. Finally, utilize the full... The method involves calculating the intersection-union ratio (IUU) of the local feature index list and the local feature index list to obtain local feature coefficients. These coefficients are then used to weight the local features obtained from the second network model, resulting in weighted local features. These weighted local features are then concatenated along the channel dimension to obtain weighted global features. The weighted global features are input into a fully connected layer to obtain class probabilities. The model is then trained using the cross-entropy loss function, and the trained model is used for pedestrian re-identification. This method, by introducing a feature fusion and concatenation algorithm, selects appropriate global and local feature index lists, uses the IUU coefficients to weight local features to obtain weighted global features, and finally uses the global features for model training, thus improving the accuracy of re-identification and enhancing model performance.
[0074] The various steps in the embodiments of the present invention can be performed by electronic devices. These electronic devices include, but are not limited to, mobile phones, tablet computers, portable PCs, and desktop computers.
[0075] 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 feature fusion and stitching.
[0076] Figure 2 A 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 feature fusion and stitching in the embodiment. To avoid repetition, it will not be described in detail here.
[0077] Electronic device 21 includes, but is not limited to, processor 211 and memory 212. Those skilled in the art will understand that... Figure 2This 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.
[0078] 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.
[0079] 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.
[0080] 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.
[0081] 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 feature fusion and splicing, characterized in that, The method includes: Step 1: Obtain pedestrian images using the collected dataset, and preprocess the pedestrian images to obtain a pedestrian re-identification dataset; Step 2: Construct two network models. The first network model is a deep residual network, and the second network model adds a multi-head attention mechanism to the first network model. Step 3: Process the pedestrian re-identification dataset through the first and second network models respectively, obtaining the corresponding global and local features. Sort the features by similarity of the feature vectors to obtain four corresponding top k nearest neighbor feature index lists. Then, using a feature fusion algorithm, fuse the two global feature index lists and the two local feature index lists pairwise to obtain the merged global feature index list. and local feature index list ; Step 4: Utilize the global feature index list and local feature index list The intersection-union ratio yields the local characteristic coefficients. ; Using the local features obtained from the second network model weighted by feature coefficients, we obtain the weighted local features. Then, the weighted local features are concatenated along the channel dimension to obtain the weighted global features. ; Step 5: Weight the global features Input the fully connected layer to obtain the class probabilities. Then, the model is trained using the cross-entropy loss function, and pedestrian re-identification is performed using the trained model. Step 2 includes: The first network model is a deep residual network, which includes multiple residual blocks. Each residual block contains multiple residual units. Each residual unit includes two 3×3 convolutional layers and the ReLU activation function. Its main structure consists of an input layer, an initial convolutional layer, a max pooling layer, a first residual block, a second residual block, a third residual block, a fourth residual block, a global average pooling layer, a fully connected layer, and an output layer. The second network model, based on the first network model, adds a multi-head attention mechanism after each residual block; specifically: for input features Where B is the batch size, C is the number of channels, and H and W are the height and width of the feature map, respectively; given h heads, each head has a corresponding query Q, key K, value V weight matrix; for the input feature The corresponding query Q, key K, and value V weight matrix are obtained through convolution operations; the self-attention of each head is calculated using the following formula: ,in , , Let Q be the query, K be the key, and V be the weight matrix corresponding to the i-th attention head. The dimension of the key is used to scale the dot product and prevent gradient explosion; then the self-attention of all heads is concatenated and merged into the final weight matrix through a linear transformation. The weight matrix is then compared with the input features. Multiplying yields the final weighted feature. .
2. The method according to claim 1, characterized in that, Step 1 includes: Pedestrian images include different backgrounds and lighting conditions. First, the pedestrian images are converted to the required size. Then, the pedestrian images are enhanced by horizontal flipping, filling, and random cropping to obtain a pedestrian re-identification dataset.
3. The method according to claim 1, characterized in that, Step 3 includes: The pedestrian re-identification dataset is processed by the first network model to obtain global features. and local features Based on the similarity ranking between feature vectors, a list of feature indices representing the top k nearest neighbors is obtained. , The pedestrian re-identification dataset is processed by a second network model to obtain global features. and local features Similarly, the feature index list of the top k nearest neighbors is represented as follows: , ; Through feature fusion algorithms, for two global feature index lists and Two local feature index lists and The feature fusion algorithm involves pairwise feature fusion. First, for each feature, the first k indices are extracted from the index list, and values are assigned from the first to the last index, with the first index assigned k and each subsequent index decremented by 1. Second, the two lists are merged based on the assigned indices, and then sorted in descending order. The merging method is as follows: if there are identical indices, the values are added together, and one index is retained; if different indices have the same value, they are sorted according to their index order. Finally, the first k indices of the merged list are extracted to form the final index list. The resulting global feature index list is obtained through the feature fusion algorithm. and local feature index list .
4. The method according to claim 1, characterized in that, Step 4 includes: By calculating the global feature index list and local feature index list The crossover and union ratio yields the coefficients of the local features. The formula for the intersection-union ratio is: ; in and These represent the global feature index list. and local feature index list ; Then, the local features obtained by the second network model with feature coefficient weighting are used. Obtain the weighted local features The specific formula is as follows: i=1, 2, 3; then concatenate the weighted local features along the channel dimension. The weighted global features are obtained. .
5. The method according to claim 1, characterized in that, Step 5 includes: Weighted global features The original score was obtained by adding a fully connected layer. The specific formula is as follows: , where U is the weight matrix of the fully connected layer and b is the bias term; Subsequently, the original scores were... Activation is performed using the Softmax activation function to obtain the class probabilities. For class probabilities, the cross-entropy loss function is used to optimize the model. The specific formula is as follows: ,in K represents the true label of the sample, and K is the total number of categories.
6. A pedestrian re-identification system based on feature fusion and stitching, characterized in that, The system is used to implement the pedestrian re-identification method based on feature fusion and stitching as described in claim 1, and the system includes: The data acquisition and processing module is used to acquire pedestrian images using the collected dataset, and to preprocess the pedestrian images to obtain a pedestrian re-identification dataset. The network construction module is used to construct two network models. The first network model is a deep residual network, and the second network model adds a multi-head attention mechanism to the first network model. The feature fusion module processes the person re-identification dataset through the first and second network models, respectively, to obtain the corresponding global and local features. Based on the similarity of the feature vectors, it generates four corresponding top-k nearest neighbor feature index lists. Then, through a feature fusion algorithm, the two global feature index lists and the two local feature index lists are merged pairwise to obtain a combined global feature index list. and local feature index list ; The feature concatenation module is used to utilize a global feature index list. and local feature index list The intersection-union ratio yields the local characteristic coefficients. ; Using the local features obtained from the second network model weighted by feature coefficients, we obtain the weighted local features. Then, the weighted local features are concatenated along the channel dimension to obtain the weighted global features. ; The data training module is used to train the weighted global features. Input the fully connected layer to obtain the class probabilities. Then, the model is trained using the cross-entropy loss function, and the trained model is used for pedestrian re-identification.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the pedestrian re-identification method based on feature fusion and stitching as described in any one of claims 1 to 5.
8. An electronic device, characterized in that, include: 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 including instructions that, when executed by the device, cause the device to perform the pedestrian re-identification method based on feature fusion and stitching as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Video pedestrian re-identification method based on prior knowledge
CN115050050A
Object image re-identification method based on multi-feature information capture and correlation analysis
WO2023273290A1