Wild animal single target tracking method based on improved twin network

By improving the twin network model, introducing the gate attention mechanism and context learning module, the problem of wildlife tracking in complex environments is solved, and the tracking accuracy and performance are improved, making it suitable for outdoor applications.

CN119540285AActive Publication Date: 2025-02-28NANJING FORESTRY UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411586714.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-28
Estimated Expiration
2044-11-08

AI Technical Summary

Technical Problem

Existing wildlife tracking technology is difficult to effectively deal with occlusion, similar background interference and changes in target size and shape in complex and changeable natural environments, resulting in a decrease in tracking accuracy.

Method used

The improved twin network model is adopted, combining the gate attention mechanism and context learning module, the context semantic information in the video frame is processed, the target feature representation is enhanced, the interference information is suppressed, and a differentiated trajectory acquisition strategy is designed.

Benefits of technology

It improves the accuracy of single-target tracking in wild animals, enhances tracking performance in complex environments, reduces the amount of model parameters, and is suitable for field hardware equipment deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119540285A_ABST
    Figure CN119540285A_ABST
Patent Text Reader

Abstract

The invention discloses a wild animal single target tracking method based on an improved twin network. The method comprises the following steps: collecting a video sequence of a wild animal; selecting an initial frame of the video sequence as a template image, updating the template image by using a current frame, and taking each subsequent frame as a search image of a search branch; and continuously tracking the target animal in the image by adopting an improved twin network, and obtaining a tracking positioning frame of the animal target in the image. The improved twin network comprises the following steps: 1) taking a SiamBAN as a basic framework, wherein ResNet50 of the SiamBAN is a backbone network of the twin network; 2) adding a door attention mechanism module after feature extraction of a search branch of the twin network, wherein a door attention mechanism comprises three independent convolutional layers; 3) matching the template features and the search features through cross-correlation operation, finding the most similar target area in the search image, and determining the position of the target in the search image; and 4) designing a context learning module, and accurately positioning the position of the animal target.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention designs an animal tracking method, in particular, constructs a twin network model based on a gate attention mechanism and a context learning module, and a method for applying the model to single-target tracking of wild animals. Background Art

[0002] Among existing wildlife protection technologies, wildlife tracking is a relatively mature field, which focuses on determining the absolute position of individuals and tracking their movement trajectories and dynamic changes over time.

[0003] Wildlife is the protector of biodiversity, and its health and survival are intrinsically linked to the overall prosperity and stability of the natural world. Traditional wildlife tracking methods use electronic devices to automatically monitor animals. While these technologies are essential for monitoring wildlife, wearing these devices may cause certain stress to the animals, thereby affecting their natural behavior. Therefore, wildlife tracking technology that combines computer vision and deep learning algorithms is gradually becoming a new solution.

[0004] Existing technologies such as "A real-time identification and tracking algorithm for wild animals based on attention mechanism" (202310772991.4) with publication number CN 116798072 A include the following steps: using the animal monitoring module on the drone to obtain visible light images and infrared thermal images of the monitoring area according to the preset route, classifying and identifying the animals through the animal recognition method to form a database, tracking the positions of the classified animals through the attention mechanism module in conjunction with the information in the database, and generating a statistical report on the population information and individual information of wild animals in the monitoring area based on the above-mentioned recognition and tracking information, and uploading it to the terminal. This technology forms a wild animal feature recognition database, training samples, and establishing animal models by labeling pictures of different types of wild animals. These trackings involve two stages: detecting wild animal targets and tracking these detected targets. The two-stage processing procedure is relatively cumbersome; in addition, complex wild scenes, such as occluded and camouflaged backgrounds, and small-sized targets, may increase the difficulty of animal tracking.

[0005] The study found that the complex and ever-changing natural environment poses significant challenges to wildlife tracking, mainly in that occlusion and overlap between animals greatly increase the complexity of tracking, which may weaken the tracking effect. At the same time, the wild environment is full of challenging scenes. How to maintain excellent tracking performance under these adverse conditions is a key issue that needs to be solved urgently. Summary of the invention

[0006] To solve the above problems, the present invention utilizes contextual semantic information in video frames to handle occlusion, interference from similar backgrounds, and objects of different sizes and shapes in different scenes, thereby improving tracking accuracy.

[0007] The present invention improves the twin network to track single wild animal targets. Its technical contributions mainly include: introducing a gated attention mechanism to highlight important features and suppress irrelevant information, which can generate feature maps rich in attention information. Designing a context-aware module to use contextual semantic information in video frames to deal with problems such as interference from similar backgrounds. When applying this method, different trajectory acquisition methods are also designed for different video data collection methods.

[0008] The present invention specifically provides a wild animal single target tracking method based on an improved twin network, the steps comprising:

[0009] (i) Video sequences of wild animals captured by fixed or mobile cameras (mainly drone-mounted cameras);

[0010] (ii) selecting an initial frame of the video sequence as a template image; updating the template image with the current frame every m frames, and using each subsequent frame of the video sequence as a search image of the search branch;

[0011] (3) Using the improved Siamese network as the tracking network to continuously track the target animal in the image and obtain the tracking positioning frame of the animal target in the image;

[0012] The improved twin tracking network includes:

[0013] 1) The SiamBAN network is used as the basic framework. The ResNet50 in SiamBAN is the backbone network of the tracking network. The specific steps include:

[0014] 1.1) The template image z and the search image x pass through the first few layers of ResNet50 (until the Conv3 layer), outputting a lower-resolution feature map that captures the local features of the target;

[0015] 1.2) The image continues to pass through the Conv4 layer, outputting a lower resolution feature map that captures part of the target structure;

[0016] 1.3) Finally, through the Conv5 layer, a feature map with the lowest resolution is output to capture the overall structure of the target;

[0017] 1.4) The multi-layer feature maps output from Conv3, Conv4 and Conv5 layers are concatenated to form the template feature F R and search feature F S ;

[0018] 2) A gated attention mechanism module is added after the feature extraction of the search branch of the twin network (the gated attention mechanism is used to enhance the feature representation of the target animal and ignore irrelevant or interfering features). The gated attention mechanism contains three independent convolutional layers. The specific steps include:

[0019] The search feature F obtained in step 1) S Input to the gate attention mechanism:

[0020] 2.1) Input feature F S First, after three convolutional layers, the weight matrix W of the three convolutional layers Q , W K and W V Used to convert the original feature map to generate the Query matrix, Key matrix and Value matrix. The dimensions of the three matrices and the search feature map F S The dimensions are the same;

[0021] 2.2) Attention weight calculation

[0022] Perform a dot product operation on the query matrix obtained in step 2.1) and the key matrix to calculate the attention weight at each spatial position, that is, the attention score, and obtain the attention score matrix A. The calculation formula is shown in formula (1);

[0023]

[0024] Among them, A is the attention weight matrix, C is the dimension of the Key matrix, Q and K are the Query matrix and Key matrix respectively, and T is the transpose of the matrix;

[0025] 2.3) Weighted calculation

[0026] The attention scores obtained in step 2.2 are used as weighted coefficients for each element in the Value matrix, and a weighted average operation is performed to generate enhanced features containing attention information. The attention score matrix A is multiplied by the Value matrix to obtain a weighted feature matrix.

[0027] 2.4) Output the final features

[0028] Step 2.3) The weighted feature matrix is ​​combined with the original search feature through residual connection to obtain the new search feature F SG ;

[0029] 3) Template feature F R and search feature F SG Through cross-correlation operation, matching is performed to find the most similar target area in the search image and determine the location of the target in the search image. The specific steps are as follows:

[0030] 3.1) Template feature FR Slide on the search image and traverse all positions on the template feature map, so that each position (x, y) of the template feature map corresponds to a search area, (x, y) is the center point of the search area, and for each position (x, y) of the template feature map, calculate the search feature F of the search area SG With template feature F R The calculation formula of the cross-correlation value R is shown in formula (2):

[0031]

[0032] Among them, k = 1, 2, 3 represent the calculation of the cross-correlation values ​​of the output features of the three convolutional layers Conv3, Conv4 and Conv5 respectively, H R and W R They are respectively the template feature maps F R The height and width, F R (x, y) is the value of the template feature map at (x, y); F SG (x+i, y+j) is the value of the search feature map at position (x+i, y+j);

[0033] 3.2) R(x,y) represents the search feature F at position (x,y) SG With template feature F R The maximum cross-correlation value R(x, y) corresponds to the best matching position, that is, the possible position of the animal target in the image, thereby obtaining the initial predicted feature map P reg And the location box bbox.

[0034] 4) Through the context learning module, the location of the animal target is further accurately located. The specific steps include:

[0035] 4.1) Design of Template Context-aware Learning Module (TCE): Figure 1 As shown, combining the template image, template features, and the initial classification and position of the target obtained in step 3, the template feature map is updated. The specific steps are as follows:

[0036] 4.1.1) Get the upper left and lower right corner positions of the target box in the template image, obtain the target position information, set all pixels inside the box to 1, and set all pixels outside the box to 0, and get a binary label image with the same size as the template image.

[0037] 4.1.2) Randomly select half of the label values ​​from the label map. For each selected label value, multiply the binary label matrix with the multi-scale feature map through the Hadamard product to obtain the template feature vector P corresponding to each label. t , the calculation formula is as follows:

[0038]

[0039] Among them, M t and They represent the binary category label matrix and multi-scale features of the template image corresponding to the search image of the t-th frame, represents the Hadamard product of the matrix;

[0040] 4.2) Design of Dynamic Search Context Awareness Module (DSCE): Figure 1 As shown, the multi-scale features of the search branch and the feature map obtained in step 3) are post-processed to generate a more accurate feature representation. The specific steps are as follows:

[0041] 4.2.1) Normalizing the initial prediction results obtained in step 3);

[0042] 4.2.2) Search branch feature F SG Perform matrix multiplication with the normalized result of step 4.2.1) to obtain the new prediction result P s ;

[0043] The calculation formulas for the above two steps are as follows:

[0044] P s =softmax(P reg )·F SG (4)

[0045] Among them, P reg is the initial predicted feature map obtained during the cross-correlation operation, F SG is the search feature;

[0046] 4.2.3) Calculate the search feature F Sw And the predicted result P s The similarity weight between them;

[0047] 4.2.4) Update the prediction results according to the weights;

[0048] 5) P obtained in step 4) t and P s Perform cross-correlation operation and repeat step 3) to obtain the final target position and achieve accurate tracking.

[0049] The beneficial effects of the present invention include:

[0050] (1) The gating mechanism is integrated into the feature extraction stage of the search branch. This mechanism dynamically adjusts the attention weight of the search branch according to the features of the current frame and historical information, dynamically judges and selects important features, enhances the feature representation of the target animal, and ignores irrelevant or interfering features, thereby improving the network's ability to distinguish animal targets in complex backgrounds.

[0051] (2) A new context learning module was developed. During the tracking process, this module can capture and utilize rich context information to evaluate the environmental background in real time and guide the tracking algorithm to modify its strategy to cope with complex environments such as occlusion, interference from similar backgrounds, or changes in the target animal's body shape. At the same time, the number of model parameters is reduced, making the model more suitable for actual deployment on field hardware equipment.

[0052] (3) Given the different sources of video captured by fixed cameras and drones, differentiated trajectory acquisition strategies are designed. In scenes shot by fixed cameras, the animal’s motion trajectory is directly drawn based on the tracking results to ensure the clarity and accuracy of the data. For data collected by drones, key frames are first extracted for two-dimensional scene reconstruction, and then the two-dimensional coordinate data obtained during the tracking process is mapped to the reconstructed scene graph to obtain the animal’s motion trajectory graph in a dynamic background. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 It is a schematic diagram of a wild animal single target tracking method based on an improved twin network of the present invention;

[0054] Figure 2 This is an example picture of the experimental data of the present invention;

[0055] FIG. 3( a ) and FIG. 3( b ) are comparative experimental results of the present invention, wherein:

[0056] FIG3( a ) is a comparison of experimental results of the success rate of the tracking method of the present invention at different overlap thresholds.

[0057] FIG3( b ) is a comparison of experimental results of the accuracy of the tracking method of the present invention in predicting the position under different error thresholds;

[0058] Figure 4 It is a comparison of the parameters of the tracking method of the present invention;

[0059] Figure 5 This is a tracking result diagram of the tracking method of the present invention in a complex scene;

[0060] Figure 6 The present invention is applied to the animal movement trajectory map drawn by a fixed camera;

[0061] Figure 7 The present invention is applied to the animal motion trajectory map drawn by the mobile camera;

[0062] Figure 8 This is a diagram showing the application results of the tracking method of the present invention in animal behavior classification.

[0063] Figures 3 to 5 are experiments. Figures 6 to 8 It is an extended application of the tracking method. DETAILED DESCRIPTION

[0064] The present invention provides Figure 1 The figure shows a method for tracking a single target of wild animals based on an improved Siamese network. A gate attention mechanism and a context learning module are designed. The specific steps include:

[0065] (i) Video sequences of wild animals captured by fixed or mobile cameras (mainly drone-mounted cameras);

[0066] (ii) selecting an initial frame of the video sequence as a template image; updating the template image with the current frame every m frames, and using each subsequent frame of the video sequence as a search image of the search branch;

[0067] (3) Using the improved Siamese network as the tracking network to continuously track the target animal in the image and obtain the tracking positioning frame of the animal target in the image;

[0068] The improved twin tracking network includes:

[0069] 1) Adopt the twin network SiamBAN as the basic framework. The ResNet50 in SiamBAN is the backbone network of the tracking network. The specific steps include:

[0070] 1.1) The template image z and the search image x pass through the first few layers of ResNet50 (until the Conv3 layer), outputting a lower-resolution feature map that captures the local features of the target;

[0071] 1.2) The image continues to pass through the Conv4 layer, outputting a lower resolution feature map that captures part of the target structure;

[0072] 1.3) Finally, through the Conv5 layer, a feature map with the lowest resolution is output to capture the overall structure of the target;

[0073] 1.4) The multi-layer feature maps output from Conv3, Conv4 and Conv5 layers are concatenated to form the template feature F R and search feature F S ;

[0074] 2) A gate attention mechanism module is added after the feature extraction of the search branch of the twin network. The gate attention mechanism contains three independent convolutional layers. The specific steps include:

[0075] The search feature F obtained in step 1) S Input to the gate attention mechanism:

[0076] 2.1) Input feature F S First, after three convolutional layers, the weight matrix W of the three convolutional layers Q , W K and W V Used to convert the original feature map to generate the Query matrix, Key matrix and Value matrix. The dimensions of the three matrices and the search feature map F S The dimensions are the same;

[0077] 2.2) Attention weight calculation

[0078] Perform a dot product operation on the query matrix obtained in step 2.1) and the key matrix to calculate the attention weight at each spatial position, that is, the attention score, and obtain the attention score matrix A. The calculation formula is shown in formula (1);

[0079]

[0080] Among them, A is the attention weight matrix, C is the dimension of the Key matrix, Q and K are the Query matrix and Key matrix respectively, and T is the transpose of the matrix;

[0081] 2.3) Weighted calculation

[0082] The attention scores obtained in step 2.2 are used as weighted coefficients for each element in the Value matrix, and a weighted average operation is performed to generate enhanced features containing attention information. The attention score matrix A is multiplied by the Value matrix to obtain a weighted feature matrix.

[0083] 2.4) Output the final features

[0084] Step 2.3) The weighted feature matrix is ​​combined with the original search feature through residual connection to obtain the new search feature F SG ;

[0085] 3) Template feature F R and search feature F SG Through cross-correlation operation, matching is performed to find the most similar target area in the search image and determine the location of the target in the search image. The specific steps are as follows:

[0086] 3.1) Template feature F R Slide on the search image and traverse all positions on the template feature map, so that each position (x, y) of the template feature map corresponds to a search area, (x, y) is the center point of the search area, and the search feature F of the search area is calculated. SG With template feature FR The calculation formula of the cross-correlation value R is shown in formula (2):

[0087]

[0088] Among them, k = 1, 2, 3 represent the calculation of the cross-correlation values ​​of the output features of the three convolutional layers Conv3, Conv4 and Conv5 respectively, H R and W R They are respectively the template feature maps F R The height and width, F R (x, y) is the value of the template feature map at (x, y); F SG (x+i, y+j) is the value of the search feature map at position (x+i, y+j);

[0089] 3.2) R(x,y) represents the search feature F at position (x,y) SG With template feature F R The maximum cross-correlation value R(x, y) corresponds to the best matching position, that is, the possible position of the animal target in the image, thereby obtaining the initial predicted feature map P reg And the location box bbox.

[0090] 4) Through the context learning module, the location of the animal target is further accurately located. The specific steps include:

[0091] 4.1) Design of Template Context-aware Learning Module (TCE): Figure 1 As shown, combining the template image, template features, and the initial classification and position of the target obtained in step 3, the template feature map is updated. The specific steps are as follows:

[0092] 4.1.1) Get the upper left and lower right corner positions of the target box in the template image, obtain the target position information, set all pixels inside the box to 1, and set all pixels outside the box to 0, and get a binary label image with the same size as the template image.

[0093] 4.1.2) Randomly select half of the label values ​​from the label map. For each selected label value, multiply the binary label matrix with the multi-scale feature map through the Hadamard product to obtain the template feature vector P corresponding to each label. t , the calculation formula is as follows:

[0094]

[0095] Among them, M t and They represent the binary category label matrix and multi-scale features of the template image corresponding to the search image of the t-th frame, represents the Hadamard product of the matrix;

[0096] 4.2) Design of Dynamic Search Context Awareness Module (DSCE): Figure 1 As shown, the multi-scale features of the search branch and the feature map obtained in step 3) are post-processed to generate a more accurate feature representation. The specific steps are as follows:

[0097] 4.2.1) Normalizing the initial prediction results obtained in step 3);

[0098] 4.2.2) Search branch feature F SG Perform matrix multiplication with the normalized result of step 4.2.1) to obtain the new prediction result P s ;

[0099] The calculation formulas for the above two steps are as follows:

[0100] P s =softmax(P reg )·F SG (4)

[0101] Among them, P reg is the initial predicted feature map obtained during the cross-correlation operation, F SG is the search feature;

[0102] 4.2.3) Calculate the search feature F SG And the predicted result P s The similarity weight between them;

[0103] 4.2.4) Update the prediction results according to the weights;

[0104] 5) P obtained in step 4) t and P s Perform cross-correlation operation and repeat step 3) to obtain the final target position and achieve accurate tracking.

[0105] In order to verify the performance of the animal tracking method proposed in this invention, a large number of experimental verifications were carried out. This invention uses video sequences to track animals, mainly birds and mammals. The data of birds comes from a public dataset. https: / / github.com / DroneDetectionThesis / Drone-detection-dataset The mammal dataset was collected and recorded by ourselves. Figure 2 Shows example images of the dataset.

[0106] The software program was written in Pytorch framework and trained on a computer equipped with Intel i9-9900k CPU and NVIDIA GeForce RTX 2080ti GPU.

[0107] In order to verify the effectiveness of the improved strategies of the present invention, including the gate mechanism and the context learning module, the present invention designs a series of ablation experiments on a custom dataset based on the original SiamBAN network framework. The main experiments include: (1) whether the gate mechanism is introduced in the feature extraction stage of the benchmark network; (2) whether the context learning module is used.

[0108] The experimental results are shown in Table 1. The introduction of the gated attention mechanism in the search branch improves the success rate by 1.7% and the accuracy by 1.5% compared to the baseline tracking algorithm. However, the accuracy is not improved compared to the original SiamBAN.

[0109] The present invention designs context awareness, integrates the features of the template branch and the search branch, dynamically merges the information of the two branches, reduces the amount of calculation, improves the real-time performance of the model, and obtains the best tracking results. As shown in Table 1, after adding the context awareness module, the success rate and accuracy are increased by 2.9% and 2.6% respectively compared with the original SiamBAN. Compared with the method of embedding only the gate attention mechanism, the success rate and accuracy are increased by 1.2% and 1.1% respectively.

[0110] Although the introduction of the gate mechanism increases the computational complexity of the model to a certain extent (manifested as an increase in Gflops and a decrease in Fps), the subsequent introduction of the contextual learning module effectively reduces the overall computational complexity by optimizing the feature fusion strategy, so that the real-time performance of the model of the present invention (Fps reaches 31) can be maintained at a high level, achieving a good balance between performance and efficiency.

[0111] Table 1 Ablation experiment results

[0112]

[0113] In order to prove the advanced nature of the method proposed in the present invention, the present invention is compared with other advanced tracking methods based on twin networks. As shown in Figure 3(a) and Figure 3(b), Figure 3(a) shows the success rate of different tracking methods at different overlap thresholds. Compared with other tracking methods, the success rate (Success) of the tracking method of the present invention reaches 0.688. Figure 3(b) shows the accuracy of different tracking methods in predicting positions at different error thresholds. The accuracy of the tracking method of the present invention is 0.914. It can be seen that compared with other compared tracking methods, the tracking method of the present invention can more accurately lock the animal position and reduce positioning deviation.

[0114] Figure 4The comparison of the parameters of the method of the present invention and other twin network tracking methods is shown. It can be seen from the figure that the animal tracking method of the present invention has obvious advantages in tracking accuracy and parameter quantity. This advantage means that the model of the present invention can occupy less computing resources during training and deployment, reducing hardware requirements.

[0115] Figure 5 It is the tracking visualization result of the animal tracking method of the present invention and the optimal comparison method SiamRN in complex scenes. Figure 5 In the example, for small animals moving fast (part a), the tracking method of the present invention generates a more accurate bounding box, ensuring a closer approach to the bird. Figure 5 In the case of occlusion (part c) and camouflaged background (part d), the method of the present invention can more accurately fit the bounding box of the animal's body, even the legs of a tiger occluded by grass. In contrast, SiamRN cannot locate the whole body parts of the animal, such as the antlers of a deer and the legs of a tiger. Figure 5 In the example, under the condition of changing illumination (part c), both tracking algorithms are adaptable. Therefore, the tracking method of the present invention has better generalization ability in different complex environments.

[0116] The method proposed in the present invention utilizes its high-precision tracking technology to continuously and accurately capture the movement trajectory data of a single animal. Figure 6 In the fixed camera shooting scene shown, the animal's movement trajectory is directly drawn based on the tracking results to ensure the intuitiveness and accuracy of the data. Figure 7 The mobile camera shown in the figure shoots video, obtains a two-dimensional panoramic image based on feature matching image stitching technology, and maps the trajectory in the image into the panoramic image through spatial transformation, thereby obtaining a panoramic motion trajectory map of the animal in a dynamic background.

[0117] Figure 8The application of the present invention in behavior classification is demonstrated. In terms of animal behavior analysis, the network structure of the tracking network of the present invention can integrate a simple classification layer to realize the behavior recognition of the animal. While maintaining continuous and accurate tracking of specific individual animals, it is also possible to analyze and identify their behavior patterns in real time. The animal tracking method of the present invention also has application potential in the field of animal health monitoring. By accurately locking and continuously tracking specific individual animals, the continuity and accuracy of the monitoring data are ensured, which is particularly important for animal health monitoring that requires long-term observation. For the tracked animals, further analysis of their movement parameters such as cadence, stride, and posture can be used to assess the health status of the animals (for example, abnormal cadence or stride may indicate movement disorders or pain; specific posture changes may be closely related to the physiological state or psychological state of the animal). Combined with sensor technology, it is also possible to monitor the animal's body temperature, heart rate, respiratory rate and other physiological indicators in real time. These physiological parameters provide a more direct and objective basis for assessing the health status of animals. Individual animal tracking can ensure that these physiological data come from the same individual animal, avoiding data confusion or errors.

Claims

1. A method for tracking a single target of wild animals based on an improved twin network, characterized by the following steps: include: (1) Collecting video sequences of wild animals; (ii) selecting an initial frame of the video sequence as a template image; Every m frames, the template image is updated with the current frame, and each subsequent frame of the video sequence is used as the search image of the search branch; (3) Using the improved Siamese network as the tracking network to continuously track the target animal in the image and obtain the tracking positioning frame of the animal target in the image; The structure of the improved twin network includes: using the twin network SiamBAN as the basic framework, and the ResNet50 in SiamBAN is the backbone network of the tracking network; adding a gate attention mechanism module after the feature extraction of the search branch of the twin network; In the improved SiamBAN: a. The feature maps output by the three convolutional layers Conv3, Conv4 and Conv5 of ResNet50 are used as the multi-scale features of the image, so as to obtain the multi-scale features of the template image and the search image, namely the template feature F R and search feature F S ; b. The execution steps of the gate attention mechanism include: 1.1) Feature extraction and conversion The search feature F S Input to the gate attention mechanism; input F S After being processed by three convolutional layers of the gated attention mechanism, the three matrices of Query, Key, and Value are output respectively; 1.2) Attention weight calculation Perform a dot product operation on the Query matrix obtained in step 1.1) and the Key matrix to calculate the attention weight, i.e., the attention score, at each spatial position; Among them, A is the attention weight matrix, d k is the dimension of the Key matrix, Q and K are the Query matrix and Key matrix respectively, and T is the transpose of the matrix; 1.3) Weighted sum The attention scores obtained in step 1.2) are used as weighted coefficients for each element in the Value matrix, and weighted average operations are performed to generate enhanced features containing attention information; 1.4) Output the final features Step 1.3) The features after attention enhancement and the original features F S Add and fuse to obtain the fused search feature F SG ; c. Cross-correlation operation Template feature F R Slide on the search image and traverse all positions on the template feature map, so that each position (x, y) of the template feature map corresponds to a search area, (x, y) is the center point of the search area, and for each position (x, y) of the template feature map, calculate the search feature F of the search area SG With template feature F R The cross-correlation value of d. Design a contextual learning module to accurately locate the position of animal targets.

2. The method for tracking a single target of a wild animal based on an improved twin network according to claim 1, wherein in the cross-correlation operation, for each position (x, y) of the template feature map, the calculation formula of the cross-correlation value R(x, y) is: in, k=1, 2, 3 represent the calculation of the cross-correlation values ​​of the output features of the three convolutional layers Conv3, Conv4 and Conv5, respectively. R and W R They are respectively the template feature maps F R The height and width, F R (x, y) is the value of the template feature map at (x, y); F SG (x+i, y+j) is the value of the search feature map at position (x+i, y+j); R(x,y) represents the search feature F at position (x,y) SG With template feature F R The maximum cross-correlation value R(x, y) corresponds to the best matching position, that is, the possible position of the animal target in the image, thereby obtaining the initial predicted feature map P reg And the location box bbox.

3. The method for tracking a single target of a wild animal based on an improved twin network according to claim 1, characterized in that The context learning module includes: a template context awareness learning module TCE and a dynamic search context awareness module DSCE. The context learning module is used to evaluate the environmental background in real time during the tracking process and guide the tracking algorithm to correct the tracking and positioning results. TCE enhances the classification and regression features by combining the features of the template branch, while DSCE utilizes the features of the search branch to dynamically adjust the classification and regression features to adapt to the contextual information of different template images.

4. The method for tracking a single target of a wild animal based on an improved twin network according to claim 3, characterized in that The output feature map P of the template context-aware learning module TCE t The calculation formula is as follows: Among them, M t and They represent the binary category label matrix and multi-scale features of the template image corresponding to the search image of the t-th frame, represents the Hadamard product of the matrix; The output feature map P of the dynamic search context-aware module DSCE s The calculation formula is as follows: P s =softmax(P reg )·F SG Among them, P reg is the initial predicted feature map obtained during the cross-correlation operation, F SG is the search feature; The output feature map P of TCE t And the output feature map p of DSCE s Perform cross-correlation operations to obtain positioning results and accurately locate the position of animal targets.

Citation Information

Patent Citations

  • Wild animal real-time identification and tracking algorithm based on attention mechanism

    CN116798072A

  • Twin network target tracking method and system based on convolutional self-attention module

    CN113705588A

  • Twin network single target tracking method and device

    CN116934807A

  • Single target tracking method based on attention mechanism

    CN117576149A

  • Lightweight unmanned aerial vehicle real-time target tracking method based on twin network and attention mechanism

    CN118570254A