RGBT target tracking method based on twin structure and Transform feature fusion
By using the RGBT method of twin structure and Transformer feature fusion in the target tracker, combined with visible light and infrared data, the problem of insufficient tracking performance of existing technology in complex environments is solved, and a more robust target tracking effect is achieved.
Patent Information
- Application Number
- CN202410677884.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-09-10
AI Technical Summary
Existing target trackers have insufficient robustness and tracking performance in complex environments, and are prone to losing track of targets, especially under poor lighting conditions. Existing technologies rely on single modal data and cannot effectively cope with complex environments.
The RGBT target tracking method based on the fusion of twin structure and Transformer features is used to achieve the fusion and robustness of multi-modal features by constructing a twin structure feature extraction network, Transformer feature fusion network and tracking result prediction network, combined with visible light and infrared data. track.
The robustness and performance of the target tracker are improved, and the target can be effectively tracked in complex backgrounds. Through multi-level visible light and infrared feature fusion, the anti-interference ability of the tracker is enhanced.
Smart Images

Figure CN118628528A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing, and in particular relates to an RGBT target tracking method based on twin structure and Transformer feature fusion. Background Art
[0002] In the field of computer vision, target tracking technology has been widely used in traffic management, human-computer interaction, national defense and military. However, most existing trackers rely on single-modal data, which often leads to insufficient robustness and tracking performance in complex environments. Recent studies have shown that the use of multimodal information can significantly improve the performance of trackers. RGBT target tracking can solve the problem that traditional visible light target tracking methods are prone to losing targets under poor lighting conditions by integrating the complementary advantages of visible light data and infrared data. Therefore, the complementary features of visible light and infrared play a key role in improving the performance of target trackers, enabling target trackers to more effectively cope with various complex environments. Summary of the invention
[0003] The purpose of the present invention is to overcome the shortcomings of the prior art and provide an RGBT target tracking method based on twin structure and Transformer feature fusion, wherein the RGBT target tracking method can achieve robust tracking of targets in complex backgrounds.
[0004] The technical solution of the present invention to solve the above technical problems is:
[0005] The RGBT target tracking method based on the twin structure and Transformer feature fusion includes the following steps:
[0006] (S1) Build a target tracking network: The model includes a twin structure feature extraction network, a Transformer feature fusion network, and a tracking result prediction network;
[0007] (S2) Model training and fine-tuning: Use the pre-training data set to pre-train the feature extraction network based on the twin structure, and use the stochastic gradient descent (SGD) method to train until the loss value converges to obtain the pre-trained model; use the training data set to fine-tune the pre-trained model, and use SGD to train until the loss value converges to obtain the trained network;
[0008] (S3) Target tracking stage: Obtain the first frame of the visible light and infrared image sequence of the RGBT test dataset, select the target to be tracked, and input the trained RGBT target tracking model based on the twin structure and Transformer feature fusion to generate the target tracking result.
[0009] Preferably, in step (S1), the construction of the twin structure feature extraction network, Transformer feature fusion network and tracking result prediction network includes the following steps:
[0010] (S1-1) Constructing a twin structure feature extraction network: The twin structure-based feature extraction network adopts a deep symmetrical structure, which is composed of 4 modified ResNet50s;
[0011] (S1-2) Construct Transformer feature fusion network: Based on the modification of Transformer network, realize the fusion of multi-modal and multi-level features; finally, obtain the response map of tracking results through cross-correlation operation;
[0012] (S1-3) Construct a tracking result prediction network: The tracking result prediction network contains three branches: a classification branch that predicts the category of each position in the response map; a prediction box regression branch that predicts the target position; and a centrality branch that predicts the centrality score of each position.
[0013] Preferably, in step (S2), pre-training and fine-tuning of the pre-trained model are performed based on the feature extraction network of the twin structure, including the following steps:
[0014] (S2-1), the feature extraction network includes 4 ResNet50s with the same structure, and every 2 ResNet50s form a pair of twin structure feature extraction networks. Use the visible light data structure as a pre-training data set to pre-train one pair of twin structure feature extraction networks, use SGD to optimize the tracking model until the model loss value converges, and finally save the pre-trained model;
[0015] (S2-2) Use the pre-trained model parameters saved in step (S2-1) to initialize the feature extraction network, freeze the first two layers of the ResNet50 network, use the RGBT training dataset to fine-tune the tracking model, and at the same time reduce the learning rate of the network. Use SGD optimization until the model loss value converges to obtain a trained network.
[0016] Preferably, in step (S3), obtaining a template of a target to be tracked in visible light and infrared images of an RGBT test data set and tracking the target template comprises the following steps:
[0017] (S3-1), the template image is centered on the target selected in the first frame of the visible light and infrared image sequence, and 127×127 pixels are cropped. The subsequent frames are search images, and the search image is 255×255 pixels;
[0018] (S3-2), inputting the visible light and infrared template graphs and search graphs obtained in step (S3-1) into the feature extraction network of the twin structure respectively, to obtain multi-layer visible light and infrared template features and search features;
[0019] (S3-3) Using the Transformer feature fusion network, the multi-layer visible light and infrared template features and the visible light and infrared search features obtained in step (S3-2) are fused to generate multi-layer fused template features and fused search features.
[0020] (S3-4), performing cross-correlation operations on the fused template features and fused search features of the same layer in pairs to obtain a multi-layer response map for tracking prediction;
[0021] (S3-5) Concatenate the multiple layers of response maps and input them into the tracking result prediction network to generate a 6-dimensional vector f = (cls, cen, l, t, r, b) to predict the target position in the visible light and infrared images, where cls is the classification score, cen is the center score, l+r and t+b are the width and height of the predicted target in the current frame.
[0022] Preferably, in step (S1-1), the downsampling operations in the last two convolution blocks (Conv4 and Conv5) in the original ResNet50 are deleted to provide richer spatial information.
[0023] Preferably, in step (S1-2), the Transformer feature fusion module (TFFB) has multiple encoding layers, each of which is composed of a multi-head attention module and a multi-layer perceptron module. TFFB deletes the position encoding and performs pooling preprocessing on K and V with a pooling step of 2 to increase the speed of multimodal feature fusion.
[0024] The pooling attention function can be expressed as:
[0025]
[0026] Among them, when Q is a visible light feature, K', V' are infrared features after pooling processing; when Q is an infrared feature, K', V' are visible light features after pooling processing.
[0027] The multi-head attention module can be expressed as:
[0028] MultiHead(Q,K',V')=concat(H i )W o ,(i=1,...,n) (2)
[0029]
[0030] in, and W o is the parameter of the linear mapping, and n is the number of heads of multi-head attention.
[0031] The Transformer feature fusion module can be expressed as:
[0032] TFFB(Q,K',V')=Norm(F+MLP(F)) (4)
[0033] F=Norm(Q+MultiHead(Q,K',V')) (5)
[0034] The visible light feature is used as Q, and the infrared feature is used as K', V', and input into a TFFB to obtain the response feature of the visible light feature on the infrared feature. Similarly, the response feature of the infrared light feature on the visible light feature is obtained. Then these two response features are added and input into the TFFB for self-attention representation to obtain the fused template feature and the fused search feature.
[0035] The cross-correlation operation can be defined as:
[0036] F fi =X fi ★Z fi , (i=2,3) (6)
[0037] F = concat(F f2 ,F f3 ) (7)
[0038] Among them, ★ represents the cross-correlation operator; Z fi and X fi is the template feature and search feature after fusion at the i-th (i=2,3) layer; F fi is the response map of the i-th layer (i=2,3); F is the multi-level fusion feature that integrates the features of the 2nd and 3rd layers.
[0039] Preferably, in step (S2-1), the total loss function of the network can be expressed as:
[0040] L=L cls +λ1L reg +λ2L cen (8)
[0041] Among them, λ1 and λ2 are hyperparameters; L cls is the classification loss, which is implemented by the cross entropy function;
[0042] L reg L is the regression loss, used to predict the location of the target box. reg It can be defined as:
[0043]
[0044] Where L iou is the intersection-over-union ratio of the real box and the predicted box, which can be obtained by g (i,j) Calculate. reg (i,j) is the distance from the image coordinate (i, j) to the four edges of the real box.
[0045] L cen L is the center loss, which is used to prevent the predicted target from deviating from the center. cen It can be defined as:
[0046]
[0047] in, is the center score of the image coordinate (i, j).
[0048] Preferably, in step (S3-5), the classification score map uses a ratio and scale penalty mechanism to suppress abnormal deformation of the predicted target box:
[0049]
[0050] Among them, k is a hyperparameter, r is the aspect ratio, r' is the aspect ratio of the last frame, s is the target size of the previous frame, and s' is the target size of the current frame.
[0051] The cosine window penalty (H) mechanism is used to suppress the displacement of target anomalies. The final classification score map can be expressed as:
[0052] cls=(1-α)cls*penalty+αH (12)
[0053] Among them, α is a hyperparameter. In the final classification score graph, the position with the largest score is the predicted target position.
[0054] Compared with the prior art, the present invention has the following beneficial effects:
[0055] 1. The RGBT target tracking method based on twin structure and Transformer feature fusion of the present invention uses the pruned ResNet50 as the feature extraction network of the twin structure to provide richer spatial information and improve network efficiency.
[0056] 2. The RGBT target tracking method based on twin structure and Transformer feature fusion of the present invention designs a Transformer feature fusion network, deletes the position encoding of the Transformer basic module, and performs pooling preprocessing on K and V with a pooling step of 2, thereby improving the multimodal feature fusion speed and the fusion capability of multimodal information.
[0057] 3. The RGBT target tracking method based on twin structure and Transformer feature fusion of the present invention utilizes multi-level visible light and infrared fusion feature information. The multi-level fusion information can predict the target in different receptive fields, making the target tracker performance more robust. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 This is a flowchart of the RGBT target tracking method based on twin structure and Transformer feature fusion of the present invention.
[0059] Figure 2 It is a schematic diagram of the Transformer feature fusion network of the RGBT target tracking method based on the twin structure and Transformer feature fusion of the present invention, including the overall Transformer feature fusion network and the local Transformer feature fusion modules.
[0060] Figure 3 A schematic diagram of a model of an RGBT target tracking method based on the fusion of twin structures and Transformer features of the present invention. DETAILED DESCRIPTION
[0061] The present invention is further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0062] See also Figure 1 The RGBT target tracking method based on the twin structure and Transformer feature fusion of the present invention comprises the following steps:
[0063] (S1) Build a target tracking network: The model includes a twin structure feature extraction network, a Transformer feature fusion network, and a tracking result prediction network;
[0064] (S2) Model training and fine-tuning: Use the pre-training data set to pre-train the feature extraction network based on the twin structure, and use the stochastic gradient descent (SGD) method to train until the loss value converges to obtain the pre-trained model; use the training data set to fine-tune the pre-trained model, and use SGD to train until the loss value converges to obtain the trained network;
[0065] (S3) Target tracking stage: Obtain the first frame of the visible light and infrared image sequence of the RGBT test dataset, select the target to be tracked, and input the trained RGBT target tracking model based on the twin structure and Transformer feature fusion to generate the target tracking result.
[0066] See also Figure 1In step (S1), the construction of the twin structure feature extraction network, Transformer feature fusion network and tracking result prediction network includes the following steps:
[0067] (S1-1) Constructing a twin structure feature extraction network: The twin structure-based feature extraction network adopts a deep symmetrical structure, which is composed of 4 modified ResNet50s;
[0068] (S1-2) Construct Transformer feature fusion network: Based on the modification of Transformer network, realize the fusion of multi-modal and multi-level features; finally, obtain the response map of tracking results through cross-correlation operation;
[0069] (S1-3) Construct a tracking result prediction network: The tracking result prediction network contains three branches: a classification branch that predicts the category of each position in the response map; a prediction box regression branch that predicts the target position; and a centrality branch that predicts the centrality score of each position.
[0070] See also Figure 1 In step (S2), the feature extraction network based on the twin structure is pre-trained and the pre-trained model is fine-tuned, including the following steps:
[0071] (S2-1), the feature extraction network includes 4 ResNet50s with the same structure, and every 2 ResNet50s form a pair of twin structure feature extraction networks. Use the visible light data structure as a pre-training data set to pre-train one pair of twin structure feature extraction networks, use SGD to optimize the tracking model until the model loss value converges, and finally save the pre-trained model;
[0072] (S2-2) Use the pre-trained model parameters saved in step (S2-1) to initialize the feature extraction network, freeze the first two layers of the ResNet50 network, use the RGBT training dataset to fine-tune the tracking model, and at the same time reduce the learning rate of the network. Use SGD optimization until the model loss value converges to obtain a trained network.
[0073] See also Figure 1 In step (S3), the target template to be tracked in the visible light and infrared images of the RGBT test data set is obtained and tracked, including the following steps:
[0074] (S3-1), the template image is centered on the target selected in the first frame of the visible light and infrared image sequence, and 127×127 pixels are cropped. The subsequent frames are search images, and the search image is 255×255 pixels;
[0075] (S3-2), inputting the visible light and infrared template graphs and search graphs obtained in step (S3-1) into the feature extraction network of the twin structure respectively, to obtain multi-layer visible light and infrared template features and search features;
[0076] (S3-3) Using the Transformer feature fusion network, the multi-layer visible light and infrared template features and the visible light and infrared search features obtained in step (S3-2) are fused to generate multi-layer fused template features and fused search features.
[0077] (S3-4), performing cross-correlation operations on the fusion template features and fusion search features of the same layer in pairs to obtain a multi-layer response map for tracking prediction;
[0078] (S3-5) Concatenate the multiple layers of response maps and input them into the tracking result prediction network to generate a 6-dimensional vector f = (cls, cen, l, t, r, b) to predict the target position in the visible light and infrared images, where cls is the classification score, cen is the center score, l+r and t+b are the width and height of the predicted target in the current frame.
[0079] See also Figure 2 The Transformer feature fusion module (TFFB) of the present invention has multiple encoding layers, each of which is composed of a multi-head attention module and a multi-layer perceptron module. TFFB deletes the position encoding and performs pooling preprocessing on K and V with a pooling step of 2 to improve the multimodal feature fusion speed.
[0080] The pooling attention function can be expressed as:
[0081]
[0082] Among them, when Q is a visible light feature, K', V' are infrared features after pooling processing; when Q is an infrared feature, K', V' are visible light features after pooling processing.
[0083] The multi-head attention module can be expressed as:
[0084] MultiHead(Q,K',V')=concat(H i )W o ,(i=1,...,n) (2)
[0085]
[0086] in, and W o is the parameter of the linear mapping, and n is the number of heads of multi-head attention.
[0087] The Transformer feature fusion module can be expressed as:
[0088] PAB(Q,K',V')=Norm(F+MLP(F)) (4)
[0089] F=Norm(Q+MultiHead(Q,K',V')) (5)
[0090] The visible light feature is used as Q, and the infrared feature is used as K', V', and input into a TFFB to obtain the response feature of the visible light feature on the infrared feature. Similarly, the response feature of the infrared light feature on the visible light feature is obtained. Then these two response features are added and input into the TFFB for self-attention representation to obtain the fused template feature and the fused search feature.
[0091] See also Figure 3 , the cross-correlation operation can be defined as:
[0092] F fi =X fi ★Z fi , (i=2,3) (6)
[0093] F = concat(F f2 ,F f3 ) (7)
[0094] Among them, ★ represents the cross-correlation operator; Z fi and X fi is the template feature and search feature after fusion at the i-th (i=2,3) layer; F fi is the response map of the i-th layer (i=2,3); F is the multi-level fusion feature that integrates the features of the 2nd and 3rd layers.
[0095] The tracking result prediction network contains three branches: a classification branch that predicts the category of each position in the response map; a prediction box regression branch that predicts the target position; and a centrality branch that predicts the centrality score of each position. Each branch participates in the calculation of the loss. The total loss function of the network can be expressed as:
[0096] L=L cls +λ1L reg +λ2L cen (8)
[0097] Among them, λ1 and λ2 are hyperparameters; L cls is the classification loss, which is implemented by the cross entropy function;
[0098] L reg L is the regression loss, used to predict the location of the target box. reg It can be defined as:
[0099]
[0100] Where L iou is the intersection-over-union ratio of the real box and the predicted box, which can be obtained by g (i,j) Calculate. reg (i,j) is the distance from the image coordinate (i, j) to the four edges of the real box.
[0101] L cen L is the center loss, which is used to prevent the predicted target from deviating from the center. cen It can be defined as:
[0102]
[0103] in, is the center score of the image coordinate (i, j).
[0104] Preferably, in step (S3-5), the classification score map uses a ratio and scale penalty mechanism to suppress abnormal deformation of the predicted target box:
[0105]
[0106] Among them, k is a hyperparameter, r is the aspect ratio, r' is the aspect ratio of the last frame, s is the target size of the previous frame, and s' is the target size of the current frame.
[0107] The cosine window penalty (H) mechanism is used to suppress the displacement of target anomalies. The final classification score map can be expressed as:
[0108] cls=(1-α)cls*penalty+αH (12)
[0109] Among them, α is a hyperparameter. In the final classification score graph, the position with the largest score is the predicted target position.
[0110] The above is a preferred embodiment of the present invention, but the embodiment of the present invention is not limited to the above content. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A RGBT target tracking method based on twin structure and Transformer feature fusion, characterized in that: The following steps are involved: (S1) Build a target tracking model: The model includes a twin structure feature extraction network, a Transformer feature fusion network, and a tracking result prediction network; (S2) Model training and fine-tuning: Use the visible light pre-training dataset to pre-train the feature extraction network based on the twin structure, and use the stochastic gradient descent (SGD) method to train until the loss value converges to obtain the pre-trained model; use the RGBT training dataset to fine-tune the pre-trained model, and use SGD to train until the loss value converges to obtain the trained network; (S3) Target tracking stage: Obtain the first frame of the visible light and infrared image sequence of the RGBT test dataset, select the target to be tracked, and input the trained RGBT target tracking model based on the twin structure and Transformer feature fusion to generate the target tracking result.
2. According to the RGBT target tracking method based on twin structure and Transformer feature fusion according to claim 1, step (S1) specifically comprises the following steps: (S1-1) Constructing a twin structure feature extraction network: The twin structure-based feature extraction network adopts a deep symmetrical structure, which is composed of 4 modified ResNet50s; (S1-2) Construct Transformer feature fusion network: Based on the modification of Transformer network, realize the fusion of multi-modal and multi-level features; finally, obtain the response map of tracking results through cross-correlation operation; (S1-3), Construct the tracking result prediction network: The tracking result prediction network contains three branches: a classification branch that predicts each position category in the response map; The prediction box regression branch predicts the target location; the centrality branch predicts the centrality score for each location.
3. According to the RGBT target tracking method based on twin structure and Transformer feature fusion according to claim 1, in step (S2), the pre-training of the feature extraction network based on the twin structure and the fine-tuning of the model include the following steps: (S2-1), the feature extraction network includes 4 ResNet50s with the same structure, and every 2 ResNet50s form a pair of twin structure feature extraction networks. The visible light data structure is used as a pre-training data set to pre-train one pair of twin structure feature extraction networks, and the SGD optimization tracking model is used until the model loss value converges, and finally the pre-training model is saved; (S2-2) Use the pre-trained model parameters saved in step (S2-1) to initialize the feature extraction network, freeze the first two layers of the ResNet50 network, use the RGBT training dataset to fine-tune the tracking model, and at the same time reduce the learning rate of the network. Use SGD optimization until the model loss value converges to obtain a trained network.
4. According to the RGBT target tracking method based on twin structure and Transformer feature fusion according to claim 1, step (S3) specifically includes the following steps: (S3-1), the template image is centered on the target selected in the first frame of the visible light and infrared image sequence, and 127×127 pixels are cropped. The subsequent frames are search images, and the search image is 255×255 pixels; (S3-2), inputting the visible light and infrared template graphs and search graphs obtained in step (S3-1) into the feature extraction network of the twin structure respectively, to obtain multi-layer visible light and infrared template features and search features; (S3-3), using the Transformer feature fusion network to fuse the multi-layer visible light and infrared template features and the visible light and infrared search features obtained in step (S3-2) to generate multi-layer fused template features and fused search features; (S3-4), performing cross-correlation operations on the fused template features and fused search features of the same layer in pairs to obtain a multi-layer response map for tracking prediction; (S3-5) Concatenate the multiple layers of response maps and input them into the tracking result prediction network to generate a 6-dimensional vector f = (cls, cen, l, t, r, b) to predict the target position in the visible light and infrared images, where cls is the classification score, cen is the center score, l+r and t+b are the width and height of the predicted target in the current frame.
5. According to the RGBT target tracking method based on twin structure and Transformer feature fusion according to claim 2, in step (S1-1), the downsampling operations in the last two convolution blocks (Conv4 and Conv5) in the original ResNet50 are deleted.
6. According to the RGBT target tracking method based on twin structure and Transformer feature fusion according to claim 2, in step (S1-2), the Transformer feature fusion module (TFFB) has multiple encoding layers, each encoding layer is composed of a multi-head attention module and a multi-layer perceptron module, TFFB deletes the position encoding, and performs pooling preprocessing on K and V, and the pooling step size is 2; The pooling attention function can be expressed as: in, When Q is a visible light feature, K', V' are infrared features after pooling. When Q is an infrared feature, K', V' are visible light features after pooling. The multi-head attention module can be expressed as: MultiHead(Q,K',V')=concat(H i )W o ,(i=1,...,n) (2) in, and W o is the parameter of linear mapping, n is the number of heads of multi-head attention; The Transformer feature fusion module can be expressed as; TFFB(Q,K',V')=Norm(F+MLP(F)) (4) F=Norm(Q+MultiHead(Q,K',V')) (5) The visible light feature is used as Q, and the infrared feature is used as K', V', and input into a TFFB to obtain the response feature of the visible light feature on the infrared feature. Similarly, the response feature of the infrared feature on the visible light feature is obtained. Then, these two response features are added and input into the TFFB for self-attention representation to obtain the fused template feature and the fused search feature. The cross-correlation operation can be defined as: F fi =X fi ★Z fi , (i=2,3) (6) F=concat(F f2 ,F f3 ) (7) Among them, ★ represents the cross-correlation operator; Z fi and X fi is the template feature and search feature after fusion at the i-th (i=2,3) layer; F fi is the response map of the i-th layer (i=2,3); F is the multi-level fusion feature that integrates the features of the 2nd and 3rd layers.
7. According to the RGBT target tracking method based on twin structure and Transformer feature fusion according to claim 3, in step (S2-1), the total loss function of the network can be expressed as: L=L cls +λ1L reg +λ2L cen (8) in, λ1 and λ2 are hyperparameters; L cls is the classification loss, which is implemented by the cross entropy function; L reg is the regression loss, used to predict the location of the target box, L reg It can be defined as: Where L iou is the intersection-over-union ratio of the real box and the predicted box, which can be obtained by g (i,j) Calculate, v reg (i,j) is the distance from the image coordinate (i, j) to the four edges of the real box; L cen is the center loss, which is used to prevent the predicted target from deviating from the center. cen It can be defined as: in, is the center score of the image coordinate (i, j).
8. According to the RGBT target tracking method based on twin structure and Transformer feature fusion according to claim 4, in step (S3-5), the classification score map adopts a proportion and scale penalty mechanism to suppress abnormal deformation of the predicted target box: in, k is a hyperparameter, r is the aspect ratio, r' is the aspect ratio of the last frame, s is the target size of the previous frame, and s' is the target size of the current frame; The cosine window penalty (H) mechanism is used to suppress the displacement of target anomalies. The final classification score map can be expressed as: cls=(1-α)cls*penalty+αH (12) Among them, α is a hyperparameter. In the final classification score graph, the position with the largest score is the predicted target position.
Citation Information
Patent Citations
Twin multi-modal target tracking method based on Transformer
CN115423847A
RGBT target tracking method based on twin network structure and anchor frame adaptive thought
CN116563343A
