A multi-branch based vehicle re-identification method and device
By constructing a multi-branch vehicle re-identification network, combining a backbone network, global and local feature extraction modules, and a Transformer fusion module, the problem of insufficient feature representation capability in existing technologies is solved, achieving more efficient and accurate vehicle identification.
Patent Information
- Application Number
- CN202311229537.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-22
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-09-22
AI Technical Summary
Existing vehicle re-identification methods are insufficient in feature representation and robustness, making it difficult to accurately identify and track vehicles.
A multi-branch vehicle re-identification method is adopted, including a backbone network module, a global feature extraction module, a local feature extraction module, and a Transformer fusion module. Rich semantic information is extracted through the RPNet network and the SA permutation attention mechanism, and the feature representation is optimized by combining the joint loss function.
It improves the efficiency and accuracy of vehicle detection, enabling faster vehicle identification, especially through detailed information such as vehicle logos, wheels, and license plates, enhancing the ability to determine vehicle identity.
Smart Images

Figure CN117315597B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision technology, specifically relating to a vehicle re-identification method and device based on multi-branch architecture. Background Technology
[0002] Vehicle re-identification is an important research topic in the fields of computer vision and pattern recognition, aiming to accurately identify and track vehicles using image or video data. With the increasing importance of urban traffic and safety management, research on vehicle re-identification methods has broad application value in areas such as intelligent transportation, public safety, and smart city construction.
[0003] Vehicle re-identification (VRe-Identification) tasks contribute to the construction of intelligent transportation systems and serve as a powerful tool for smart urban management and security. With the emergence of large-scale, high-quality VRe-Identification datasets, related research further meets the application needs of VRe-Identification in various real-world scenarios. Based on different implementation methods, these methods can be broadly divided into two categories: The first category is based on traditional methods, including color histograms, texture features, and shape features. These methods can achieve vehicle re-identification to a certain extent, but are limited by feature representation capabilities and robustness. The second category is based on deep learning methods. The rise of deep learning methods has brought significant breakthroughs to vehicle Re-Identification. Convolutional Neural Networks (CNNs) have achieved great success in image recognition and are widely used in vehicle Re-Identification. Through training and optimization of deep networks, more discriminative feature representations can be learned, improving the accuracy and robustness of identification. Commonly used deep learning models include VGGNet, ResNet, and Inception. Summary of the Invention
[0004] Purpose of the invention: This invention proposes a vehicle re-identification method and device based on multi-branch architecture. By enhancing the expressive power of extracted features, the network can obtain richer semantic information and better identify specific vehicles.
[0005] Technical solution: This invention provides a vehicle re-identification method based on multiple branches, specifically including the following steps:
[0006] (1) The pre-acquired original images of traffic vehicles are preprocessed and divided into query image dataset, training image dataset and test image dataset; and the names, category labels and ID numbers of different cameras are then labeled for each category of images.
[0007] (2) Construct a multi-branch vehicle re-identification network; the multi-branch vehicle re-identification network includes a backbone network module, a Transformer fusion module, a global feature extraction module, and a local feature extraction module; the backbone network module is used to extract vehicle feature information; the global feature extraction module is used to better extract feature information and fuse it to generate an overall global vehicle appearance feature to determine the overall outline of the vehicle; the local feature extraction module pays more attention to the extraction of some local detailed features; the Transformer fusion module is used to fuse and further capture global structural and semantic information in the image to better distinguish the target vehicle;
[0008] (3) Input the training image data information into the multi-branch vehicle re-identification network for training;
[0009] (4) Input the images in the test image dataset into the trained vehicle re-identification network, quickly find the matching image data captured by different camera IDs in the query dataset, and evaluate the performance of the vehicle re-identification network.
[0010] Further, the backbone network module described in step (2) includes the RPNet network and the SA permutation attention mechanism; the RPNet network consists of five stacked convolutional layers; the first layer consists of a 7x7 convolutional layer with a stride of 1, a BatchNormalization layer, a ReLU activation layer, and a 4x4 convolutional layer with a stride of 4; the second layer consists of two 1x1 convolutions with a stride of 1 and a 3x3 P convolution with a stride of 1, stacked three times, each time accompanied by residual connections; the third layer consists of two 1x1 and one P convolution with a stride of 1. A 3x3 P-convolution is stacked four times. During the first execution of the 3x3 P-convolution, the stride is set to 2 to halve the image size; the remaining convolutional layers execute normally. The fourth and fifth layers have the same structure as the third layer, differing only in the number of stacking operations: nine and three stackings respectively. Each layer in the third, fourth, and fifth layers corresponds to a residual structure. An SA permutation attention mechanism is added after the fourth and fifth layers of the RPNet network. This mechanism groups the input by channel, and for each group of sub-features, a Shuffle Unit is used to simultaneously construct channel attention and spatial attention, making the network more focused on extracting useful feature information. The residual structures are dashed residual structures during the first execution, reducing the height and width of the feature matrix to half their original value and adjusting the depth channels to the channels required for the next layer's residual structure.
[0011] Furthermore, the global feature extraction module described in step (2) is implemented as follows:
[0012] First, the feature information in the backbone network is extracted by combining the RPNet network and the SA permutation attention mechanism. After passing through a multi-scale pooling layer, the image mirror texture features are further extracted and the dimensionality is reduced, thus reducing the number of network parameters and compressing the features to simplify the complexity of the network. Second, the SA permutation attention mechanism is added again and global average pooling is performed to aggregate the extracted feature information. Then, a Batch Normalization layer is added, using a joint loss function, which combines the triplet loss of metric learning and the cross-entropy loss function of classification learning. These two different loss functions constrain each other to obtain the optimal vehicle re-identification network parameters.
[0013] Furthermore, the local feature extraction module described in step (2) is implemented as follows:
[0014] First, the third and fourth layers of the backbone network RPNet are subjected to global max pooling after the SA permutation attention mechanism to reduce the number of network parameters. Then, 1x1 convolutions are used for further feature extraction, and a Batch Normalization layer is added. Fully connected layers and ID Loss are used to improve the accuracy of vehicle re-identification. The local detailed features include vehicle logos, wheels, license plates, headlights, and annual inspection stickers.
[0015] Furthermore, the implementation process of the Transformer fusion module in step (2) is as follows:
[0016] The feature images extracted from the backbone network are flattened and then input into the transformer model for processing. The Layer Norm activation function is then applied, and the previously flattened features and the current features are concatted and fused. Finally, global average pooling, Batch Normalization layers, triplet loss, and cross-entropy loss functions are used.
[0017] Furthermore, step (3) includes the following steps:
[0018] (31) Input the allocated training sample data into the multi-branch vehicle re-identification network for training;
[0019] (32) Using the joint loss function triplet loss and cross-entropy loss function, first use the triplet loss function of metric learning to calculate the loss of feature vectors, making similar feature images closer and different feature images further apart. Obtain the score information of each category through the fully connected layer, and then use the cross-entropy loss function to obtain the classification loss. Jointly optimize them to obtain richer vehicle features:
[0020]
[0021] Where n represents the number of data categories, t i p represents the feature point corresponding to each ground truth bounding box. i This indicates the prediction result for the type of feature points;
[0022] L(A,P,N)=max(|f(A)-f(P)|| 2 -|f(A)-f(N)|| 2 +a,0)
[0023] Where A is the anchor sample, P is the positive sample, N is the negative sample, and a is the distance between the positive sample pair and the negative sample pair. a can be dynamically adjusted. The closer the positive and negative samples are, the smaller the distance is; the farther apart they are, the larger the distance is.
[0024] (33) When the target loss value of the training converges, save the network model parameters to obtain a multi-branch vehicle re-identification network model.
[0025] Furthermore, step (4) includes the following implementation process:
[0026] The test image data is input into the trained vehicle re-identification network. Each image in the test dataset and each image in the query dataset are sorted in descending order by calculating the Euclidean distance. The higher the ranking, the closer the photo is to the query image, thus completing the re-identification task.
[0027] The device according to the present invention includes a memory and a processor, wherein:
[0028] Memory is used to store computer programs that can run on a processor;
[0029] A processor is configured to execute the steps of the multi-branch-based vehicle re-identification method as described above when running the computer program.
[0030] Beneficial Effects: Compared with existing technologies, the beneficial effects of this invention are as follows: The multi-branch vehicle re-identification method architecture proposed in this invention has a simple structure. It uses three parts—local, transformer fusion module, and global—to extract feature information. While focusing on extracting overall feature information, it also takes into account local details. Often, local details are more effective in identifying vehicle identity information, such as vehicle logos, wheels, windshields, annual inspection stickers, license plates, headlights, and rearview mirrors. Therefore, it improves the efficiency and accuracy of vehicle detection, enabling vehicles to be retrieved more quickly. Attached Figure Description
[0031] Figure 1 This is a schematic diagram of the overall network structure of the vehicle re-identification method based on multiple branches;
[0032] Figure 2 A schematic diagram of the backbone network module structure;
[0033] Figure 3 This is a schematic diagram of the global module structure;
[0034] Figure 4 This is a schematic diagram of a multi-scale pooling layer structure;
[0035] Figure 5 This is a schematic diagram of a partial module structure;
[0036] Figure 6 This is a schematic diagram of the Transformer fusion module structure. Detailed Implementation
[0037] The present invention will now be described in further detail with reference to the accompanying drawings.
[0038] This invention provides a multi-branch vehicle re-identification method, which constructs a vehicle re-identification network framework, mainly including a backbone network module, a global feature extraction module, and a local feature extraction module. Preprocessed training images are input into the re-identification network model for training. After sufficient training, preprocessed test images are input into the trained model to evaluate the performance of the vehicle re-identification network model. The specific steps include:
[0039] Step 1: Preprocess the pre-acquired raw images of traffic vehicles, which mainly consists of query image data, training image data, and test image data. Then, label the names, category labels, and ID numbers of different cameras for each category of images.
[0040] Step 2: Construct a multi-branch-based vehicle re-identification network, such as... Figure 1 As shown, the system includes a backbone network module, a Transformer fusion module, a global feature extraction module, and a local feature extraction module. The backbone network module extracts vehicle feature information. The global feature extraction module extracts and fuses these features to generate a comprehensive global vehicle appearance feature profile, determining the vehicle's overall outline. The local feature extraction module focuses on extracting detailed local features, such as vehicle logos, wheels, license plates, headlights, and vehicle inspection stickers, which helps in identifying the vehicle's identity. The Transformer fusion module fuses and further captures global structural and semantic information from the image, enabling better identification of the target vehicle.
[0041] like Figure 2As shown, the backbone network module consists of the RPNet network and the SA permutation attention mechanism. The RPNet network is composed of five stacked convolutional layers. The first layer consists of a 7x7 convolutional layer with a stride of 1, a Batch Normalization layer, a ReLU activation layer, and a 4x4 convolutional layer with a stride of 4. The second layer consists of two 1x1 convolutions with a stride of 1 and a 3x3 P convolution with a stride of 1, stacked three times, each time with residual connections. The third layer consists of two 1x1 convolutions and a 3x3 P convolution, stacked four times. In the first execution of the 3x3 P convolution, the stride is set to 2 to halve the image size, while the remaining convolutional layers execute normally. The fourth and fifth layers have the same structure as the third layer, but the number of stacking operations differs, requiring nine and three stacking operations respectively. The multiple stacking operations are for... To enable the model to extract better feature information, deeper network layers enhance information extraction capabilities. Layers three, four, and five each correspond to residual structures, which are initially represented by dashed lines. This is because the first layer of the residual structure adjusts the shape of the input feature matrix, halving its height and width and adjusting the depth channels to suit the needs of the next residual structure layer. SA (Separate Attention) mechanisms are added after layers four and five of the RPNet network. The input is grouped by channel, and for each sub-feature group, a Shuffle Unit is used to simultaneously construct channel attention and spatial attention. By dynamically selecting and continuously aggregating feature information at different spatial scales, the network focuses more on extracting useful feature information. Finally, an attention mask is applied to the positional information of each attention module to suppress potential noise and highlight correct semantic features. Simultaneously, channel shuffling is performed using channel attention and spatial attention to achieve information exchange and integration between different sub-features. This method features low complexity and excellent performance.
[0042] like Figure 3 As shown, the global feature extraction module is implemented as follows: First, the feature information in the backbone network is extracted by combining the RPNet network and the SA permutation attention mechanism. After passing through a multi-scale pooling layer structure, the image mirror texture features are further extracted and the dimensionality is reduced, the network parameters are reduced, and the features are compressed to simplify the complexity of the network. Second, the extracted feature information is then fused with the SA permutation attention mechanism and global max pooling is performed to aggregate the extracted feature information. Then, a Batch Normalization layer is added, using a joint loss function, the triplet loss of metric learning and the cross-entropy loss function of classification learning. These two different loss functions constrain each other, and finally the optimal model parameters are obtained.
[0043] Multi-scale pooling layer structures such as Figure 4 As shown, it is located in the global feature extraction module. The main structure consists of pooling and residual connections at different scales. The specific steps are as follows: the feature information is extracted by the backbone network and sent to the global feature extraction module. At the same time, it is divided into three branches. Two branches are subjected to max pooling operations of sizes 3 and 5, and the last branch is concat fused with the first branch. Finally, the output is sent to the next step. The function of the multi-scale pooling layer is to achieve an adaptive output size and to extract feature texture, reduce the influence of useless information, and make the feature information more focused.
[0044] Local feature extraction module, such as Figure 5 As shown, it focuses more on extracting local details, such as vehicle logos, wheels, license plates, headlights, and vehicle inspection stickers, which help us better identify vehicle identity information. First, the third and fourth layers of the backbone network RPNet are branched after passing the SA permutation attention mechanism, and global average pooling is performed to reduce dimensionality and the number of network parameters. Then, concat is used to fuse feature information, and 1x1 convolutions are used for further feature extraction. A Batch Normalization layer is added to make the feature distribution more compact, the data more standardized, and reduce the variability between samples. Finally, a fully connected layer and ID Loss are used to improve the accuracy of vehicle re-identification.
[0045] Transformer fusion module, such as Figure 6 As shown, the feature images extracted from the backbone network are flattened and transformed into sequential data, which are then input into the transformer model for processing. The Layer Norm activation function is then applied, and the previously flattened features are concatted with the current features. Finally, global average pooling, Batch Normalization layers, triplet loss, and cross-entropy loss functions are used.
[0046] Step 3: Input the allocated training sample data into the multi-branch vehicle re-identification network for training.
[0047] The loss function of the multi-branch re-identification network is calculated. Here, the joint loss function of triplet loss and cross-entropy loss function are used. First, the loss of feature vectors is calculated using the triplet loss function of metric learning, so that the same feature images are closer and different feature images are further apart. The score information of each category is calculated through the fully connected layer. Then, the classification loss is obtained by using the cross-entropy loss function. The two loss functions are jointly optimized to obtain richer vehicle features. The two loss functions can interfere with each other and finally achieve the effect of simultaneous convergence.
[0048]
[0049] Where n represents the number of data categories, t i p represents the feature point corresponding to each ground truth bounding box. i This indicates the prediction result for the type of feature points;
[0050] L(A,P,N)=max(|f(A)-f(P)|| 2 -|f(A)-f(N)|| 2 +a,0)
[0051] Where A is the anchor sample, P is the positive sample, N is the negative sample, and a is the distance between the positive sample pair and the negative sample pair. a can be dynamically adjusted. The closer the positive and negative samples are, the smaller the distance is, and vice versa.
[0052] When the target loss value of the training converges, the network model parameters are saved to obtain a multi-branch vehicle re-identification network model.
[0053] Step 4: Input the segmented test images into the trained re-identification network model and evaluate the model's performance.
[0054] The test image data is input into the trained vehicle re-identification network. Each image in the test dataset and each image in the query dataset are sorted in descending order by calculating the Euclidean distance. The higher the ranking, the closer the photo is to the query image, thus obtaining the experimental results and completing the re-identification task.
[0055] The present invention also provides an apparatus comprising a memory and a processor, wherein: the memory is used to store a computer program capable of running on the processor; and the processor is used to execute the steps of the multi-branch-based vehicle re-identification method as described above when running the computer program.
[0056] The foregoing description illustrates the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claims. The scope of protection of this invention is defined by the appended claims.
Claims
1. A vehicle re-identification method based on multi-branch architecture, characterized in that, Includes the following steps: (1) The pre-acquired original images of traffic vehicles are preprocessed into query image dataset, training image dataset and test image dataset; and the names, category labels and ID numbers of different cameras are then labeled for each category of images. (2) Construct a multi-branch vehicle re-identification network; the multi-branch vehicle re-identification network includes a backbone network module, a Transformer fusion module, a global feature extraction module, and a local feature extraction module; the backbone network module is used to extract vehicle feature information; the global feature extraction module is used to extract feature information and fuse it to generate an overall global vehicle appearance feature to determine the overall outline of the vehicle; the local feature extraction module pays more attention to the extraction of some local detailed features; the Transformer fusion module is used to fuse and further capture the global structure and semantic information in the image; (3) Input the training image data information into the multi-branch vehicle re-identification network for training; (4) Input the images in the test image dataset into the trained vehicle re-identification network, quickly find the matching image data captured by different camera IDs in the query dataset, and evaluate the performance of the vehicle re-identification network. The backbone network module described in step (2) includes the RPNet network and the SA permutation attention mechanism; the RPNet network consists of five stacked convolutional layers; the first layer consists of a 7x7 convolutional layer with a stride of 1, a Batch Normalization layer, a ReLU activation layer and a 4x4 convolutional layer with a stride of 4; The second layer consists of two 1x1 convolutions with a stride of 1 and a 3x3 convolution with a stride of 1, stacked three times, each time with a residual connection. The third layer consists of two 1x1 convolutions and a 3x3 convolution, stacked four times. The stride is set to 2 when the 3x3 convolution is executed for the first time, and the remaining convolutional layers are executed normally. The fourth and fifth layers have the same structure as the third layer, but the number of stacking times is different, requiring nine and three stackings respectively. Each layer in the third, fourth, and fifth layers corresponds to a residual structure. After the fourth and fifth layers of the RPNet network, an SA permutation attention mechanism is added. The input is grouped according to channels, and for each group of sub-features, a Shuffle Unit is used to simultaneously construct channel attention and spatial attention, making the network more focused on extracting useful feature information. The implementation process of the global feature extraction module in step (2) is as follows: First, the output features of the fifth layer in the backbone network are further extracted by multi-scale pooling layers to extract image mirror texture features. Second, SA permutation attention mechanism is added and global average pooling is performed to aggregate the extracted feature information. Then, a Batch Normalization layer is added, and a joint loss function is used, which combines the triplet loss of metric learning and the cross-entropy loss function of classification learning. These two different loss functions constrain each other to obtain the optimal vehicle re-identification network parameters. The implementation process of the local feature extraction module in step (2) is as follows: First, the third and fourth layers of the backbone network RPNet are subjected to global max pooling after passing the SA permutation attention mechanism. Then, 1x1 convolutions are used for further feature extraction, and a Batch Normalization layer is added. Fully connected layers and ID Loss are used to improve the accuracy of vehicle re-identification.
2. The vehicle re-identification method based on multi-branch as described in claim 1, characterized in that, The implementation process of the Transformer fusion module in step (2) is as follows: The feature images extracted from the backbone network are flattened and then input into the transformer model for processing. After passing through the normalization layer, the previously flattened features and the current features are concatted and fused. Finally, global average pooling, batch normalization layer, triplet loss and cross-entropy loss function are used.
3. The vehicle re-identification method based on multi-branch as described in claim 1, characterized in that, Step (3) includes the following steps: (31) Input the allocated training sample data into the multi-branch vehicle re-identification network for training; (32) Using the joint loss function triplet loss and cross-entropy loss function, first calculate the loss of the feature vector using the triplet loss function of metric learning, obtain the score information of each category through the fully connected layer, and then use the cross-entropy loss function to obtain the classification loss: Where n represents the number of data categories, t i p represents the feature point corresponding to each ground truth bounding box. i This indicates the prediction result for the type of feature points; Where A is the anchor sample, P is the positive sample, N is the negative sample, and a is the distance between the positive sample pair and the negative sample pair. a can be dynamically adjusted. The closer the positive and negative samples are, the smaller the distance is; the farther apart they are, the larger the distance is. (33) When the target loss value of the training converges, save the network model parameters to obtain a multi-branch vehicle re-identification network model.
4. The vehicle re-identification method based on multi-branch as described in claim 1, characterized in that, Step (4) includes the following implementation process: The test image data is input into the trained vehicle re-identification network. Each image in the test dataset and each image in the query dataset are sorted in descending order by calculating the Euclidean distance. The higher the ranking, the closer the photo is to the query image, thus completing the re-identification task.
5. The vehicle re-identification method based on multi-branch as described in claim 1, characterized in that, The local details mentioned in step (2) include the vehicle logo, wheels, license plate, lights, and annual inspection sticker.
6. The vehicle re-identification method based on multi-branch as described in claim 1, characterized in that, The residual structures are all dashed residual structures during the first execution, which reduces the height and width of the feature matrix to half of their original values and adjusts the channel depth to the number of channels required for the next layer of residual structures.
7. An electronic device, characterized in that, Includes memory and processor, wherein: Memory is used to store computer programs that can run on a processor; A processor, configured to, while running the computer program, perform the steps of the multi-branch-based vehicle re-identification method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Bearing fault diagnosis method, system and equipment and storage medium
CN116610993A
Expression recognition method based on local features and global features
CN116645716A
