Visual target tracking method based on mask contrast learning pre-training
By adopting the pre-training method of mask contrast learning in visual target tracking, combined with the ViT model and self-attention layer, the problem of insufficient interaction between template and search area features is solved, achieving more efficient feature extraction and tracking performance, and improving Improved the accuracy and speed of video target tracking.
Patent Information
- Application Number
- CN202410767226.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-06-14
AI Technical Summary
In existing visual target tracking technology, the separate extraction of template features and search area features and the shallow one-way relationship modeling strategy are not enough for effective interaction, resulting in insufficient information interaction, affecting tracking performance, and relying on pre-training for image classification tasks. Fully unleash the potential of backbone networks.
Using a pre-training method based on mask contrastive learning, the ViT model captures the global relationship between the template and the query target, combines self-attention and cross-attention layers for two-way information interaction, and uses high-level mask matching in pre-training. Supervise target-consistent representation learning, establish inter-frame hybrid contrast regularization constraints, directly predict the center point and bounding box of the target, and avoid the traditional anchor or proposal generation process.
It improves the pre-training adaptability of target tracking tasks, learns more versatile and generalizable feature representations, improves the performance and efficiency of video target tracking, maintains high accuracy and increases detection speed.
Smart Images

Figure CN118674749A
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computer vision and target tracking, and in particular relates to a visual target tracking method based on mask contrast learning pre-training. Background Art
[0002] The target in visual object tracking (VOT) technology refers to a specific target located in each frame of the video, and the positioning depends only on the initial appearance of the target. However, the constant change and arbitrariness of the target change make it challenging to learn an appearance model that can effectively distinguish the target from the background. At present, mainstream trackers generally adopt a two-step, two-process strategy to deal with this problem. However, this also means that the features of the template and the features of the search area are extracted separately, and the whole process is divided into two steps: feature extraction and relationship modeling. From the above, the natural processing flow adopts a "divide and conquer" strategy, which has achieved remarkable results in tracking performance.
[0003] Different two-step, two-process prototypes can be compared based on the different computational burdens of feature extraction and relational modeling networks. Early twin trackers and discriminative trackers first extract features of the template and search region, respectively, through CNN backbones, which have the same structure and parameters. Then, a lightweight relational modeling network (e.g., cross-correlation layer in twin tracker and correlation filter in discriminative tracker) is responsible for fusing these features for subsequent state estimation tasks. However, in these methods, template features cannot be adjusted according to search region features. This shallow and unidirectional relational modeling strategy may not be sufficient for information interaction.
[0004] Recently, stacked Transformer layers have been introduced to achieve better relation modeling and enable bidirectional information exchange. TransT proposes to stack a series of self-attention and cross-attention layers for iterative feature fusion. STARK concatenates pre-extracted template and search region features and then inputs them into multiple self-attention layers. Although the bidirectional re-architecture brings performance gains, it inevitably reduces the inference speed. OSTrack's single-stream single-stage design seamlessly combines feature extraction and relation modeling into a unified process for the first time. The proposed method provides free information flow between template and search region with tiny computational cost. Not only does it generate target-oriented features through mutual guidance, but it is also efficient in both training and testing time.
[0005] Object tracking has a wide range of applications in many fields, including security monitoring, traffic monitoring, human-computer interaction, autonomous vehicles, motion analysis, etc. The performance of an object tracking algorithm usually takes into account factors such as accuracy, robustness, and real-time performance. Existing object tracking backbone networks usually rely on pre-training of image classification tasks. However, pre-training uses classification task training and classification task datasets. Due to the difference between pre-training and tracking tasks, the potential of the backbone network cannot be fully utilized and it relies on a long period of training. Summary of the invention
[0006] In order to solve the problem of improving the adaptability of pre-training for tracking tasks, a visual target tracking method based on mask contrast learning pre-training in a specific embodiment of the present application includes the following steps:
[0007] Step 1: obtain the input image and category information of the template target and the current query video frame, divide the input image into tiles of a fixed size, and flatten each tile into a tile vector;
[0008] Step 2: Input the tile vector into tokens and pass it to the ViT model;
[0009] Step 3: The ViT model captures the global relationship between the query target and the template target based on the contextual information of the current tile vector and all other tile vectors, and projects each tile vector into a higher-dimensional feature space through an embedding layer;
[0010] Step 4: The feedforward neural network of the ViT model performs local transformation and representation on the features of each tile vector;
[0011] Step 5: The ViT model fuses and outputs the global features and local features, and the fused features are input into the target detector;
[0012] Step 6: The target detector regresses and predicts the fused features, wherein the prediction includes predicting the center point and bounding box of the target.
[0013] Preferably, the ViT model consists of multiple Transformer encoders, each of which consists of multiple self-attention layers.
[0014] Preferably, in step S50, the center point and bounding box of the target are predicted by a center-bounding box prediction head, and the prediction head includes two branches, wherein one branch is used to predict a heat map of the center point, and the other branch is used to predict an offset of the bounding box.
[0015] Preferably, the loss of the ViT model includes a cross entropy loss for center point prediction and a smooth L1 loss for bounding box prediction.
[0016] Preferably, the pre-training is pre-training the ViT model, including:
[0017] The template image is fixed and its features are represented by the encoder of the ViT model;
[0018] The representation information representing the template target is obtained through nonlinear enhancement of the projection model;
[0019] Randomly extract video frames from the current video and divide the video frames into two perspectives, where the first perspective is the global perspective, which contains all the information of the current image; the second perspective is the mask perspective, which only contains the local information of the current image;
[0020] Self-attention blocks are used to represent spatially distributed markers, and cross-attention blocks are used to aggregate overall image instances. The first and second perspectives are respectively subjected to the ViT model for feature extraction to obtain representations representing the global and local, respectively.
[0021] Preferably, a 75%-90% mask ratio is used for data enhancement.
[0022] Preferably, the loss function of the positive sample is as follows:
[0023]
[0024] The loss function of negative samples is as follows:
[0025]
[0026] The constraints between positive and negative samples are as follows:
[0027]
[0028] The loss is a weighted combination of the above loss functions;
[0029] Where dist() is used to measure the difference between two representations, m and n are used to index the data modality, and i and j are used to index samples within a specific modality. represents the i-th positive sample from modality m, express The data augmented version of is the loss used to ensure that the difference between a positive sample and its enhanced version is smaller than the difference between it and other positive samples, while
[0030] is used to ensure that the difference between positive samples of the same modality is smaller than the difference between positive samples of different modalities. and Also has a similar definition.
[0031] Preferably, the model is trained with the AdamW optimizer, the learning rate of the backbone network is set to 1e-5, the learning rate of other parameters is set to 1e-4, the weight decay is set to 1e-4, and the network is trained on two Nvidia Titan RTX GPUs with a batch size of 38, a total of 1000 cycles, 1000 iterations per cycle, and the learning rate is dropped by a factor of 10 after 500 cycles.
[0032] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention develops a new pre-training method specifically for tracking tasks, combines the characteristics of tracking tasks, and uses the video data of the tracking task itself to perform efficient pre-training. The pre-training of the present invention is based on self-supervised target consistent representation learning based on high-level mask matching. By pre-training on large-scale unlabeled video data, it can help the model learn more general and generalizable feature representations, thereby performing better in video target tracking tasks. After obtaining template, global, and local high-level information, the present invention establishes inter-frame mixed contrast regularization constraints. It can encourage the feature extractor to extract discriminative features for complex samples, and takes into account the similarity tendencies between enhanced copies of different samples, within modalities, between modalities, and between positive and negative samples.
[0033] The present invention adopts a corner detector (CornerNet) to regress and predict the output features of ViT, realizing end-to-end object tracking, which directly predicts the center point and bounding box of the target without using the traditional anchor or proposal generation process, making CornerNet have a simpler and more efficient design, and can improve the detection speed while maintaining accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 The process of pre-training part for VIT;
[0035] Figure 2 The training part of the process for the tracker. DETAILED DESCRIPTION
[0036] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments. The present invention includes but is not limited to the following embodiments.
[0037] Embodiment 1: A visual target tracking method based on mask contrast learning pre-training includes the following two steps:
[0038] Step 1: Pre-training of VIT;
[0039] First, two video frames are extracted from a video and divided into patches, and then different random masks are applied to them with a ratio of 75%;
[0040] Then it is input into a VIT to extract its features, and then the extracted features are input into a linear layer to obtain two features.
[0041] Finally, the cosine similarity of the two features is calculated to get the result R, and 1-R is used as the loss function to optimize the model parameters. The pre-training is completed after 10 million samplings.
[0042] Specifically, the pre-training of the present invention is based on self-supervised target consistent representation learning based on high-level mask matching. In order to be able to perform pre-training on large-scale unlabeled video data, the model can learn more general and generalizable feature representations, so as to perform better in video target tracking tasks. The present invention proposes a self-supervised target consistent representation learning framework based on high-level mask matching, such as Figure 1 shown.
[0043] In the pre-training step, the present invention first fixes the template image and performs its feature representation through the ViT encoder. During the process, the nonlinearity is enhanced by projection to obtain the representation information representing the template target. Then, the video frame is randomly extracted from the current video and divided into two perspectives. View 1 is a global perspective, which contains all the information of the current image. View 2 is a mask perspective, which only contains local information of the current image. The present invention uses self-attention blocks to represent spatially distributed markers, and then uses cross-attention blocks to aggregate the overall image instance. The core is to use an extremely large mask ratio (75%-90%) as data enhancement. Views 1 and 2 are respectively subjected to ViT for feature extraction to obtain representations representing the global and local, respectively.
[0044] After obtaining the template, global, and local high-level information, the present invention establishes an inter-frame mixed contrast regularization constraint. In order to encourage the feature extractor to extract discriminative features for complex samples, the similarity tendencies between enhanced copies of different samples, within the modality, between modalities, and between positive and negative samples are considered. A good discrimination result should satisfy: the representation distance between the template of the current video and the global perspective frame in the current video < the representation distance between the template of the current video and the local perspective frame in the current video < the representation distance between the template of the current video and the global perspective frame in the non-current video < the representation distance between the template of the current video and the local perspective frame in the non-current video. Therefore, the present invention introduces two levels of contrast loss within different video samples for supervised representation learning, and the loss function in the positive sample is as follows:
[0045]
[0046] The loss inside the negative sample corresponds to:
[0047]
[0048] The constraint between positive and negative samples is
[0049]
[0050] The final loss is a weighted combination of the above loss functions.
[0051] Where dist() is used to measure the difference between two representations, m and n are used to index the data modality, and i and j are used to index samples within a specific modality. represents the i-th positive sample from modality m, express The data augmented version of is the loss used to ensure that the difference between a positive sample and its enhanced version is smaller than the difference between it and other positive samples, while
[0052] is used to ensure that the difference between positive samples of the same modality is smaller than the difference between positive samples of different modalities. and Also has a similar definition.
[0053] Step 2: Train the tracking model;
[0054] In the first frame of the video sequence, the target to be tracked is manually selected, and the target box is enlarged 4 times and stored as a 3*Hz*Wz picture as the target template, and the image is enlarged 4 times and stored as a 3*Hx*Wx picture as the search area. Then it is input into Patch Embedding 2D Convolution Flatten, and the output result is input into the pre-trained VIT to extract features. The output result is then input into the corner head. The feature vector corresponds to the corresponding position of the picture. The head has two branches to obtain the coordinates of the upper left corner and the lower right corner of the target bounding box, and calculate them to obtain the final result. Finally, the obtained result is compared with the true value, and the linear combination of L1 loss and GIOU is used as the loss function to optimize the model parameters.
[0055] Specifically, the model obtained by the above training is a corner point detection and tracking framework based on Transformer, through which tracking is performed. The corner point detection and tracking framework based on Transformer adopted by the present invention is as follows: Figure 2As shown. First, the image input of the template target and the current query video frame, as well as the category information, are obtained. Next, the input information is divided into a series of fixed-size patches, and each patch is flattened into a vector, which is passed to the ViT model as input tokens. After the input representation, ViT uses an embedding layer to project each patch vector into a higher-dimensional feature space. This embedding layer can learn to map the patch vector to a richer feature representation. Since the ViT model consists of multiple Transformer encoders, each Transformer encoder consists of multiple self-attention layers. The self-attention layer allows the model to consider the contextual information of all other patches when processing each patch, thereby capturing the global relationship between the query target and the template target. The feedforward neural network is responsible for local transformation and representation of the features of each patch. Then, after sufficient feature fusion by ViT, it is sent to the target detector.
[0056] To achieve end-to-end target tracking, the present invention uses a corner detector (CornerNet) to regress and predict the output features of ViT. It directly predicts the center point and bounding box of the target without using the traditional anchor or proposal generation process. This makes CornerNet have a simpler and more efficient design, and can improve the detection speed while maintaining accuracy. Specifically, the present invention uses a center-bounding box head to predict the center point and bounding box of the target. The prediction head includes two branches: one for predicting a heatmap of the center point, and the other for predicting the offset of the bounding box. The heatmap of the center point indicates whether there is a target center point at each pixel in the image, and the offset of the bounding box is used to correct the center point position and predict the size of the bounding box.
[0057] The present invention uses the following data sets in training, including COCO, TrackingNet, LaSOT, ImageNet1k and GOT-10k data sets. For video data sets (TrackingNet, LaSOT and GOT-10k), the present invention directly samples image pairs from a video sequence to collect training samples. For the COCO detection data set, the present invention performs some transformations on the original image to generate image pairs. Common data enhancement methods (such as translation and brightness jitter) are used to expand the training set. The sizes of the search area block and the template block are 256×256 and 128×128, respectively. The backbone network parameters of the model are initialized with VIT pre-trained by ImageNet1k, and the other parameters of the model of the present invention are initialized with Xavier. The present invention uses the AdamW optimizer to train the model, sets the learning rate of the backbone network to 1e-5, the learning rate of other parameters to 1e-4, and the weight decay to 1e-4. The present invention trains the network on two Nvidia Titan RTX GPUs with a batch size of 38, a total of 1000 cycles, and 1000 iterations per cycle. After 500 epochs, the learning rate is decreased by a factor of 10.
[0058] LaSOT is a large-scale dataset with high-quality annotations, containing 1400 challenging videos: 1120 for training and 280 for testing. We use a one-shot evaluation (success rate and accuracy) to compare the performance of different tracking algorithms on the LaSOT test set.
[0059] TrackingNet1k is a large-scale tracking dataset covering a wide variety of object categories and scenes. Its test set contains 511 sequences with publicly available ground-truth annotations.
[0060] The GOT-10k dataset contains 10,000 sequences for training and 180 sequences for testing.
[0061] GOT Trackingnet LaSOT LaSOText 63.2 77.4 62.4 44.2 62.8 76.6 61.5 42.9
[0062] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A visual target tracking method based on mask contrast learning pre-training, characterized in that: The specific steps of the visual target tracking method based on mask contrast learning pre-training are as follows: Step 1: obtain the input image and category information of the template target and the current query video frame, divide the input image into tiles of a fixed size, and flatten each tile into a tile vector; Step 2: Input the tile vector into tokens and pass it to the ViT model; Step 3: The ViT model captures the global relationship between the query target and the template target based on the contextual information of the current tile vector and all other tile vectors, and projects each tile vector into a higher-dimensional feature space through an embedding layer; Step 4: The feedforward neural network of the ViT model performs local transformation and representation on the features of each tile vector; Step 5: The ViT model fuses and outputs the global features and local features, and the fused features are input into the target detector; Step 6: The target detector regresses and predicts the fused features, wherein the prediction includes predicting the center point and bounding box of the target.
2. The visual target tracking method based on mask contrast learning pre-training according to claim 1, characterized in that: The ViT model consists of multiple Transformer encoders, each of which consists of multiple self-attention layers.
3. The visual target tracking method based on mask contrast learning pre-training according to claim 1, characterized in that: In step 5, the center point and bounding box of the target are predicted by a center-bounding box prediction head, wherein the prediction head includes two branches, one branch is used to predict a heat map of the center point, and the other branch is used to predict an offset of the bounding box.
4. The visual target tracking method based on mask contrast learning pre-training according to claim 1, characterized in that: The loss of the ViT model includes the cross entropy loss for center point prediction and the smooth L1 loss for bounding box prediction.
5. The visual target tracking method based on mask contrast learning pre-training according to claim 1, characterized in that: The pre-training is pre-training the ViT model, including: The template image is fixed and its features are represented by the encoder of the ViT model; The representation information representing the template target is obtained through nonlinear enhancement of the project model; Randomly extract video frames from the current video and divide the video frames into two perspectives, where the first perspective is the global perspective, which contains all the information of the current image; the second perspective is the mask perspective, which only contains the local information of the current image; Self-attention blocks are used to represent spatially distributed markers, and cross-attention blocks are used to aggregate overall image instances. The first and second perspectives are respectively subjected to the ViT model for feature extraction to obtain representations representing the global and local, respectively.
6. The method for visual target tracking based on mask contrast learning pre-training according to claim 5, characterized in that: A 75%-90% mask ratio was used for data augmentation.
7. The method for visual target tracking based on mask contrast learning pre-training according to claim 5, characterized in that: The loss function of the positive sample is as follows: The loss function of negative samples is as follows: The constraints between positive and negative samples are as follows: The loss is a weighted combination of the above loss functions; Where dist() is used to measure the difference between two representations, m and n are used to index the data modality, and i and j are used to index samples within a specific modality. represents the i-th positive sample from modality m, express The data augmented version of is the loss used to ensure that the difference between a positive sample and its enhanced version is less than the difference between the positive sample and itself, while It is used to ensure that the difference between positive samples of the same modality is smaller than the difference between positive samples of different modalities. and Also has a similar definition.
8. The method for visual target tracking based on mask contrast learning pre-training according to claim 7, characterized in that: The model is trained with the AdamW optimizer, with the learning rate of the backbone network set to 1e-5, the learning rate of the parameters set to 1e-4, and the weight decay set to 1e-4. The network is trained on two Nvidia Titan RTX GPUs with a batch size of 38 for a total of 1000 epochs, 1000 iterations per epoch, and the learning rate is dropped by a factor of 10 after 500 epochs.
Citation Information
Patent Citations
Vision-based target tracking method and system in intelligent network connection bus scene
CN113724293A
Image recognition method and system based on staggered contrast learning and dynamic parameter updating
CN114882277A
Vehicle small target detection method and device based on lightweight network design
CN118038379A
A method for training a convolutional neural network for image recognition using image-conditioned masked language modeling
US20210312628A1
Cited By
Video action classification method based on segmented comparison mask auto-encoder
CN119131664A
Video anomaly detection method, and pre-training method and system of feature extractor
CN119600516A
Video anomaly detection method, pre-training method and system of feature extractor
CN119600516B
ViT time sequence-positioning enhancement-based power target equipment visual segmentation method
CN119672039A
Long-term single target tracking method, system and equipment based on sequence modeling reinforcement learning
CN119762537A
