Target tracking method and system based on multi-scale aggregated attention feature extraction network
By introducing multi-scale aggregated attention and cross-attention into the Transformer network, a multi-scale feature extraction network is constructed, which solves the problem of tight feature connection between CNN and Transformer, achieves balanced learning of global and local information, and improves the goal Track model performance.
Patent Information
- Application Number
- CN202410877555.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-07-02
AI Technical Summary
In the feature transfer process between CNN and Transformer in the existing target tracking model, the connection between local features and global features is not close enough, which affects the overall performance, and Transformer is insufficient in extracting local information.
Under the network structure of Transformer, a multi-scale feature extraction network is constructed by setting multi-scale aggregated attention in the shallow layer and cross-attention in the deep layer. It is trained using a variety of large-scale data sets to extract features containing local information and global information. The graphs are fused through cross-attention computation and finally fed into a prediction head consisting of three convolution branches to determine bounding boxes.
Making full use of context information for global modeling improves the modeling capabilities of the network, achieves balanced learning of local information and global information, and improves the robustness and performance of the model.
Smart Images

Figure CN118429389B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision and image processing technology, and in particular to a target tracking method and system based on a multi-scale aggregated attention feature extraction network. Background Art
[0002] Object tracking is an important research task in computer vision, which aims to accurately track and locate the target object of interest in a video sequence. Visual object tracking has a wide range of applications in life, including intelligent driving, human-computer interaction, and real-time monitoring.
[0003] At present, convolutional neural networks (CNNs) have dominated a variety of visual tasks, mainly due to the fact that CNNs use convolution operations to process image data, which can capture local features in images and is translation invariant. Researchers use CNNs to build tracking models. The model extracts features from the template area and the search area through CNN, fuses features through the cross-correlation operation of convolution, and finally adds a head to locate the target position. However, convolution is a local operation that cannot efficiently fuse global features, resulting in loss of global information or falling into a local optimal solution. Later, with the emergence of Transformer, researchers designed a tracker based on CNN and Transformer, which usually uses CNN for feature extraction and relies on Transformer for advanced feature fusion. Although this tracker has achieved good results, its CNN+Transformer architecture leads to limited modeling capabilities. Because using CNN first and then Transformer may result in insufficient connection between local features and global features, affecting overall performance.
[0004] In the process of feature transfer between CNN and Transformer, some details may be ignored or distorted, affecting the global modeling ability of Transformer. In order to give full play to the ability of Transformer, later trackers completely replaced CNN with Transformer, which showed good performance. Nevertheless, Transformer has an inherent problem, that is, when processing images using a segmented method, it focuses on capturing global relationships but is insufficient in extracting local information. Summary of the invention
[0005] In view of the above situation, the main purpose of the present invention is to propose a target tracking method and system based on a multi-scale aggregated attention feature extraction network to solve the above technical problems.
[0006] The present invention proposes a target tracking method based on a multi-scale aggregated attention feature extraction network, the method comprising the following steps:
[0007] Step 1: Under the Transformer network structure, a multi-scale feature extraction network is constructed by setting multi-scale aggregation attention in the shallow layer and cross attention in the deep layer;
[0008] Step 2: Use a variety of large-scale data sets to train the constructed multi-scale feature extraction network, and adjust the parameters of the multi-scale aggregation attention in the constructed multi-scale feature extraction network;
[0009] Step 3: Extract features from the template image and the search image based on the multi-scale feature extraction network model trained with the data set to obtain a template feature map and a search feature map containing local information and global information, fuse the template feature map and the search feature map, calculate and output them through cross-attention, and obtain the final feature map;
[0010] Step 4: Input the final feature map into the prediction head composed of three convolution branches, and determine the final bounding box based on the prediction results of the three branches.
[0011] The present invention also proposes a target tracking system based on a multi-scale aggregated attention feature extraction network, the system comprising:
[0012] The network model building module, under the Transformer network structure, constructs a multi-scale feature extraction network by setting multi-scale aggregation attention in the shallow layer and cross attention in the deep layer;
[0013] The model training module uses a variety of large-scale data sets to train the constructed multi-scale feature extraction network and adjusts the parameters of the multi-scale aggregation attention in the constructed multi-scale feature extraction network;
[0014] The feature extraction and fusion module extracts features from the template image and the search image based on the multi-scale feature extraction network model trained with the data set to obtain a template feature map and a search feature map containing local information and global information, fuses the template feature map and the search feature map, calculates and outputs them through cross-attention, and obtains the final feature map;
[0015] The prediction module inputs the final feature map into the prediction head composed of three convolution branches, and determines the final bounding box based on the prediction results of the three branches.
[0016] Compared with the prior art, the present invention has the following beneficial effects:
[0017] 1. The present invention completely uses Transformer to replace CNN, which enables the network to make full use of context information for global modeling, greatly improving the modeling ability of the network.
[0018] 2. The multi-scale feature extraction network model designed by the present invention realizes the extraction of local features and sparse features through shallow multi-scale aggregated attention. The cross attention in the deep layer of the model realizes the extraction and modeling of global information. The model's learning of local information is greatly improved to achieve a balance between local information and global information.
[0019] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description or learned through embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A flowchart of the target tracking method based on a multi-scale aggregated attention feature extraction network proposed in the present invention;
[0021] Figure 2 A schematic diagram of a multi-scale aggregate attention module of a target tracking method based on a multi-scale aggregate attention feature extraction network proposed in the present invention;
[0022] Figure 3 This is a structural diagram of the target tracking framework of the target tracking method based on the multi-scale aggregated attention feature extraction network proposed in the present invention;
[0023] Figure 4 This is the overall framework diagram of the target tracking system based on the multi-scale aggregated attention feature extraction network proposed in the present invention. DETAILED DESCRIPTION
[0024] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0025] These and other aspects of the embodiments of the present invention will be apparent with reference to the following description and accompanying drawings. In these descriptions and accompanying drawings, some specific implementations of the embodiments of the present invention are specifically disclosed to represent some ways of implementing the principles of the embodiments of the present invention, but it should be understood that the scope of the embodiments of the present invention is not limited thereto.
[0026] See also Figure 1 The embodiment of the present invention provides a target tracking method based on a multi-scale aggregated attention feature extraction network, the method comprising the following steps:
[0027] Step 1: Under the Transformer network structure, a multi-scale feature extraction network is constructed by setting multi-scale aggregation attention in the shallow layer and cross attention in the deep layer;
[0028] In step 1, by using multi-scale aggregated attention to extract features in the shallow layer of the feature extraction network, contextual semantic dependencies of different scales can be captured to fully utilize the information in windows of different scales, so that the feature map has more local information. Cross attention is used in the deep layer of the feature extraction network to extract global information and modeling, so that the model can extract local and global information at the same time, and has stronger robustness.
[0029] Step 2: Use a variety of large-scale data sets to train the constructed multi-scale feature extraction network, and adjust the parameters of the multi-scale aggregation attention in the constructed multi-scale feature extraction network;
[0030] In step 2, the steps of using a variety of large-scale data sets to train the constructed multi-scale feature extraction network include:
[0031] The present invention was run on an RTX 3060 GPU, with PyTorch version 1.12.0;
[0032] A total of 300 rounds of training were performed using the GOT-10k, COCO, LaSOT, and TrackingNet datasets;
[0033] For the video dataset, image pairs are sampled from random video sequences;
[0034] For the image dataset COCO, randomly select an image and apply data augmentation to generate image pairs. Common data augmentations such as scaling, translation, and jittering are applied to the image pairs;
[0035] Expand the target box by 4 times and 2 times respectively to obtain the search area and template.
[0036] Step 3: Perform feature extraction on the template image and the search image based on the multi-scale feature extraction network model trained with the data set to obtain a template feature map and a search feature map containing local information and global information, fuse the template feature map and the search feature map, calculate and output them through cross-attention, and obtain the final feature map.
[0037] See also Figure 2 and Figure 3 In step 3, the process of extracting features from the template image and the search image based on the multi-scale feature extraction network model trained with the data set to obtain attention features containing local information and attention features containing global information specifically includes the following steps:
[0038] Step 3.1: Input the features into the multi-scale aggregate attention and use the sliding window to divide the query vector into multiple groups;
[0039] Step 3.2: Set sliding windows of different sizes for the query vector of each group to perform feature mapping to obtain key vectors and value vectors of different scales;
[0040] Step 3.3, perform attention calculation on the obtained multiple groups of query vectors and multiple groups of key vectors and value vectors of different scales, and finally weight the attention of all groups to obtain multi-scale attention output;
[0041] Step 3.4, repeat steps 3.1 to 3.3 with the template image and the search image respectively, to obtain the multi-scale attention output of the template image and the multi-scale attention output of the search image respectively;
[0042] Step 3.5, the template image multi-scale attention output and the search image multi-scale attention output are respectively subjected to cross attention calculation to obtain a template feature map and a search feature map containing local information and global information;
[0043] In the above scheme, based on the multi-scale feature extraction network model trained with the data set, the corresponding operation mechanism is as follows:
[0044] ;
[0045] in, represents the multi-scale attention used to capture multi-scale features in deep learning models, represents the cross attention for processing multimodal data, represents the shallow module of the network, represents the deep module of the network, represents the query vector, is the grouping of query vectors, is the size of the sliding window, is the key vector of the feature map obtained using different sliding windows, is the value vector of the feature map obtained using different sliding windows, is the template image, To search for images, is the query vector for searching images, is the key vector after the template image and the search image are spliced together, is the value vector after the template image and the search image are fused and spliced, is the final feature map;
[0046] In the present invention, the process of setting sliding windows of different sizes for feature mapping of the query vector of each group to obtain key vectors of different scales has the following relationship:
[0047] ;
[0048] in, The key vector is obtained by using a sliding window with a side length of 3 for the query vector, The key vector is obtained by using a sliding window with a side length of 5 for the query vector. The key vector is obtained by using a sliding window with a side length of 7 for the query vector. is a sliding window of size 3×3, is a sliding window of size 5×5, It is a sliding window of size 7×7;
[0049] The process of setting sliding windows of different sizes for feature mapping of the query vector of each group to obtain value vectors of different scales has the following relationship:
[0050] ;
[0051] in, The value vector obtained by using a sliding window with a side length of 3 for the query vector, The value vector obtained by using a sliding window with a side length of 5 for the query vector, The value vector obtained by using a sliding window with a side length of 7 for the query vector;
[0052] Attention calculation is performed on the obtained multiple sets of query vectors and multiple sets of key vectors and value vectors of different scales to obtain multi-scale aggregated attention output. The relationship between the process is as follows:
[0053] ;
[0054] in, is the side length of the feature graph, is the function to normalize the attention score, is the dimension of the key vector, is the attention output of a single head in multi-scale aggregate attention, represents the transpose operation of the matrix, To concatenate the attention outputs of multiple heads in the channel dimension, To perform a linear transformation on the concatenated attention, is the multi-scale aggregated attention output, The number of groups for the query vector;
[0055] In the present invention, the multi-scale attention output of the template image is subjected to cross-attention calculation to obtain a feature map containing local information attention and global information, which has the following relationship:
[0056] ;
[0057] in, is the query vector of the template image, is the matrix transpose, is the key vector of the template image, is the value vector of the template image, It is a template feature map containing local information and global information;
[0058] The multi-scale attention output of the search image is subjected to cross-attention calculation to obtain a feature map containing local information and global information. The following relationship exists:
[0059] ;
[0060] in, is the key vector of the search image, is the value vector of the search image, It is a search feature map that contains local information and global information.
[0061] Step 4: Input the final feature map into the prediction head composed of three convolution branches, and determine the final bounding box based on the prediction results of the three branches.
[0062] In step 4, the final feature map is input into a prediction head composed of three convolution branches. The method for determining the final bounding box according to the prediction results of the three branches specifically includes the following steps:
[0063] The three convolution branches are center classification, offset regression, and size regression;
[0064] The final fused feature map is output as a center score map through the center classification branch. The process relationship is as follows:
[0065] ;
[0066] in, is the output of the center classification, Convolution operation for the central classification branch;
[0067] The discretization error of the output center of the offset regression branch is obtained by the final fused feature map, and the process relationship is as follows:
[0068] ;
[0069] in, is the output of the offset regression branch, The convolution operation of the offset regression branch;
[0070] The final fused feature map is used to predict the height and width of the target through the size regression branch. The process relationship is as follows:
[0071] ;
[0072] in, is the height and width of the target, The convolution operation of the size regression branch;
[0073] The position with the highest confidence in the center score map is selected as the target position, and a bounding box is calculated using the corresponding regression coordinates as the final prediction. The process relationship is as follows:
[0074] ;
[0075] in, To select the position with the highest confidence in the center score map as the coordinate of the target position, Take the value of the variable where the function reaches its maximum value, that is, the maximum fractional coordinate; For location The centrality score at .
[0076] In the above steps 1 to 4, the focal loss and generalized GIoU loss are combined during training and these loss functions are balanced by adjusting the weight factor. The function formula involved is:
[0077] Focal loss function:
[0078] ;
[0079] in, is the predicted probability, and They are adjustment items used to balance the impact of positive and negative samples and control the weight of difficult samples. is the focal loss;
[0080] Generalized GIoU loss function:
[0081] ;
[0082] in, and are two bounding boxes, is the minimum enclosing area containing the bounding box, is the area of the best enclosing region containing the bounding box, is the union area of the two bounding boxes, is the generalized GIoU loss, It is a traditional cross comparison;
[0083] Overall loss function:
[0084] ;
[0085] in, is the total loss, the comprehensive loss function used to train the model, is the absolute value error loss, is a weight factor used to adjust the relative importance of the absolute error loss in the total loss, is the weight factor used to adjust the generalized GIoU loss.
[0086] See also Figure 4 , an embodiment of the present invention further provides a target tracking system based on a multi-scale aggregated attention feature extraction network, the system comprising:
[0087] The network model building module, under the Transformer network structure, constructs a multi-scale feature extraction network by setting multi-scale aggregation attention in the shallow layer and cross attention in the deep layer;
[0088] The model training module uses a variety of large-scale data sets to train the constructed multi-scale feature extraction network and adjusts the parameters of the multi-scale aggregation attention in the constructed multi-scale feature extraction network;
[0089] The feature extraction and fusion module extracts features from the template image and the search image based on the multi-scale feature extraction network model trained with the data set to obtain attention features containing local information and attention features containing global information, fuses the attention features containing local information and the attention features containing global information, calculates and outputs them after cross attention;
[0090] The prediction module inputs the final feature map output by the cross-attention calculation after feature fusion into the prediction head composed of three convolution branches, and determines the final bounding box based on the prediction results of the three branches.
[0091] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0092] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0093] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A target tracking method based on a multi-scale aggregated attention feature extraction network, characterized in that: The method comprises the following steps: Step 1: Under the Transformer network structure, a multi-scale feature extraction network is constructed by setting multi-scale aggregation attention in the shallow layer and cross attention in the deep layer; Step 2: Use a variety of large-scale data sets to train the constructed multi-scale feature extraction network, and adjust the parameters of the multi-scale aggregation attention in the constructed multi-scale feature extraction network; Step 3: Extract features from the template image and the search image based on the multi-scale feature extraction network model trained with the data set to obtain a template feature map and a search feature map containing local information and global information, fuse the template feature map and the search feature map, calculate and output them through cross-attention, and obtain the final feature map; Step 4: Input the final feature map into the prediction head composed of three convolution branches, and determine the final bounding box based on the prediction results of the three branches; In step 3, based on the multi-scale feature extraction network model trained with the data set, the corresponding operation mechanism is as follows: ; in, represents the multi-scale attention used to capture multi-scale features in deep learning models, represents the cross attention for processing multimodal data, represents the shallow module of the network, represents the deep module of the network, represents the query vector, is the grouping of query vectors, is the size of the sliding window, is the key vector of the feature map obtained using different sliding windows, is the value vector of the feature map obtained using different sliding windows, is the template image, To search for images, is the query vector for searching images, is the key vector after the template image and the search image are spliced together, is the value vector after the template image and the search image are fused and spliced, is the final feature map; The process of extracting features from the template image and the search image based on the multi-scale feature extraction network model trained with the data set to obtain the template feature map and the search feature map containing local information and global information specifically includes the following steps: Step 3.1: Input the features into the multi-scale aggregate attention and use the sliding window to divide the query vector into multiple groups; Step 3.2: Set sliding windows of different sizes for the query vector of each group to perform feature mapping to obtain key vectors and value vectors of different scales; Step 3.3, perform attention calculation on the obtained multiple groups of query vectors and multiple groups of key vectors and value vectors of different scales, and finally weight the attention of all groups to obtain multi-scale attention output; Step 3.4, repeat steps 3.1 to 3.3 with the template image and the search image respectively, to obtain the multi-scale attention output of the template image and the multi-scale attention output of the search image respectively; Step 3.5, the template image multi-scale attention output and the search image multi-scale attention output are respectively subjected to cross attention calculation to obtain a template feature map and a search feature map containing local information and global information; In step 4, the final feature map is input into a prediction head composed of three convolution branches, and the method for determining the final bounding box according to the prediction results of the three branches specifically includes the following steps: The three convolution branches are center classification, offset regression, and size regression; The final fused feature map is output as a center score map through the center classification branch. The process relationship is as follows: ; in, is the output of the center classification, Convolution operation for the central classification branch; The discretization error of the output center of the offset regression branch is obtained by the final fused feature map, and the process relationship is as follows: ; in, is the output of the offset regression branch, The convolution operation of the offset regression branch; The final fused feature map is used to predict the height and width of the target through the size regression branch. The process relationship is as follows: ; in, is the height and width of the target, The convolution operation of the size regression branch; The position with the highest confidence in the center score map is selected as the target position, and a bounding box is calculated using the corresponding regression coordinates as the final prediction. The process relationship is as follows: ; in, To select the position with the highest confidence in the center score map as the coordinate of the target position, Take the value of the variable where the function reaches its maximum value, that is, the maximum fractional coordinate; For location The centrality score at .
2. The target tracking method based on multi-scale aggregated attention feature extraction network according to claim 1 is characterized in that: The process of setting sliding windows of different sizes for feature mapping of the query vector of each group to obtain key vectors of different scales has the following relationship: ; in, The key vector is obtained by using a sliding window with a side length of 3 for the query vector, The key vector is obtained by using a sliding window with a side length of 5 for the query vector. The key vector is obtained by using a sliding window with a side length of 7 for the query vector. is a sliding window of size 3×3, is a sliding window of size 5×5, Sliding window of size; The process of setting sliding windows of different sizes for feature mapping of the query vector of each group to obtain value vectors of different scales has the following relationship: ; in, The value vector obtained by using a sliding window with a side length of 3 for the query vector, The value vector obtained by using a sliding window with a side length of 5 for the query vector, The value vector obtained by using a sliding window with a side length of 7 for the query vector; Attention calculation is performed on the obtained multiple sets of query vectors and multiple sets of key vectors and value vectors of different scales to obtain multi-scale aggregated attention output. The relationship between the process is as follows: ; in, is the side length of the feature graph, is the function to normalize the attention score, is the dimension of the key vector, is the attention output of a single head in multi-scale aggregate attention, represents the transpose operation of the matrix, To concatenate the attention outputs of multiple heads in the channel dimension, To perform a linear transformation on the concatenated attention, is the multi-scale aggregated attention output, The number of groups to group the query vector.
3. The target tracking method based on multi-scale aggregated attention feature extraction network according to claim 1 is characterized in that: The process of calculating the multi-scale attention output of the template image through cross attention to obtain the feature map containing local information attention and global information contains the following relationship: ; in, is the query vector of the template image, is the matrix transpose, is the key vector of the template image, is the value vector of the template image, It is a template feature map containing local information and global information; The multi-scale attention output of the search image is subjected to cross-attention calculation to obtain a feature map containing local information and global information. The following relationship exists: ; in, is the key vector of the search image, is the value vector of the search image, It is a search feature map that contains local information and global information.
4. The target tracking method based on a multi-scale aggregated attention feature extraction network according to claim 3 is characterized in that: In step 3, the template feature map and the search feature map are fused, and after cross-attention calculation and output, the process of obtaining the final feature map has the following relationship: ; in, is the value vector after the fusion of the template feature map and the search feature map, is the key vector after the fusion of the template feature map and the search feature map, for The transpose of is the final feature map.
5. The target tracking method based on multi-scale aggregated attention feature extraction network according to claim 1 is characterized in that: In the above steps 1 to 4, the focal loss and generalized GIoU loss are combined during training and these loss functions are balanced by adjusting the weight factor. The function formula involved is: Focal loss function: ; in, is the predicted probability, and They are adjustment items used to balance the impact of positive and negative samples and control the weight of difficult and easy samples. is the focal loss; Generalized GIoU loss function: ; in, and are two bounding boxes, is the minimum enclosing area containing the bounding box, is the area of the optimal closure region containing the bounding box, is the union area of the two bounding boxes, is the generalized GIoU loss, It is a traditional cross comparison; Overall loss function: ; in, is the total loss, the comprehensive loss function used to train the model, is the absolute value error loss, is a weight factor used to adjust the relative importance of the absolute error loss in the total loss, is the weight factor used to adjust the generalized GIoU loss.
6. Target tracking system based on multi-scale aggregated attention feature extraction network, characterized by: The system applies the target tracking method based on a multi-scale aggregated attention feature extraction network as described in any one of claims 1 to 5 above, and the system comprises: The network model building module, under the Transformer network structure, constructs a multi-scale feature extraction network by setting multi-scale aggregation attention in the shallow layer and cross attention in the deep layer; The model training module uses a variety of large-scale data sets to train the constructed multi-scale feature extraction network and adjusts the parameters of the multi-scale aggregation attention in the constructed multi-scale feature extraction network; The feature extraction and fusion module extracts features from the template image and the search image based on the multi-scale feature extraction network model trained with the data set to obtain a template feature map and a search feature map containing local information and global information, fuses the template feature map and the search feature map, calculates and outputs them through cross-attention, and obtains the final feature map; The prediction module inputs the final feature map into the prediction head composed of three convolution branches, and determines the final bounding box based on the prediction results of the three branches.
Citation Information
Patent Citations
RGB-T target tracking network based on global attention convolution-Transform
CN115375948A
Monocular image depth estimation method based on multi-scale cross attention
CN116258757A
Multi-target tracking method based on multi-scale deformable attention mechanism
CN116309725A
Video multi-target tracking method based on multi-scale channel feature aggregation
CN117173217A
Multi-contrast nuclear magnetic resonance image super-resolution method based on feature fusion Transform
CN117495680A
Cited By
Method for detecting target object apprearance areas and time intervals in video, learning method, and system therefor
EP4790642A1
