Visual target tracking method and device
By constructing a multi-stage attention transformation network in the visual target tracking model and using global information for modeling, the problem that the convolution model in the existing technology is difficult to handle complex scenes is solved, and the accuracy and generalization of target tracking are improved.
Patent Information
- Application Number
- CN202210314824.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-28
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2042-03-28
AI Technical Summary
The existing visual target tracking model based on Siamese network only relies on the convolution model when representing the target appearance. It is difficult to effectively model the global information in the search area, which limits the generalization of the tracking algorithm in complex scenes.
Construct a target network model, which includes multiple stages. Each stage uses an independent attention transformation module. The template branch and search branch share the same network weight. The global information is fully utilized for construction through the attention transformation module and self-attention extraction operation. mold.
The model's resolution of targets and backgrounds is improved. The grouped self-attention architecture significantly improves the accuracy of visual target tracking and solves the generalization problem in complex scenes.
Smart Images

Figure CN114841310B
Abstract
Description
Technical Field
[0001] The present invention relates to the application field of deep neural networks in computer vision, and in particular to a visual target tracking method, device, electronic device and computer-readable storage medium. Background Art
[0002] Visual object tracking is one of the most critical components in computer vision. With the continuous improvement of electronic devices and artificial intelligence, visual object tracking has been widely used in many fields, including machine environments such as precision guidance and search and rescue missions, as well as surveillance environments such as intelligent traffic monitoring. In recent years, inspired by image classification and object detection, deep neural networks have become the basic components of most visual object trackers. Among them, the tracking algorithm based on the Siamese network has high tracking performance by training on a large number of template and test pairs to learn the similarity between the template and the search area.
[0003] Qiu Shoumeng, Gu Yuzhang, and Yuan Zeqiang ("Target Tracking Based on Dual-branch Twin Network", Computer Engineering and Applications, 2021, 57(24): 135-143) proposed a dual-branch twin network visual tracking algorithm to address the limitations of existing twin network-based target tracking models, which ignore the distinction between the interior and the contour of the target and the use of a fixed template space structure. The dual-branch structure is used to consider the difference in representation requirements between the interior area and the contour of the target. In addition, an improved pixel-by-pixel correlation module is proposed to effectively reduce the problems caused by the fixed template structure during traditional correlation operations. However, this network model only relies on the convolutional model when representing the target appearance, making it difficult to model the correlation of global information within the search area, thereby limiting the generalization of the tracking algorithm in complex scenarios. For this technical problem, no effective solution has been proposed in the relevant technology. Summary of the invention
[0004] Embodiments of the present invention provide a visual target tracking method, device, electronic device and computer-readable storage medium to at least solve the technical problem that existing network models in the related art only rely on convolutional models when representing the target appearance, making it difficult to model the correlation of global information in the search area, thereby limiting the generalization of the tracking algorithm in complex scenarios.
[0005] According to one aspect of an embodiment of the present invention, there is provided a visual target tracking method, comprising: constructing a target network model, wherein the target network model comprises a plurality of stages, each of the plurality of stages uses an independent attention transformation module, and the template branch and the search branch included in the target network model share the same network weights; and performing target tracking according to the target network model.
[0006] Optionally, the attention transformation module is implemented by the following formula (1):
[0007]
[0008]
[0009]
[0010]
[0011] Among them, z in is the input encoding of the attention transformation module; out is the output code of the attention transformation module; Norm is the normalization operation; C (u,v) (X) is a two-dimensional cyclic shift operation, which means that the matrix X is cyclically shifted upward by u and left by v; FFN is a feedforward neural network transmission, which consists of two layers of fully connected neural networks; MSA is a self-attention extraction operation.
[0012] Optionally, the MSA is determined by the following formula (2):
[0013]
[0014] Where d is the number of channels of the input code z; q = LR q (z),k=LR k (z),v=LR v (z);LR q , L.R. k , L.R. v is the corresponding linear transformation network.
[0015] Optionally, before performing target tracking according to the target network model, the method further includes: training the target network model; wherein training the target network model includes repeatedly performing the following steps until the actual number of training times reaches a preset number of training times N batch : Randomly select N in the training set train For samples, wherein the samples include template samples and test samples, the target in the template sample is at the center of the image block, and the target in the test sample is at any position; the N train The sample is used as the input of the target network model, and the network loss is obtained according to the difference between the predicted response map and the true response map output by the target network model; and the parameters of the target network model are updated according to the network loss.
[0016] Optionally, performing target tracking according to the target network model includes: given a sequence of images I kThe first frame I in (k=1,2,…,n) 1 , and the initial rectangular box B of the target 1 ; Take the initial rectangular frame B of the target 1 As the center, cut out the size of B 1 Size N t times the image block, and adjust the size of the image block to 224×224×3 as the template area; use the target network model to extract the template feature code in the template area; in the second frame and each subsequent frame, take the position of the target of the previous frame of the current frame as the center, select a search area, use the target network model to extract the search area feature code, and perform a cross-correlation operation on the search area feature code and the template feature code to obtain a response map; by finding the position corresponding to the maximum value in the response map, the target position of the current frame is obtained.
[0017] According to another aspect of an embodiment of the present invention, a visual target tracking device is provided, comprising: a construction module, used to construct a target network model, wherein the target network model includes multiple stages, each of the multiple stages uses an independent attention transformation module, and the template branch and search branch included in the target network model share the same network weights; and a tracking module, used to track the target according to the target network model.
[0018] Optionally, the device further comprises: a training module, for training the target network model before performing target tracking according to the target network model, wherein the training of the target network model comprises repeatedly performing the following steps until the actual number of training times reaches a preset number of training times N batch : Randomly select N in the training set train For samples, wherein the samples include template samples and test samples, the target in the template sample is at the center of the image block, and the target in the test sample is at any position; the N train The sample is used as the input of the target network model, and the network loss is obtained according to the difference between the predicted response map and the true response map output by the target network model; and the parameters of the target network model are updated according to the network loss.
[0019] Optionally, the tracking module includes: a first setting unit, for a given sequence of images I k The first frame I in (k=1,2,…,n) 1 , and the initial rectangular box B of the target 1 ; A second setting unit, for setting the initial rectangular frame B of the target 1 As the center, cut out the size of B 1 Size N ttimes the image block, and adjusting the size of the image block to 224×224×3 as the template area; an extraction unit, used to use the target network model to extract the template feature code in the template area; a processing unit, used to select a search area in the second frame and each subsequent frame with the position of the target of the previous frame of the current frame as the center, extract the search area feature code by using the target network model, and perform a cross-correlation operation on the search area feature code and the template feature code to obtain a response map; an acquisition unit, used to obtain the target position of the current frame by finding the position corresponding to the maximum value in the response map.
[0020] An embodiment of the present invention provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the steps of any one of the above methods.
[0021] An embodiment of the present invention provides a computer-readable storage medium, on which instructions are stored, and when the instructions are executed by a processor, the steps of any of the above methods are implemented.
[0022] In an embodiment of the present invention, a target network model is constructed, wherein the target network model includes multiple stages, each of the multiple stages uses an independent attention transformation module, and the template branch and the search branch included in the target network model share the same network weights; target tracking is performed according to the target network model. That is to say, the visual target tracking model based on the multi-stage attention transformation network uses an independent attention transformation network in each stage, fully utilizes global information to effectively model long-distance spatial relationships, improves the model's resolution of targets and backgrounds, and ensures model accuracy through a grouped self-attention architecture, thereby solving the problem that the existing network model in the related art only relies on the convolutional model when representing the target appearance, making it difficult to model the correlation of global information in the search area, thereby limiting the generalization of the tracking algorithm in complex scenarios. The technical effect of improving target tracking accuracy is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0024] Figure 1 A flowchart of a visual target tracking method provided by an embodiment of the present invention;
[0025] Figure 2 A network structure diagram of a visual target tracking method provided by an embodiment of the present invention;
[0026] Figure 3 A structural diagram of a grouped spatial self-attention module provided in an embodiment of the present invention;
[0027] Figure 4 A test result diagram provided for an embodiment of the present invention;
[0028] Figure 5 A schematic diagram of a flow chart of another visual target tracking method provided by an embodiment of the present invention;
[0029] Figure 6 A schematic diagram of a visual target tracking device provided by an embodiment of the present invention (I);
[0030] Figure 7 A schematic diagram of a visual target tracking device provided by an embodiment of the present invention (II);
[0031] Figure 8 A schematic diagram of a visual target tracking device provided by an embodiment of the present invention (III). DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "first", "second" and the like in the specification, claims and drawings of the present invention are used to distinguish different objects rather than to limit a specific order.
[0034] The embodiment of the present invention provides a visual target tracking method. Figure 1 A flowchart of a visual target tracking method provided by an embodiment of the present invention.
[0035] Optionally, application scenarios of the embodiments of the present invention include but are not limited to:
[0036] Scenario 1: Machine environments such as precision guidance and search and rescue missions. The visual target tracking model based on the multi-stage attention transformation network uses an independent attention transformation network in each stage, making full use of global information to effectively model long-distance spatial relationships, improve the model's resolution of targets and backgrounds, and ensure model accuracy through a grouped self-attention architecture.
[0037] Scenario 2: In surveillance environments such as intelligent traffic monitoring, a visual target tracking model based on a multi-stage attention transformation network uses an independent attention transformation network in each stage, making full use of global information to effectively model long-distance spatial relationships, improve the model's ability to distinguish between targets and backgrounds, and ensure model accuracy through a grouped self-attention architecture.
[0038] like Figure 1 As shown, the visual target tracking method provided in the embodiment of the present application includes the following steps:
[0039] S102, constructing a target network model, wherein the target network model includes multiple stages, each of the multiple stages uses an independent attention transformation module, and the template branch and the search branch included in the target network model share the same network weight;
[0040] It should be noted that the number of the above-mentioned multiple stages can be set according to the accuracy requirement of the target network model in tracking the target, for example, 3 stages, 4 stages, etc., and no limitation is made here.
[0041] Optionally, taking three stages as an example, the number of attention transformation modules used in each stage includes but is not limited to: 2, 2, and 6.
[0042] Optionally, the attention transformation module is implemented by the following formula (1):
[0043]
[0044]
[0045]
[0046]
[0047] Among them, z in is the input encoding of the attention transformation module; z out is the output encoding of the attention transformation module; Norm is the standardization operation; C (u,v) (X) is a two-dimensional cyclic shift operation, which means that the matrix X is cyclically shifted upward by u and left by v; FFN is a feedforward neural network transmission, which consists of two layers of fully connected neural networks; MSA is a self-attention extraction operation.
[0048] Optionally, the MSA is determined by the following formula (2):
[0049]
[0050] Where d is the number of channels of the input code z; q = LR q (z),k=LRk (z),v=LR v (z);LR q , L.R. k , L.R. v is the corresponding linear transformation network.
[0051] Optionally, before performing target tracking according to the target network model, the method further includes:
[0052] S11, training the target network model; wherein, training the target network model includes repeatedly performing the following steps until the actual number of training times reaches a preset number of training times N batch : Randomly select N in the training set train For a sample, wherein the sample includes a template sample and a test sample, the target in the template sample is at the center of the image block, and the target in the test sample is at an arbitrary position; the N train The sample is used as the input of the target network model, and the network loss is obtained according to the difference between the predicted response map and the true response map output by the target network model; according to the network loss, the parameters of the target network model are updated.
[0053] Through the above S11, the global information in the target area and the search area is fully utilized for offline training to improve the model's ability to distinguish between the target and the background, and the accuracy of visual target tracking is significantly improved through the grouped self-attention architecture.
[0054] S104: Track the target according to the target network model.
[0055] Optionally, performing target tracking according to the target network model includes:
[0056] S21, given a sequence of images I k The first frame I in (k=1,2,…,n) 1 , and the initial rectangular box B of the target 1 ;
[0057] S22, using the initial rectangular frame B of the target 1 As the center, cut out the size of B 1 Size N t times the image block, and adjust the size of the image block to 224×224×3 as the template area;
[0058] S23, using the target network model to extract template feature coding in the template area;
[0059] S24, in the second frame and each subsequent frame, taking the position of the target in the previous frame of the current frame as the center, selecting a search area, extracting a feature code of the search area using the target network model, and performing a cross-correlation operation on the feature code of the search area and the feature code of the template, thereby obtaining a response map;
[0060] S25, obtaining the target position of the current frame by finding the position corresponding to the maximum value in the response graph.
[0061] Through the above S102-104, by constructing a target network model, wherein the target network model includes multiple stages, each of the multiple stages uses an independent attention transformation module, and the template branch and the search branch included in the target network model share the same network weight; the target is tracked according to the target network model. That is to say, the visual target tracking model based on the multi-stage attention transformation network uses an independent attention transformation network in each stage, fully utilizes global information to effectively model long-distance spatial relationships, improves the model's resolution of targets and backgrounds, and ensures model accuracy through a grouped self-attention architecture, thereby solving the problem that the existing network model in the related art only relies on the convolutional model when representing the target appearance, making it difficult to model the correlation of global information in the search area, thereby limiting the generalization of the tracking algorithm in complex scenes. The technical effect of improving the accuracy of target tracking is achieved.
[0062] The present embodiment is described below with reference to specific examples.
[0063] This example provides a visual target tracking method based on a multi-stage attention transformation network (corresponding to the target network model), including the following steps:
[0064] Step 1: Build a multi-stage attention transformation network model. The specific process is as follows:
[0065] like Figure 2 As shown in the figure, the multi-stage attention transformation network model consists of a template branch and a search branch, and the weight input of each branch is a 224×224×3 image. To ensure that the two branches have the same appearance modeling ability, the two branches share the same network weights. The input image is feature encoded through three stages of spatial self-attention from shallow to deep. The spatial size of the output feature map of each stage is 1 / 4 of the input, and the number of channels is twice that of the input. Each stage contains 2, 2, and 6 grouped spatial self-attention modules, respectively. Figure 3The structure diagram of the grouped spatial self-attention module is shown in Figure 2. The modules that need to be learned through training are 2 independent self-attention modules, each of which contains three single-layer fully connected layers; and 2 independent feedforward neural network modules, each of which contains a two-layer fully connected layer. Given the input of the grouped spatial self-attention module is z in , then z in After two self-attention extractions connected by cyclic shift, the output z is obtained out Each time the self-attention is extracted, the input code is normalized, the internal attention is calculated, the residual connection is normalized, the feedforward neural network is transmitted, and the residual connection is normalized again. The calculation process of the grouped spatial self-attention module can be expressed as follows:
[0066]
[0067]
[0068]
[0069]
[0070] Among them, Norm is the standardization operation, C (u,v) (X) is a two-dimensional cyclic shift operation, which means that the matrix X is cyclically shifted upward by u and left by v. FFN is a feedforward neural network transmission, and MSA is a self-attention extraction operation, which can be expressed as follows:
[0071]
[0072] Where d is the number of channels of the input code z; q = LR q (z),k=LR k (z),v=LR v (z);LR q , L.R. k , L.R. v is the corresponding linear transformation network (i.e. a single-layer fully connected layer).
[0073] Step 2: Use the labeled training set to train the multi-stage attention transformation network model. The specific process is as follows:
[0074] according to Figure 2 Construct a multi-stage attention transformer network model and initialize all filters, parameters and weights with random numbers.
[0075] Randomly select N from all training sets trainThe template sample and the test sample are used as the input of the current mini-batch. The target in the template sample is at the center of the image block, while the target in the test sample may be located at any position. train The samples are used as input to the multi-stage attention transformer network, and the loss of the network output is calculated according to the following loss function, and then the network parameters are updated according to the loss:
[0076]
[0077] Among them, Y i and They respectively represent the response map predicted by the network in the i-th sample pair and the true Gaussian response map generated according to the position of the target in the test sample, and the corresponding position of the maximum value is the position of the target center.
[0078] Repeat step (2) after each mini-batch until the preset number of training times N is reached. batch .
[0079] Step 3: Use the network model trained in step 2 to perform online target tracking. The specific process is as follows:
[0080] Given a sequence of images I i The first frame I in (i=1,2,…,n) 1 , and the initial rectangular box B of the target 1 , with the target as the center, cut out the size of the target size N t The image block is times larger than the original one and the image size is adjusted to 224×224×3 as the template area. The template feature encoding is extracted using a multi-stage attention transformer network.
[0081] In the second frame and each subsequent frame, the position of the target in the previous frame is taken as the center, and the search area is selected as the input of the search area branch of the multi-stage attention transformation network for feature extraction to obtain the search area feature code z s , and the template feature encoding z t Perform a cross-correlation operation to obtain the response map R. By finding the position corresponding to the maximum value in the response map, the estimated target position (x * ,y * ), the process is as follows: in, is a cross-correlation operation. It should be noted that the test results of this example are as follows Figure 4 As shown, the implementation flow chart is as follows Figure 5 shown.
[0082] In summary, this example fully utilizes the global information in the target area and the search area for offline training, improves the model's ability to distinguish between the target and the background, and significantly improves the accuracy of visual target tracking through the grouped self-attention architecture.
[0083] The embodiment of the present invention also provides a visual target tracking device, Figure 6 A schematic diagram of visual target tracking provided by an embodiment of the present invention.
[0084] Optionally, application scenarios of the embodiments of the present invention include but are not limited to:
[0085] Scenario 1: Machine environments such as precision guidance and search and rescue missions. The visual target tracking model based on the multi-stage attention transformation network uses an independent attention transformation network in each stage, making full use of global information to effectively model long-distance spatial relationships, improve the model's resolution of targets and backgrounds, and ensure model accuracy through a grouped self-attention architecture.
[0086] Scenario 2: In surveillance environments such as intelligent traffic monitoring, a visual target tracking model based on a multi-stage attention transformation network uses an independent attention transformation network in each stage, making full use of global information to effectively model long-distance spatial relationships, improve the model's ability to distinguish between targets and backgrounds, and ensure model accuracy through a grouped self-attention architecture.
[0087] like Figure 6 As shown, the above device comprises:
[0088] A construction module 62, used to construct a target network model, wherein the target network model includes multiple stages, each of the multiple stages uses an independent attention transformation module, and the template branch and the search branch included in the target network model share the same network weights;
[0089] It should be noted that the number of the above-mentioned multiple stages can be set according to the accuracy requirement of the target network model in tracking the target, for example, 3 stages, 4 stages, etc., and no limitation is made here.
[0090] Optionally, taking three stages as an example, the number of attention transformation modules used in each stage includes but is not limited to: 2, 2, and 6.
[0091] The tracking module 64 is used to track the target according to the target network model.
[0092] Optionally, the attention transformation module is implemented by the following formula (1):
[0093]
[0094]
[0095]
[0096]
[0097] Among them, z in is the input encoding of the attention transformation module; z out is the output encoding of the attention transformation module; Norm is the standardization operation; C (u,v) (X) is a two-dimensional cyclic shift operation, which means that the matrix X is cyclically shifted upward by u and left by v; FFN is a feedforward neural network transmission, which consists of two layers of fully connected neural networks; MSA is a self-attention extraction operation.
[0098] Optionally, the MSA is determined by the following formula (2):
[0099]
[0100] Where d is the number of channels of the input code z; q = LR q (z),k=LR k (z),v=LR v (z);LR q , L.R. k , L.R. v is the corresponding linear transformation network.
[0101] Alternatively, if Figure 7 As shown, the above device also includes:
[0102] The training module 72 is used to train the target network model before performing target tracking according to the target network model, wherein the training of the target network model includes repeatedly performing the following steps until the actual number of training times reaches a preset number of training times N. batch : Randomly select N in the training set train For a sample, wherein the sample includes a template sample and a test sample, the target in the template sample is at the center of the image block, and the target in the test sample is at an arbitrary position; the N train The sample is used as the input of the target network model, and the network loss is obtained according to the difference between the predicted response map and the true response map output by the target network model; according to the network loss, the parameters of the target network model are updated.
[0103] Through the above-mentioned training module 72, the global information in the target area and the search area is fully utilized for offline training, so as to improve the model's ability to distinguish between the target and the background, and the accuracy of visual target tracking is significantly improved through the grouped self-attention architecture.
[0104] Alternatively, if Figure 8 As shown, the tracking module 64 includes:
[0105] The first setting unit 82 is used to set a sequence of images I k The first frame I in (k=1,2,…,n) 1 , and the initial rectangular box B of the target 1 ;
[0106] The second setting unit 84 is used to set the initial rectangular frame B of the target 1 As the center, cut out the size of B 1 Size N t times the image block, and adjust the size of the image block to 224×224×3 as the template area;
[0107] An extraction unit 86 is used to extract a template feature code in the template area using the target network model;
[0108] The processing unit 88 is used to select a search area in the second frame and each subsequent frame with the position of the target in the previous frame of the current frame as the center, extract the feature code of the search area by using the target network model, and perform a cross-correlation operation on the feature code of the search area and the feature code of the template, so as to obtain a response map;
[0109] The acquisition unit 90 is used to obtain the target position of the current frame by finding the position corresponding to the maximum value in the response map.
[0110] Through the above device, by constructing a target network model, wherein the target network model includes multiple stages, each of the multiple stages uses an independent attention transformation module, and the template branch and the search branch included in the target network model share the same network weight; the target is tracked according to the target network model. That is to say, the visual target tracking model based on the multi-stage attention transformation network uses an independent attention transformation network in each stage, fully utilizes global information to effectively model long-distance spatial relationships, improves the model's resolution of targets and backgrounds, and ensures model accuracy through a grouped self-attention architecture, thereby solving the problem that the existing network model in the related art only relies on the convolutional model when representing the target appearance, making it difficult to model the correlation of global information in the search area, thereby limiting the generalization of the tracking algorithm in complex scenes. The technical effect of improving the accuracy of target tracking is achieved.
[0111] An embodiment of the present invention further provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the steps of any one of the above methods.
[0112] An embodiment of the present invention further provides a computer-readable storage medium, on which instructions are stored, and when the instructions are executed by a processor, the steps of any of the above methods are implemented.
[0113] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention.
Claims
1. A visual target tracking method, characterized in that: include: Constructing a target network model, wherein the target network model includes multiple stages, each of the multiple stages uses an independent attention transformation module, and the template branch and the search branch included in the target network model share the same network weights; Performing target tracking according to the target network model; including: Given a sequence of images I k The first frame I1 in (k=1,2,L,n), and the initial rectangular box B1 of the target; With the initial rectangular frame B1 of the target as the center, cut out N t times the image block, and adjusting the size of the image block to 224×224×3 as the template area; Using the target network model, extracting template feature coding in the template area; In the second frame and each subsequent frame, a search area is selected with the position of the target in the previous frame of the current frame as the center, a feature code of the search area is extracted using the target network model, and a cross-correlation operation is performed on the feature code of the search area and the feature code of the template, so as to obtain a response map; The target position of the current frame is obtained by finding the position corresponding to the maximum value in the response map.
2. The target tracking method according to claim 1, characterized in that: The attention transformation module is implemented by the following formula (1): Among them, z in is the input encoding of the attention transformation module; out is the output code of the attention transformation module; Norm is the normalization operation; C (u,v) (X) is a two-dimensional cyclic shift operation, which means that the matrix X is cyclically shifted upward by u and left by v; FFN is a feedforward neural network transmission, which consists of two layers of fully connected neural networks; MSA is a self-attention extraction operation.
3. The target tracking method according to claim 2, characterized in that: The MSA is determined by the following formula (2): Where d is the number of channels of the input code z; q = LR q (z),k=LR k (z),v=LR v (z);LR q , L.R. k , L.R. v is the corresponding linear transformation network.
4. The target tracking method according to claim 1, characterized in that: Before performing target tracking according to the target network model, the method further includes: training the target network model; The training of the target network model includes repeatedly performing the following steps until the actual number of training times reaches a preset number of training times N. batch : Randomly select N train For samples, wherein the samples include template samples and test samples, the target in the template sample is at the center of the image block, and the target in the test sample is at an arbitrary position; The N train The sample is used as the input of the target network model, and the network loss is obtained according to the difference between the predicted response map and the true response map output by the target network model; According to the network loss, the parameters of the target network model are updated.
5. A visual target tracking device, characterized in that: include: A construction module, used to construct a target network model, wherein the target network model includes multiple stages, each of the multiple stages uses an independent attention transformation module, and the template branch and the search branch included in the target network model share the same network weight; A tracking module, used for tracking a target according to the target network model; comprising The first setting unit is used to set a sequence of images I k The first frame I1 in (k=1,2,L,n), and the initial rectangular box B1 of the target; The second setting unit is used to cut out N rectangles of the same size as B1 with the initial rectangular frame B1 of the target as the center. t times the image block, and adjusting the size of the image block to 224×224×3 as the template area; An extraction unit, configured to extract a template feature code in the template area using the target network model; A processing unit is used to select a search area in the second frame and each subsequent frame, with the position of the target in the previous frame of the current frame as the center, extract the feature code of the search area by using the target network model, and perform a cross-correlation operation on the feature code of the search area and the feature code of the template, so as to obtain a response map; The acquisition unit is used to obtain the target position of the current frame by finding the position corresponding to the maximum value in the response map.
6. The target tracking device according to claim 5, characterized in that: The device also includes: A training module is used to train the target network model before performing target tracking according to the target network model, wherein the training of the target network model includes repeatedly performing the following steps until the actual number of training times reaches a preset number of training times N batch : Randomly select N train For samples, wherein the samples include template samples and test samples, the target in the template sample is at the center of the image block, and the target in the test sample is at an arbitrary position; The N train The sample is used as the input of the target network model, and the network loss is obtained according to the difference between the predicted response map and the true response map output by the target network model; According to the network loss, the parameters of the target network model are updated.
7. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the steps of any one of the methods described in claims 1-4.
8. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by a processor, the steps of any one of the methods described in claims 1 to 4 are implemented.
