Vehicle feature re-identification method based on double attention mechanism

By introducing a dual attention mechanism in vehicle feature re-identification technology, combining self-attention and cross-region attention modules, vehicle image feature learning is optimized, and the problem of identification difficulties in low-resolution and high-noise environments is solved, and higher recognition accuracy and robustness are achieved.

CN119888639APending Publication Date: 2025-04-25ANHUI ZHIZHI ENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411916242.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

Existing vehicle feature re-identification technology is difficult to identify in low-resolution and high-noise environments, and it is difficult to overcome interference from factors such as background, lighting and occlusion, resulting in a reduced recognition accuracy.

Method used

The vehicle feature re-identification method based on the dual attention mechanism is adopted, and the global feature learning branch and local feature learning branch are combined with the self-attention module and the cross-region attention module to optimize the feature learning and fusion of vehicle images, enhance image clarity and reduce noise impact.

Benefits of technology

In a real deployment environment, the accuracy and efficiency of vehicle recognition are improved, the accuracy of vehicle re-identification is enhanced, the interference of factors such as background, lighting and occlusion is overcome, and the accuracy and robustness of feature representation is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119888639A_ABST
    Figure CN119888639A_ABST
Patent Text Reader

Abstract

The invention discloses a vehicle feature re-identification method based on a double attention mechanism. The method comprises the following steps: respectively sending an input vehicle image to two branches for feature learning; wherein the first branch is a global feature learning branch and comprises a continuous self-attention module, the continuous self-attention module is adopted to selectively enhance identification pixels on the whole image, and vehicle alignment and global context feature learning are achieved; the second branch is a local feature learning branch which automatically positions two protruding vehicle parts, namely a vehicle head and a windshield through an anchor point detector and learns features of the vehicle head and the windshield; and fusing the two branch learning features to obtain a final vehicle feature. A vehicle image is subjected to edge reasoning processing and optimization to enhance image definition, and then the image is sent to two branches for feature learning. The method has the advantages that the recognition problem caused by low resolution and high noise in a real deployment environment is optimized, interference of factors such as background, illumination and shielding is overcome, and the accuracy of feature recognition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing and recognition, and in particular to a vehicle feature re-recognition method based on a dual attention mechanism. Background Art

[0002] As an important part of smart city infrastructure, intelligent transportation plays an indispensable role in promoting my country's economic development, urban construction and improving social living standards. With the rapid development of urbanization, although the living standards of residents have improved, urban traffic problems are becoming increasingly serious. Especially in old urban areas, traffic congestion and complex road networks make it difficult for traffic police to accurately locate problems, which seriously affects the efficiency of traffic flow. Therefore, building an intelligent transportation system and optimizing traffic management and control through artificial intelligence technology has become the key to solving urban traffic problems.

[0003] However, existing vehicle feature re-identification technologies face multiple challenges. First, real-time vehicle recognition based on video streams has difficulties in edge processing and coping with low resolution and high noise environments. Second, due to the complexity of traffic scenes, such as lighting changes, occlusions, and different viewing angles, it is difficult to maintain high-precision recognition performance. In addition, due to the large number of vehicle IDs and complex intra-class / inter-class variations between vehicles, directly calculating the ID label for each image will reduce the recognition accuracy of the system. Although the model based on deep convolutional neural network (DCNN) is sensitive to texture features, it lacks the spatial perception ability of different local parts of the vehicle, resulting in errors in vehicle recognition at different scales and viewpoints. These technical defects limit the effectiveness of intelligent transportation systems and need to be overcome through further technological innovation and optimization. Summary of the invention

[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a vehicle feature re-identification method based on a dual attention mechanism, aiming to optimize the recognition problems caused by low resolution and high noise in a real deployment environment, while overcoming the interference of factors such as background, lighting and occlusion.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is: a vehicle feature re-identification method based on a dual attention mechanism, comprising sending an input vehicle image to two branches for feature learning respectively; wherein the first branch is a global feature learning branch, which includes a continuous self-attention module, and the continuous self-attention module is used to selectively enhance the identification pixels on the entire image to achieve vehicle alignment and global context feature learning;

[0006] The second branch is the local feature learning branch, which automatically locates two prominent vehicle parts: the front and the windshield through the anchor detector, and learns the features of the front and the windshield;

[0007] The features learned from the two branches are fused to obtain the final vehicle features.

[0008] The vehicle image is first processed and optimized by edge inference to enhance the image clarity, and then the image is sent to two branches for feature learning.

[0009] Edge inference processing and optimization include three steps of blurring, fuzzy reasoning and deblurring to obtain the final image with enhanced clarity; the blurring adopts the omnidirectional wavelet model to blur the image; the fuzzy reasoning adopts the Mamdani reasoning method to perform fuzzy reasoning; the deblurring adopts the centroid method to process the image and output the image with enhanced clarity.

[0010] In global feature learning, the image processed by edge fuzzy inference is first processed by the convolution layer and the pooling layer, and then sent to the self-attention module for processing, and then passes through the convolution layer and the pooling layer to output the global feature LG.

[0011] In the local feature learning part, a continuous self-attention module DetecNet is used to selectively enhance the discriminative pixels on the entire image, and the front and window areas are learned through the anchor detector ROI; then the front area features are learned through the self-attention module, and the interactive pixel position perception features of the window position are captured through the cross-region attention module.

[0012] In the global feature learning part, the self-attention module is used for vehicle alignment and global feature learning, the convolution filter is used to obtain the local perception feature map, the self-attention module is used to refine the pixel-level area, and the local features and their global dependencies are adaptively integrated; given a local feature X represented as a shape tensor (C, H, W), where C represents the number of channels of X, H and W are the height and width of X respectively, first compress it into a matrix Formulate the input feature matrix like a transformer, and then apply the self-attention mechanism introduced by the transformer to capture the dependencies of long-range visual features through the following steps:

[0013] Two new feature maps Composed of two learnable linear transformations W q , Generate, using X k and X q The transpose of X is used for matrix multiplication to calculate the preliminary interactions between different pixels in X, and then the softmax operator is used to obtain the attention map

[0014] in Among them, X vec , X k and X qThe dimension is N = H × W, For X q The i-th column vector, M ji represents the correlation between the i-th and j-th pixels;

[0015] Then, the feature X vec Put it into another learned linear operation to generate a new feature map Using the correlation matrix M and X v , reshape the output into The calculation method is:

[0016]

[0017] in, and is the learned weight matrix. A j is the jth vector output by the self-attention layer;

[0018] The self-attention layer is inserted into the convolution operation to build a stacked self-attention module to capture different types of attention and long-term dependencies. At the same time, the residual learning structure is adopted to avoid feature redundancy and add input feature maps to avoid degradation and feature redundancy. The residual attention unit is as follows:

[0019] y i =αA i +x i (3)

[0020] Among them, α is a learnable scalar, with 0 as its initial value, and gradually learns to assign more weights, y i is the final feature, i represents the position index of the feature map, and finally the self-attention module is superimposed;

[0021] The entire vehicle image is placed in the self-attention module to learn the long-range dependency-aware feature map and solve the misalignment problem. The triple loss is used to supervise the global feature learning and enhance the distinction between similar vehicles in the model, which is denoted as:

[0022]

[0023] Where N is the number of training samples, is the normalization factor, The maximum value of the hinge loss {X, 0}, measuring the distance between sample pairs (x i ,x j ) is calculated by d(i,j), is considered as a positive set consisting of vehicle images with the same identity as the probe, Viewed as a negative set constructed from images with different identities from the probe, the triplet loss will enforce the global feature learning of the distance margin M between vehicle images.

[0024] Local feature learning part:

[0025] The cross-region attention module and the self-attention module are used to learn discriminative local features for finer-grained vehicle search; the anchor-based detection model is used to automatically locate the predefined vehicle parts with contour bounding boxes, and preliminary cross-region self-attention is implemented. The self-attention module is used to the regional feature learning part to enhance valuable details and ignore non-identifiable and noisy pixels. The regional feature learning branch is supervised by a soft maximum loss, which is expressed as follows:

[0026]

[0027] Among them, θ r is the parameter of the self-attention module, denoted as f r (·). E represents the cross entropy loss.

[0028] The position feature learning of the cross-region attention module includes: utilizing the relative position features and the contextual features of local details to achieve robust vehicle re-identification, adding the position-related contextual information Z in the feature map to enhance the local features and position-aware feature representation, and promoting robust vehicle re-identification in context and space, inserting the cross-region attention module into the final feature map generated by DCNN to obtain the discriminative feature representation, and finally, adopting the cross-entropy loss in this branch, and recorded as:

[0029]

[0030] Among them, f c (·) is the value of θ ca is the cross-region attention module with parameters, and y is the vehicle ID label.

[0031] When fusing global features and local features, the global feature is extracted by the first branch, and the other two branches output two local discriminant features; the loss function L is determined by the optimized L G ,L R ,L ca composition:

[0032]

[0033] Among them, θ g ,θ r ,θ ca are the parameters of the global feature learning branch and the local feature learning branch respectively.

[0034] The advantages of the present invention are: optimizing the recognition difficulties caused by low resolution and high noise in real deployment environments, while overcoming the interference of factors such as background, lighting and occlusion. It improves the accuracy and efficiency of the recognition process, improves the accuracy of vehicle re-identification, strengthens the global dependency between elements, and effectively combines location information with contextual content, improving the accuracy and robustness of feature representation. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The following is a brief description of the contents expressed in the drawings of the present invention and the symbols in the drawings:

[0036] Figure 1 is the wavelet transform window amplitude of the present invention; wherein (a) is the wavelet transform window; (b) is the wavelet transform amplitude;

[0037] Figure 2 A schematic diagram of the input membership function of the present invention;

[0038] Figure 3 This is a schematic diagram of outputting membership function of the present invention;

[0039] Figure 4 This is a schematic diagram of an eight-connected domain of the present invention;

[0040] Figure 5 It is a schematic diagram of the edge fuzzy reasoning process of the present invention;

[0041] Figure 6 This is a principle architecture diagram of feature re-identification of the present invention;

[0042] Figure 7 Schematic diagram of the self-attention module of the present invention;

[0043] Figure 8 Schematic diagram of the cross-region attention module of the present invention. DETAILED DESCRIPTION

[0044] The specific implementation of the present invention will be further explained in detail below by describing the optimal embodiment with reference to the accompanying drawings.

[0045] In order to cope with the challenge of vehicle feature re-identification in intelligent transportation systems, a vehicle feature re-identification method based on a dual attention mechanism is proposed. This method aims to optimize the recognition difficulties caused by low resolution and high noise in real deployment environments, while overcoming interference from factors such as background, illumination, and occlusion.

[0046] First, a strategy based on edge reasoning is introduced. The feature recognition of vehicles in video frames is processed and optimized, especially in low resolution and high noise conditions, and the accuracy and efficiency of the recognition process are improved through a dual attention mechanism. Specifically, the static self-attention method is used to refine and align visual features. Through the self-attention mechanism at the soft pixel level, the network focus is automatically aligned to the vehicle pixel area to achieve global feature learning and refinement, avoiding traditional image alignment methods that rely on specific key point detection or additional prior knowledge, and reducing computational complexity.

[0047] Secondly, to further improve the accuracy of vehicle re-identification, we focus on key vehicle components, such as headlights, brand logos, windshields, etc. These parts contain rich regional details and are crucial to improving recognition accuracy. Through the region-level hard attention mechanism, the key local components of the vehicle are located, and the self-attention module is used to reinforce the details of these components. The hard attention and soft attention mechanisms are effectively combined to optimize the learning process of local vehicle features.

[0048] Finally, the cross-region attention mechanism is used to effectively capture the position features in local areas such as the windshield. This method not only strengthens the global dependency between elements, but also effectively combines the position information with the context content, improving the accuracy and robustness of the feature representation.

[0049] A vehicle feature re-identification method based on a dual attention mechanism in this embodiment includes sending an input vehicle image to two branches for feature learning respectively; wherein the first branch is a global feature learning branch, which includes a continuous self-attention module, and the continuous self-attention module is used to selectively enhance the identification pixels on the entire image to achieve vehicle alignment and global context feature learning;

[0050] The second branch is the local feature learning branch, which automatically locates two prominent vehicle parts: the front and the windshield through the anchor detector, and learns the features of the front and the windshield;

[0051] The features learned from the two branches are fused to obtain the final vehicle features.

[0052] The vehicle image is first processed and optimized by edge inference to enhance the image clarity, and then the image is sent to two branches for feature learning.

[0053] Edge inference processing and optimization includes three steps: blurring, fuzzy reasoning and defuzzification to obtain the final image with enhanced clarity. The blurring uses the omnidirectional wavelet model to blur the image; the fuzzy reasoning uses the Mamdani reasoning method to perform fuzzy reasoning; the defuzzification uses the centroid method to process the image and output the image with enhanced clarity. The three processes of fuzzy reasoning are:

[0054] 1) Fuzzification: Select the omnidirectional wavelet model to extract the relevant features of the image (gradient, pixel difference, etc.) as the input of the fuzzy system, select the appropriate input membership function, and map the exact value of the obtained relevant feature quantity to the membership of the corresponding input fuzzy subset.

[0055] 2) Fuzzy reasoning: Based on experience, corresponding fuzzy rules are formulated, and the Mamdani reasoning method is used to map the membership degree of the extracted image feature quantity to the reasoning result set on the output quantity value domain.

[0056] 3) Defuzzification: The centroid method is used to obtain the exact value of the output from the set of inference results obtained by fuzzy reasoning, and then the defuzzified value is compared with the set threshold to obtain the edge image.

[0057] In global feature learning, the image processed by edge fuzzy inference is first processed by the convolution layer and the pooling layer, and then sent to the self-attention module for processing, and then passes through the convolution layer and the pooling layer to output the global feature LG.

[0058] In the local feature learning part, a continuous self-attention module DetecNet is used to selectively enhance the discriminative pixels on the entire image, and the front and window areas are learned through the anchor detector ROI; then the front area features are learned through the self-attention module, and the interactive pixel position perception features of the window position are captured through the cross-region attention module. The features of the front and window positions are LR and LGa respectively; then the output features are fused, and the feature fusion uses the LMP network to realize the fused feature L output.

[0059] The specific working principles of local and global features are explained as follows:

[0060] (1) Edge fuzzy reasoning

[0061] 1) Fuzzification

[0062] The omnidirectional wavelet model is selected to extract the relevant features of the image (gradient, pixel difference, etc.) as the input of the fuzzy system, and the input membership function of the Gaussian function is selected to map the exact value of the relevant feature quantity obtained to the membership of the corresponding input fuzzy subset.

[0063] Choose a two-dimensional Gaussian function with variance σ2 as the smoothing function:

[0064]

[0065] Scale c = 2 j When , the wavelet function is:

[0066]

[0067] In formula (2), let k = -2·4 j ·σ 2 , it can be simplified to:

[0068]

[0069] Then the wavelet transform along the horizontal and vertical directions is:

[0070]

[0071] The amplitude of wavelet transform can be deduced from equations (3) and (4):

[0072]

[0073] Where m and n represent the size of the selected transformation window.

[0074] Select a 3×3 transform window as the wavelet transform window, such as Figure 1 shown. Figure 1 In (a), A1 to A9 represent the grayscale values ​​of the image in the window. Figure 1 In (b), B1 to B4 represent the amplitudes of the wavelet transform in the four directions of 0°, 45°, 90°, and 135° obtained after 3×3 window omnidirectional wavelet transform.

[0075] The input-output membership function is set as:

[0076]

[0077] 2) Fuzzy reasoning

[0078] The corresponding fuzzy rules are formulated based on experience, and the Mamdani reasoning method is used to map the membership degree of the extracted image feature quantity to the reasoning result set on the output quantity value domain.

[0079] The four directional amplitudes B1~B4 of the omnidirectional wavelet transform are used as the input of the fuzzy system, and the fuzzy rules are formulated as follows:

[0080] ①If B1 and B2 and B3 and B4 are in the middle, then pixel A5 is an edge point;

[0081] ②If B2, B3 and B4 are medium and B1 is low, then pixel A5 is an edge point;

[0082] ③If B1, B3 and B4 are medium and B2 is low, then pixel A5 is an edge point;

[0083] ④If B1, B2 and B4 are medium and B3 is low, then pixel A5 is an edge point;

[0084] ⑤If B1, B2 and B3 are medium and B4 is low, then pixel A5 is an edge point;

[0085] ⑥If B1 or B2 or B3 or B4 is high, then pixel A5 is an edge point.

[0086] 3) Defuzzification

[0087] The centroid method is used to obtain the exact value of the output from the inference result set obtained by fuzzy reasoning, and then the defuzzified value is compared with the set threshold to obtain the edge image.

[0088] ①Adaptive threshold

[0089] Through adaptive threshold, the value obtained after defuzzification is compared with the defined threshold to determine edge points and non-edge points. The determination of edge points is shown as follows:

[0090]

[0091] Where: z* is the value of pixel z after defuzzification, calculated by fuzzy reasoning;

[0092] T - Adaptive threshold for determining edge points.

[0093] Since the fixed threshold cannot take into account the judgment of local edge points well, this paper adopts the adaptive threshold method, which takes into account both the fixed threshold and the local mean, and obtains the adaptive threshold T as:

[0094]

[0095] Where K is the value obtained by classifying the pixels of the deblurred image using the maximum inter-class variance method, and it is summed with the maximum value of the pixel after deblurring. Combine into a fixed threshold and calculate the local mean of the 3×3 window of the deblurred image In order to better suppress noise, the maximum value of the two items is taken as the adaptive threshold T.

[0096] ②Edge refinement

[0097] The edge image obtained by fuzzy reasoning is refined. The HSCP algorithm can quickly complete the edge image refinement operation. The algorithm steps are as follows:

[0098] 1) For all edge points P0, if the following conditions are met, it can be determined that it can be deleted:

[0099] ① The number of edge points E(P0) in its eight-connected domain is 2≤E(P0)≤6;

[0100] ② The eight-connected domain at point P0 contains only one edge point of the four-connected domain.

[0101] 2) For all deletable points, if one of the following conditions is met, the point is retained; otherwise, the point is deleted: ① P2 and P6 are edge points, and P4 is deletable;

[0102] ②P4 and P8 are edge points, while P6 can be deleted;

[0103] ③P4, P5, and P6 can all be deleted.

[0104] (2) Vehicle feature re-identification with dual attention mechanism

[0105] The dependencies between different regions are learned based on the dual self-attention mechanism. The self-attention module is used to refine the pixels in the entire image and the highlighted region, and the cross-region attention module is used to capture the pixels in the window region.

[0106] like Figure 6 As shown in Figure 1, first, given an image after edge blurring inference, a continuous self-attention module DetecNet selectively enhances the discriminative pixels on the entire image, and the anchor detector ROI is used to learn the front and window areas. Figure 7 The self-attention module shown is inserted into the local feature learning part, and the interactive pixel position-aware feature learning of the car window position is captured by the cross-region attention module. Finally, the features with multiple semantics and respective fields are fused for vehicle re-identification.

[0107] 1) Self-attention module global and local feature learning

[0108] A self-attention module is used for vehicle alignment and global feature learning, a convolution filter is used to obtain locally perceived feature maps, and a self-attention module is used to refine pixel-level regions to adaptively integrate local features with their global dependencies.

[0109] Given a local feature X represented as a tensor of shape (C, H, W), where C represents the number of channels of X, H and W are the height and width of X respectively, first compress it into a matrix Formulate the input feature matrix like a transformer. Then apply the self-attention mechanism introduced by the transformer to capture the dependencies of long-range visual features through the following steps.

[0110] Two new feature maps It consists of two learnable linear transformations Generate. Using X k and X qThe transpose of X is used for matrix multiplication to calculate the preliminary interactions between different pixels in X, and then the softmax operator is used to obtain the attention map

[0111] in Among them, X vec , X k and X q is a feature map with dimension N = H × W, For X q The i-th column vector of For X k The j-th column vector of M ji Represents the correlation between the i-th and j-th pixels.

[0112] Then, the feature X vec Put it into another learned linear operation to generate a new feature map Using the correlation matrix M and X v , reshape the output into The calculation method is:

[0113]

[0114] in, and is the learned weight matrix, X vec is a feature map with dimension N = H × W, M ji A represents the correlation between the i-th and j-th pixels. j is the jth vector output by the self-attention layer.

[0115] The self-attention layer is inserted into the convolution operation to build a stacked self-attention module to capture different types of attention and long-term dependencies. At the same time, the residual learning structure is adopted to avoid feature redundancy and add input feature maps to avoid degradation and feature redundancy. The residual attention unit is as follows Figure 7 As shown, the demonstration is as follows:

[0116] y i =αA i +x i (3)

[0117] Among them, α is a learnable scalar, which starts at 0 and gradually assigns more weight. i is the initial feature, y i is the final feature, i represents the position index of the feature map, A i is the i-th vector output by the self-attention layer. The above operations are superimposed to form Figure 7The self-attention module shown in Figure 2 is divided into three branches: q , W k and W v , its calculation is usually divided into three steps. First, through W q and each W k Calculate the similarity and get the weights. Common similarity functions include dot product, concatenation, and perceptron. Then, use the softmax function to normalize these weights. Finally, compare the normalized weights with W k The corresponding W v Perform weighted summation to get the final attention.

[0118] The entire vehicle image is placed in the above self-attention module to learn the long-range dependency-aware feature map and solve the misalignment problem. In addition, the triple loss is used to supervise the global feature learning and enhance the distinction between similar vehicles in the model, which is denoted as:

[0119]

[0120] Where N is the number of training samples, is the normalization factor, is the maximum value of hinge loss {X, 0}. d(i, j) is the distance between i and j, and d(i, l) is the distance between i and l. is a positive set consisting of vehicle images with the same ID as the probe, is the negative set constructed from images with different IDs from the probe. The triplet loss will enforce the distance margin between vehicle images. Global feature learning.

[0121] 2) Regional feature learning of dual attention module

[0122] The cross-region attention module and self-attention module are used to learn discriminative local features for finer-grained vehicle search. An anchor-based detection model is used to automatically locate predefined vehicle parts with contour bounding boxes and implement preliminary cross-region self-attention. The self-attention module is adopted to the regional feature learning part to enhance valuable details and ignore non-identifiable and noisy pixels. The regional feature learning branch is supervised by a soft maximum loss expressed as:

[0123]

[0124] Among them, f r (·) is based on θ r is the self-attention module with parameters, x is the vehicle feature, y is the vehicle ID label, and E represents the cross entropy loss.

[0125] 3) Position feature learning of cross-region attention module

[0126] The relative position features and the contextual features of local details are used to achieve robust vehicle re-identification. The low resolution and small size of local details in the window area make it less robust to viewpoint and lighting changes.

[0127] Adding location-related context information Z to the feature map can enhance the local features and location-aware feature representation, facilitating robust vehicle re-identification in context and space. Inserting the cross-region attention module into the final feature map generated by DCNN, as Figure 8 As shown, to obtain the discriminative feature representation. Finally, the cross entropy loss is used in this branch and is recorded as:

[0128]

[0129] Among them, f c (·) is based on θ ca is the cross-region attention module with parameters, x is the vehicle feature, y is the vehicle ID label, and E represents the cross entropy loss.

[0130] 4) Feature Fusion

[0131] The three branches learn three different semantic and attention features. The global feature is extracted by the first branch, and the other two branches output two local discriminant features. The loss function L is determined by the optimized L G , L R , L ca composition:

[0132]

[0133] Among them, θ r ,θ ca are the parameters of the global feature learning branch and the local feature learning branch respectively.

[0134] MLP is a feedforward artificial neural network that consists of multiple layers, each layer contains multiple neurons, and each neuron is connected to all neurons in the previous layer. The structure of MLP includes an input layer, a hidden layer, and an output layer. The input layer receives external data L G , L R , L ca , the hidden layer contains one or more neurons, each of which performs a nonlinear transformation on the input through the Sigmoid activation function. In the classification task, the output layer uses the softmax function to assign class probabilities.

[0135] The following table 1 is obtained by comparing this method with the prior art method:

[0136] Table 1 Quantitative comparison of patent methods

[0137]

[0138] As can be seen from the table data, the patented method shows significantly better performance than other existing technical solutions at different test set sizes. In terms of mAP and Rank-1 accuracy, the patented method is always ahead, especially on Test Size = 800, 1600 and 2400, its mAP is 0.817, 0.791 and 0.755 respectively, which is much higher than the 0.552 to 0.765 of other methods, and the Rank-1 accuracy is 0.806, 0.782 and 0.750 respectively, which is significantly better than other methods. This shows that the patented method has significant advantages in accuracy and retrieval performance. Although the FLOPs of the patented method are higher, the increased computational effort is worthwhile compared to its improved performance, and it still performs well on larger test sets. Overall, the patented method has achieved a good balance between computational efficiency and performance while improving accuracy, which is better than existing technical solutions.

[0139] Obviously, the specific implementation of the present invention is not limited to the above-mentioned methods. As long as various non-substantial improvements are made using the method concept and technical solution of the present invention, they are all within the protection scope of the present invention.

Claims

1. A vehicle feature re-identification method based on a dual attention mechanism, characterized in that: It includes sending the input vehicle image to two branches for feature learning; The first branch is the global feature learning branch, which includes a continuous self-attention module. The continuous self-attention module is used to selectively enhance the discriminative pixels on the entire image to achieve vehicle alignment and global context feature learning. The second branch is the local feature learning branch, which automatically locates two prominent vehicle parts: the front and the windshield through the anchor detector, and learns the features of the front and the windshield; The features learned from the two branches are fused to obtain the final vehicle features.

2. The vehicle feature re-identification method based on the dual attention mechanism as claimed in claim 1, characterized in that: The vehicle image is first processed and optimized by edge inference to enhance the image clarity, and then the image is sent to two branches for feature learning.

3. The vehicle feature re-identification method based on the dual attention mechanism as claimed in claim 2, characterized in that: Edge inference processing and optimization include three steps of blurring, fuzzy reasoning and deblurring to obtain the final image with enhanced clarity; the blurring adopts the omnidirectional wavelet model to blur the image; the fuzzy reasoning adopts the Mamdani reasoning method to perform fuzzy reasoning; the deblurring adopts the centroid method to process the image and output the image with enhanced clarity.

4. A vehicle feature re-identification method based on a dual attention mechanism as described in any one of claims 1 to 3, characterized in that: In global feature learning, the image processed by edge fuzzy inference is first processed by the convolution layer and the pooling layer, and then sent to the self-attention module for processing, and then passes through the convolution layer and the pooling layer to output the global feature LG.

5. A vehicle feature re-identification method based on a dual attention mechanism as described in any one of claims 1 to 3, characterized in that: In the local feature learning part, a continuous self-attention module DetecNet is used to selectively enhance the discriminative pixels on the entire image, and the front and window areas are learned through the anchor detector ROI; then the front area features are learned through the self-attention module, and the interactive pixel position perception features of the window position are captured through the cross-region attention module.

6. The vehicle feature re-identification method based on the dual attention mechanism as claimed in claim 4, characterized in that: In the global feature learning part, the self-attention module is used for vehicle alignment and global feature learning, the convolution filter is used to obtain the local perception feature map, the self-attention module is used to refine the pixel-level area, and the local features and their global dependencies are adaptively integrated; given a local feature X represented as a shape tensor (C, H, W), where C represents the number of channels of X, H and W are the height and width of X respectively, first compress it into a matrix Formulate the input feature matrix like a transformer, and then apply the self-attention mechanism introduced by the transformer to capture the dependencies of long-range visual features through the following steps: Two new feature maps It consists of two learnable linear transformations Generate, using X k and X q The transpose of X is used for matrix multiplication to calculate the preliminary interactions between different pixels in X, and then the softmax operator is used to obtain the attention map Among them, X vec , X k and X q The dimension is N = H × W, For X q The i-th column vector, M ji represents the correlation between the i-th and j-th pixels; Then, the feature X vec Put it into another learned linear operation to generate a new feature map Using the correlation matrix M and X v , reshape the output into The calculation method is: in, and is the learned weight matrix; A j is the jth vector output by the self-attention layer; The self-attention layer is inserted into the convolution operation to build a stacked self-attention module to capture different types of attention and long-term dependencies. At the same time, the residual learning structure is adopted to avoid feature redundancy and add input feature maps to avoid degradation and feature redundancy. The residual attention unit is as follows: and i =αA i +x i (3) Among them, α is a learnable scalar, with 0 as its initial value, and gradually learns to assign more weights, y i is the final feature, i represents the position index of the feature map, and finally the self-attention module is superimposed; The entire vehicle image is placed in the self-attention module to learn the long-range dependency-aware feature map and solve the misalignment problem. The triple loss is used to supervise the global feature learning and enhance the distinction between similar vehicles in the model, which is denoted as: Where N is the number of training samples, is the normalization factor, The maximum value of the hinge loss {X, 0}, measuring the distance between sample pairs (x i ,x j ) is calculated by d(i,j), is considered as a positive set consisting of vehicle images with the same identity as the probe, Viewed as a negative set constructed from images with different identities from the probe, the triplet loss will enforce the global feature learning of the distance margin M between vehicle images.

7. The vehicle feature re-identification method based on the dual attention mechanism as claimed in claim 5, characterized in that: Local feature learning part: The cross-region attention module and the self-attention module are used to learn discriminative local features for finer-grained vehicle search; the anchor-based detection model is used to automatically locate the predefined vehicle parts with contour bounding boxes, and preliminary cross-region self-attention is implemented. The self-attention module is used to the regional feature learning part to enhance valuable details and ignore non-identifiable and noisy pixels. The regional feature learning branch is supervised by a soft maximum loss, which is expressed as follows: Among them, θ r is the parameter of the self-attention module, denoted as f r (·), E represents the cross entropy loss.

8. The vehicle feature re-identification method based on the dual attention mechanism as claimed in claim 7, characterized in that: The position feature learning of the cross-region attention module includes: utilizing the relative position features and the contextual features of local details to achieve robust vehicle re-identification, adding the position-related contextual information Z in the feature map to enhance the local features and position-aware feature representation, and promoting robust vehicle re-identification in context and space, inserting the cross-region attention module into the final feature map generated by DCNN to obtain the discriminative feature representation, and finally, adopting the cross-entropy loss in this branch, and recorded as: Among them, f c (·) is the value of θ ca is the cross-region attention module with parameters, and y is the vehicle ID label.

9. A vehicle feature re-identification method based on a dual attention mechanism as claimed in any one of claims 1 to 8, characterized in that: When fusing global features and local features, the global feature is extracted by the first branch, and the other two branches output two local discriminant features; the loss function L is determined by the optimized L G ,L R ,L ca composition: Among them, θ g ,θ r ,θ ca are the parameters of the global feature learning branch and the local feature learning branch respectively.