Wildlife single target tracking method based on improved twin network

By improving the Siamese network and combining the gated attention mechanism and context-aware module, the occlusion and background interference problems of wildlife tracking in complex environments are solved, achieving high-precision and efficient animal tracking, which is applicable to both fixed and mobile camera data.

CN119540285BActive Publication Date: 2025-10-10NANJING FORESTRY UNIV
View PDF 3 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing wildlife tracking technologies have difficulty maintaining excellent tracking performance in complex and changing natural environments, especially under occlusion and similar background interference, and traditional methods may cause stress to animals.

Method used

An improved Siamese network is adopted, and a gated attention mechanism and a context-aware module are introduced to handle occlusion and background interference. Target tracking is performed through the contextual semantic information of video frames, and differentiated trajectory acquisition strategies are designed to adapt to fixed and moving camera data.

Benefits of technology

It improves the precision and accuracy of animal tracking, reduces the number of model parameters, is suitable for field hardware deployment, and can maintain efficient tracking performance in complex environments, ensuring data clarity and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119540285B_ABST
    Figure CN119540285B_ABST
Patent Text Reader

Abstract

A wild animal single target tracking method based on an improved twin network, steps comprising: collecting a video sequence of wild animals; selecting an initial frame of the video sequence as a template image, updating the template image with a current frame, and each subsequent frame as a search image of a search branch; using an improved twin network to continuously track the target animal in the image and obtain the tracking positioning box of the animal target in the image. The improved twin network comprises: 1) using SiamBAN as a basic framework, and ResNet50 of SiamBAN is a backbone network of the twin network; 2) a gate attention mechanism module is added after feature extraction of the search branch of the twin network, and the gate attention mechanism comprises three independent convolution layers; 3) the template feature and the search feature are matched through a cross-correlation operation, the most similar target region in the search image is found, and the position of the target in the search image is determined; 4) a context learning module is designed to accurately locate 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 gated attention mechanism and a contextual learning module, and applies the model to a method for tracking single targets of wild animals. Background Art

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

[0003] Wildlife is a 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 crucial for monitoring wildlife, wearing these devices can cause stress to animals, affecting their natural behavior. Therefore, wildlife tracking technologies that combine computer vision and deep learning algorithms are emerging as a new solution.

[0004] Existing technology, such as "A Real-time Wildlife Identification and Tracking Algorithm Based on Attention Mechanism" (publication number CN 116798072 A) (202310772991.4), involves the following steps: using an animal monitoring module on a drone to acquire visible light and infrared thermal images of the monitoring area along a preset route, classifying and identifying the animals using an animal recognition method to form a database, then using an attention mechanism module to coordinate the information in the database to track the locations of the classified animals. Based on this identification and tracking information, statistical reports on wildlife populations and individuals in the monitoring area are generated and uploaded to the terminal. This technology labels images of different wildlife species to form a wildlife feature recognition database, trains samples, and establishes an animal model. These tracking methods involve two stages: detecting wildlife targets and tracking these detected targets. This two-stage process is relatively cumbersome; in addition, complex wildlife scenes, such as obscured and camouflaged backgrounds and small targets, can increase the difficulty of animal tracking.

[0005] Research has found that complex and ever-changing natural environments pose significant challenges to wildlife tracking. This is primarily due to occlusion and overlap between animals, which significantly complicates tracking and can weaken tracking effectiveness. Furthermore, the wild environment is rife with challenging scenarios, and maintaining superior tracking performance under these adverse conditions is a key issue that needs to be addressed. Summary of the Invention

[0006] To solve the above problems, the present invention uses 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] This paper improves the Siamese network for single-target wildlife tracking. Its key technical contributions include: introducing a gated attention mechanism to highlight important features and suppress irrelevant information, generating a feature map rich in attention information. A context-aware module is designed to leverage the contextual semantics of video frames to address issues such as interference from similar backgrounds. This method also incorporates different trajectory acquisition methods for different video data acquisition methods.

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

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

[0010] (2) Selecting the initial frame of the video sequence as the template image; updating the template image with the current frame every m frames, and using each subsequent frame of the video sequence as the 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 Siamese tracking network includes:

[0013] 1) Using the SiamBAN network 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 (up to 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 is added after feature extraction in the search branch of the Siamese 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 consists of 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 weight coefficients for each element in the Value matrix. 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 the weighted feature matrix.

[0027] 2.4) Output 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 value 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) Further accurately locate the animal target through the context learning module. The specific steps include:

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

[0036] 4.1.1) Get the top-left and bottom-right corners of the target box in the template image to obtain the target position information. Set all pixels inside the box to 1 and all pixels outside the box to 0 to obtain 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 Represent the binary category label matrix and multi-scale features of the template image corresponding to the t-th frame search image, respectively, represents the Hadamard product of matrices;

[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) Normalize 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 feature map of the initial prediction 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 based on 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) A gating mechanism is integrated into the feature extraction stage of the search branch. This mechanism dynamically adjusts the attention weight of the search branch based on 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 contextual learning module was developed. During the tracking process, this module can capture and utilize rich contextual information, thereby evaluating the environmental background in real time and guiding 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 model's parameter count is reduced, making it more suitable for actual deployment on field hardware equipment.

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

[0053] Figure 1 Schematic diagram of a wild animal single target tracking method based on an improved Siamese network of the present invention;

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

[0055] FIG3 (a) and FIG3 (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 position prediction of the tracking method of the present invention at different error thresholds;

[0058] Figure 4 Parameter comparison of the tracking method of the present invention;

[0059] Figure 5 This is a diagram showing the tracking results of the tracking method of the present invention in a complex scenario;

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

[0061] Figure 7 The present invention is applied to the animal motion trajectory map drawn by a 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-8 It is an extended application of the tracking method. DETAILED DESCRIPTION

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

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

[0066] (2) Selecting the initial frame of the video sequence as the template image; updating the template image with the current frame every m frames, and using each subsequent frame of the video sequence as the 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 Siamese tracking network includes:

[0069] 1) Using the SiamBAN network 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 (up to 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 gated attention mechanism module is added after feature extraction in the search branch of the twin network. The gated attention mechanism consists of 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 weight coefficients for each element in the Value matrix. 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 the weighted feature matrix.

[0083] 2.4) Output 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 value 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) Further accurately locate the animal target through the context learning module. The specific steps include:

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

[0092] 4.1.1) Get the top-left and bottom-right corners of the target box in the template image to obtain the target position information. Set all pixels inside the box to 1 and all pixels outside the box to 0 to obtain 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 Represent the binary category label matrix and multi-scale features of the template image corresponding to the t-th frame search image, respectively, represents the Hadamard product of matrices;

[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) Normalize 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 feature map of the initial prediction 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 based on 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 experiments were conducted. This invention uses video sequences to track animals, mainly birds and mammals. The bird data comes from a public dataset. https: / / github.com / DroneDetectionThesis / Drone-detection-dataset The mammalian 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 an Intel i9-9900k CPU and an NVIDIA GeForce RTX 2080ti GPU.

[0107] To verify the effectiveness of the proposed improved strategy, including the gate mechanism and the context learning module, we designed a series of ablation experiments on a custom dataset based on the original SiamBAN network framework. The main tests included: (1) whether the gate mechanism was introduced in the feature extraction stage of the baseline network; and (2) whether the context learning module was used.

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

[0109] This paper designs a context-aware framework that integrates the features of the template and search branches, dynamically merging information from the two branches. This reduces computational overhead, improves the model's real-time performance, and achieves optimal tracking results. As shown in Table 1, the addition of the context-aware module improves the success rate and accuracy by 2.9% and 2.6%, respectively, compared to the original SiamBAN. Compared to a method that only embeds the gated attention mechanism, the success rate and accuracy improve 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, allowing the real-time performance of the model of the present invention (Fps reaches 31) to 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 demonstrate 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 the predicted position of different tracking methods 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 4A comparison of the parameters of the proposed method and other twin network tracking methods is shown. The figure shows that the proposed animal tracking method has significant advantages in tracking accuracy and parameter count. This advantage means that the proposed model can consume fewer computing resources during training and deployment, reducing hardware requirements.

[0115] Figure 5 This 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 FIG, for a small fast-moving animal (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 tiger's legs 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 figure, 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 this invention utilizes its high-precision tracking technology to continuously and accurately capture the motion 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 a video, and a two-dimensional panorama is obtained by image stitching technology based on feature matching. The trajectory in the image is mapped to the panorama through spatial transformation, thereby obtaining a panoramic motion trajectory map of the animal in a dynamic background.

[0117] Figure 8The present invention demonstrates its application in behavioral classification. In animal behavior analysis, the network structure of the tracking network of the present invention can integrate a simple classification layer to achieve behavioral recognition of the animal being tracked. While maintaining continuous and accurate tracking of specific individual animals, it can also analyze and identify their behavioral 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 monitoring data are ensured, which is particularly important for animal health monitoring that requires long-term observation. For tracked animals, further analysis of their movement parameters such as cadence, stride, and posture can be used to assess the animal's health status (for example, abnormal cadence or stride may indicate movement disorders or pain; specific posture changes may be closely related to the animal's physiological or psychological state). Combined with sensor technology, it can also monitor the animal's physiological indicators such as body temperature, heart rate, and respiratory rate in real time. These physiological parameters provide a more direct and objective basis for assessing the animal's health status. Individual animal tracking ensures that these physiological data come from the same individual animal, avoiding data confusion or errors.

Claims

1. A wild animal single target tracking method based on improved Siamese network, characterized by the following steps include: (1) Collecting video sequences of wild animals; (2) 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 improved Siamese network structure includes: using the Siamese network SiamBAN as the basic framework, with the ResNet50 in SiamBAN serving as the backbone of the tracking network; adding a gated attention mechanism module after feature extraction in the search branch of the Siamese 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, thereby obtaining 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 at each spatial position, i.e., the attention score; 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 a weighted average operation is performed to generate enhanced features containing attention information. 1.4) Output 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 wildlife single target tracking method based on the improved Siamese network according to claim 1 is characterized in that 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 value 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); 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 wild animal single target tracking method based on the improved twin network according to claim 1 is characterized by The context learning module includes: Template Context Awareness Learning Module (TCE) and 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 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 Represent the binary category label matrix and multi-scale features of the template image corresponding to the t-th frame search image, respectively, represents the Hadamard product of matrices; The output feature map P of the dynamic search context awareness module DSCE s The calculation formula is as follows: P s =softmax(P reg )·F SG Among them, P reg is the feature map of the initial prediction 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 the animal target.

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