A Vehicle Re-identification Method Based on Dynamic Convolutional Transformer
By constructing a local region-shared convolutional kernel pool for a dynamic convolutional Transformer and adaptively learning convolutional kernel combination coefficients through a fully connected neural subnetwork, the problem of insufficient local feature learning in vehicle re-identification by the visual Transformer is solved, thus improving the accuracy of vehicle re-identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2026-03-06
AI Technical Summary
The visual Transformer has insufficient local feature learning ability in vehicle re-identification tasks, which limits the accuracy of vehicle re-identification.
Dynamic convolution is used to enhance the local feature learning ability of Transformer. By constructing a convolution kernel pool shared by each local region, fully connected neural subnetworks are used to adaptively learn the convolution kernel combination coefficients, and convolution kernels are linearly fused to form convolution kernels dedicated to local regions.
It improves the accuracy of vehicle re-identification and enhances the learning effect of local features.
Smart Images

Figure CN115995065B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to a vehicle re-identification method based on dynamic convolutional Transformer. Background Technology
[0002] Vehicle re-identification aims to use an image of a suspect vehicle as a query to find matching vehicle images from a massive dataset of vehicle images, thereby determining the suspect vehicle's spatiotemporal trajectory. This is of great significance for intelligent video analysis systems in smart cities, smart transportation, and smart security. The Visual Transformer is a popular deep learning model that has achieved excellent results in many tasks such as image object detection, classification, segmentation, and recognition in recent years. The Visual Transformer's success is mainly due to its attention learning mechanism, which captures correlations between long-distance regions and possesses strong global feature learning capabilities. However, for visual tasks like vehicle re-identification, which require more refined local features to identify highly similar vehicles, the Visual Transformer's accuracy is limited because different local regions share convolutional kernels, resulting in insufficient local feature learning capabilities. Summary of the Invention
[0003] This invention proposes a vehicle re-identification method based on dynamic convolutional Transformer, which utilizes dynamic convolution to enhance the local feature learning ability of Transformer and improve the accuracy of vehicle re-identification. Figure 1 As shown, the steps of the present invention include: (1) constructing a convolutional kernel pool shared by each local region, (2) learning the convolutional kernel pool combination coefficients, and (3) linearly fusing the convolutional kernels to form convolutional kernels dedicated to each local region.
[0004] Step 1: The process of constructing the convolutional kernel pool shared by each local region is as follows:
[0005] Where W is the convolutional kernel pool shared by the local region, W j Let c be the j-th convolutional kernel of W; i ,c o ,k represents the receptive field size of the input channel, output channel, and convolution kernel, respectively; N represents the number of convolution kernels.
[0006] Step 2: The learning process of the convolution kernel pooling combination coefficients is shown in formula (1):
[0007]
[0008] Where, x mIt is the feature data corresponding to the m-th local region, and M is the local region data; flatten is to flatten x m The flattening function is the function that unfolds into column vectors; ANN is a fully connected artificial neural network, and θ is a learnable parameter of the ANN; α m The m-th local region corresponds to the convolutional kernel pooling combination coefficient vector.
[0009] Step 3: The linear fusion method of convolution kernels is shown in Equation (2):
[0010]
[0011] Among them, Ω m The m-th local region-specific convolutional kernel; α m,j It is vector α m The j-th coefficient in.
[0012] In practice, any data that can be divided into several local regions in spatial dimension, including the vehicle image itself and the feature maps output by any intermediate layer of Transformer, can be processed using the above dynamic convolution method. Therefore, the dynamic convolution process can be flexibly embedded into Transformer to improve the local feature learning effect of Transformer.
[0013] By using the present invention, each local region can adaptively learn the corresponding convolution kernel combination coefficients based on its own representation characteristics using a fully connected neural subnetwork. By learning convolution kernels specific to each local region, it is possible to better learn the local features of vehicle images, which is beneficial to improving vehicle re-identification performance.
[0014] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other objects, features and advantages of the present invention more obvious and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of the dynamic convolution processing procedure of the present invention.
[0016] Figure 2 This is a schematic diagram of vehicle re-identification based on dynamic convolutional Transformer provided in an embodiment of the present invention. Detailed Implementation
[0017] To facilitate understanding by peers, this invention provides a specific vehicle re-identification implementation example, including the following stages:
[0018] Step 1) Training Phase:
[0019] like Figure 1 As shown, a deep learning network based on dynamic convolutional Transformer is constructed, and vehicle images are used as the dataset to train the network, resulting in a vehicle re-identification model based on dynamic convolutional Transformer.
[0020] Specifically, firstly, the dynamic convolution module of the present invention is embedded into the feature mapping module of Transformer to calculate the convolution kernel corresponding to each local block, which is used for convolution feature learning of each image block.
[0021] Secondly, the dynamic convolution module of this invention is embedded after the layer normalization following the attention mechanism module of the Transformer encoder to enhance the feature learning effect of the attention mechanism. Optionally, in this embodiment, the dynamic convolution processing can be flexibly embedded at the location of all feature maps in all processing spaces of the Transformer that are separable.
[0022] Next, the dynamically convolutional embedded Transformer network is iteratively trained and optimized by setting a training loss function to obtain a vehicle re-identification model based on the dynamically convolutional Transformer. The training loss function includes a triplet loss function and a cross-entropy loss function. The triplet loss function is specifically shown in formula (3):
[0023] L TRI =max(C+d(a,p)-d(a,n),0) (3)
[0024] Where a is the anchor sample, p is the positive sample, and n is the negative sample, with p having the same identity as a and n having a different identity; d(a,p) is the Euclidean distance between a and p, and d(a,n) is the Euclidean distance between a and n; C≥0 is the margin parameter; here, a, p, and n do not refer to the original image, but rather to the feature representation extracted from the original image using the deep learning network based on dynamic convolution Transformer (i.e., Figure 2 (Output data of the middle batch normalization layer).
[0025] The specific cross-entropy loss function is shown in Equation (4):
[0026]
[0027] Where T represents the number of samples; C represents the number of categories; l(y) i c) is an indicator function; if the class y of the i-th sample is... i If it equals c, then l(y) i c) = 1, otherwise l(y) i c)=0,p icLet be the posterior probability that the i-th sample belongs to class c. Figure 2 As shown, in order to better balance the two losses, the triplet loss function is placed before the batch normalization layer of the Transformer network, and the cross-entropy loss function is placed after the batch normalization layer of the Transformer network.
[0028] Step 2) Testing Phase:
[0029] The vehicle query image q and the vehicle registration image set G are input into the aforementioned deep learning network model based on dynamic convolutional Transformer for feature extraction. Based on the extracted features, the vehicle query image feature f is calculated. q Vehicle registration image features f G The Euclidean distance between the images is calculated and sorted, and the closest vehicle registration image is selected as the re-identification result of the vehicle query image. Here, the feature refers to the image obtained through... Figure 2 The output data of the batch normalization layer after the model shown. Although specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the invention should be covered within the scope of protection of the claims of the present invention.
Claims
1.A vehicle re-identification method based on dynamic convolution Transformer, characterized in that, The dynamic convolution is used to enhance the local feature learning ability of the Transformer, and the steps include: constructing a convolution kernel pool shared by each local region, learning a convolution kernel pool combination coefficient, and linearly fusing the convolution kernels to form a convolution kernel dedicated to each local region. The method for constructing the convolution kernel pool shared by each local region is as follows: wherein, is a local region shared convolution kernel pool, is the jth group of convolution kernels of ; respectively represent the input channel, output channel and the receptive field size of the convolution kernel; represents the number of convolution kernels; The learning method of the convolution kernel pool combination coefficient is shown in formula (1): (1); wherein, is the feature data corresponding to the th local region, denotes the number of local regions; flatten is a flattening function that flattens a tensor into a column vector; ANN is a fully connected artificial neural subnetwork, is a learnable parameter of ANN; denotes the convolution kernel pool combination coefficient vector corresponding to the th local region. The linear fusion method of the convolution kernel is shown in formula (2): (2); wherein, represents the jth coefficient in the vector is a local region-specific convolution kernel; is a local region-specific convolution kernel; is a local region-specific convolution kernel; the dynamic convolution processing process is embedded in the position of the feature mapping of all processing space dimensions of the Transformer, and each local region-specific convolution kernel output by the dynamic convolution module is used for feature learning of each local region.
Citation Information
Patent Citations
Remote sensing image fusion method and system based on multi-scale dynamic convolutional neural network
CN111080567A
Image description generation method, system and device and storage medium
CN111368118A