Target tracking method and device, system and medium based on multi-focus section template relay
By using a multi-focal length template relay method, the target template data is dynamically selected and spatially corrected, which solves the tracking instability problem caused by scale changes and rotational deviations in the existing technology, and realizes continuous and stable tracking in different flight scenarios.
Patent Information
- Application Number
- CN202611514417.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-28
- Publication Date
- 2026-11-24
AI Technical Summary
Existing target tracking technologies suffer from degradation in matching response when scale changes drastically. Multi-scale sensing methods are computationally intensive and cannot run in real time. After the target rotates, the matching score decreases and the directional deviation cannot be propagated, resulting in unstable tracking.
A multi-focal-length template relay method is adopted to acquire multiple template data under different image acquisition parameters. The target template data is dynamically selected based on the scale information of the current tracking area, and spatial correction is performed using historical accumulated spatial transformation parameters to ensure that the scale change is within the effective range. The switching timing is adaptive to transmit rotational deviation.
It achieves continuous and stable tracking from a few pixels to hundreds of pixels, avoiding tracking failures caused by template matching response degradation and orientation deviation, adapting to scale changes in different flight scenarios, and improving tracking stability and real-time performance.
Smart Images

Figure CN123160618A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of target tracking technology, specifically to a target tracking method, apparatus, system, and storage medium based on multi-focal length template relay. Background Technology
[0002] Currently, target tracking is widely used in fields such as UAV reconnaissance, missile guidance, and security surveillance. As optical systems fly closer to the target, the target pixel size increases from a few pixels to hundreds of pixels, a scale span of two orders of magnitude. At the same time, aircraft maneuvers may cause significant rotation of the target on the image plane, making tracking more difficult.
[0003] In related technologies, twin network trackers use the appearance of the target in the initial frame as a template to match and locate it in the search area of subsequent frames; feature point matching methods complete image registration by extracting scale-invariant feature points and estimating the homography matrix; multi-scale perception tracking methods learn multi-scale representations of the target online to adapt to scale changes; some engineering systems first annotate the zoom sequence offline and then track it online, and the propagation of cross-focal length annotation boxes depends on manual or geometric scaling.
[0004] In the process of implementing the embodiments of this application, at least the following problems were found in the related technology: Fixed template tracking suffers from degraded matching response when scales change drastically, while multi-scale sensing methods are computationally intensive and difficult to run in real time on embedded platforms. The switching timing depends on preset fixed conditions and cannot adapt to changes in the actual imaging state of the target. The matching score decreases after the target rotates, and the orientation deviation cannot be passed to the new template during template updates. As a result, it is difficult to address the shortcomings of large scale span, inflexible switching, and cumulative rotation deviation in a single framework. Summary of the Invention
[0005] This application provides a target tracking method and apparatus based on multi-focal length template relay, a target tracking system based on multi-focal length template relay, and a storage medium.
[0006] The first aspect of this application provides a target tracking method based on multi-focal length template relay, comprising: acquiring multiple template data corresponding to different image acquisition parameters, each template data including reference region indication information and corresponding reference scale information; during target tracking, selecting target template data matching the current scale from the multiple template data according to the scale information of the current tracking area, and dynamically changing the selected target template data as the scale of the current tracking area changes; acquiring historical cumulative spatial transformation parameters, and using the historical cumulative spatial transformation parameters to spatially correct the reference region indication information and template image in the newly selected target template data each time the selected target template data is changed, and initializing the tracker with the corrected template data for subsequent tracking.
[0007] A second aspect of the present application provides a target tracking device based on multi-focal length template relay, including a processor and a memory storing program instructions. The processor is configured to execute the target tracking method based on multi-focal length template relay as described in the first aspect of the present application when running the program instructions.
[0008] A third aspect of the present application provides a target tracking system based on multi-focal length template relay, comprising: a target tracking system body based on multi-focal length template relay; and a target tracking device based on multi-focal length template relay as described in the second aspect of the present application, which is installed on the target tracking system body based on multi-focal length template relay.
[0009] A fourth aspect of the embodiments of this application provides a computer-readable storage medium storing program instructions, which, when executed, cause a computer to perform a target tracking method based on multi-focal length template relay as described in the first aspect of the embodiments of this application.
[0010] The target tracking method and apparatus based on multi-focal length template relay, the target tracking system based on multi-focal length template relay, and the storage medium provided in the embodiments of this application have the following beneficial effects: This application embodiment acquires multiple template data under different image acquisition parameters and selects and dynamically changes the matching template data in real time based on the scale information of the current tracking area during the tracking process. This limits the scale change before and after each switch to within the range that the basic tracker can effectively respond to, thereby achieving continuous and stable tracking from a few pixels to hundreds of pixels within a single tracking framework. This avoids template matching response degradation caused by extreme scale changes. By selecting target template data based on the scale information of the current tracking area, the switching timing is entirely driven by the actual imaging scale of the target in the current image, without relying on preset fixed conditions or prior parameters. This allows for adaptation to the scale change rate under different flight scenarios, eliminating the mismatch risk caused by fixed-timing switching. By acquiring historical accumulated spatial transformation parameters and performing spatial correction on the new template data each time the template is switched, the directional deviation caused by historical rotation can be completely transmitted to the new template and corrected at once during the template switching process. This avoids the defect of tracking failure due to the inability to transmit directional deviation, resulting in the new template being inconsistent with the current scene direction after switching. Attached Figure Description
[0011] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1This is a schematic diagram of a target tracking method based on multi-focal length template relay provided in an embodiment of this application; Figure 2 This is a schematic diagram of another target tracking method based on multi-focal length template relay provided in an embodiment of this application; Figure 3 This is a schematic diagram of a target tracking device based on multi-focal length template relay provided in an embodiment of this application.
[0012] Figure label: 800: Target tracking device based on multi-focal length template relay; 801: Processor; 802: Memory; 803: Communication interface; 804: Bus. Detailed Implementation
[0013] To make the technical solutions and advantages of the embodiments of this application clearer, the exemplary embodiments of this application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not an exhaustive list of all embodiments. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.
[0014] This application proposes a target tracking system based on multi-focal-length template relay, including a target tracking system body and a target tracking device 800 based on multi-focal-length template relay. The target tracking system body includes an image acquisition unit, a tracker unit, a template storage unit, and a spatial transformation parameter storage unit. The image acquisition unit acquires multiple frames of images under different image acquisition parameters and provides them to the system for subsequent processing. The tracker unit performs template matching and target localization during target tracking. The template storage unit stores multiple template data corresponding to different image acquisition parameters. The spatial transformation parameter storage unit stores historically accumulated spatial transformation parameters. The target tracking device 800 based on multi-focal-length template relay is installed within the target tracking system body. The installation relationship described herein is not limited to placement within the target tracking system, but also includes installation connections with other components of the target tracking system, including but not limited to physical connections, electrical connections, or signal transmission connections. Those skilled in the art will understand that the target tracking device 800 based on multi-focal length template relay can be adapted to a feasible target tracking system based on multi-focal length template relay, thereby realizing other feasible embodiments. The target tracking device 800 based on multi-focal length template relay also includes a processor 801, which is electrically connected to the template data acquisition module, the target template data selection and modification module, the historical accumulated spatial transformation parameter storage module, and the spatial correction and tracker initialization module, respectively, for controlling the above modules to perform corresponding actions.
[0015] Figure 1 and Figure 2 This is a schematic diagram of the target tracking method based on multi-focal length template relay provided in the embodiments of this application. Any of the following methods can be executed in the target tracking system based on multi-focal length template relay, or in a server or terminal device that is communicatively connected to the target tracking system based on multi-focal length template relay.
[0016] Based on the structure of the target tracking system based on multi-focal length template relay described above, such as Figure 1 As shown, this application provides a target tracking method based on multi-focal length template relay, including: S01, acquire multiple template data corresponding to different image acquisition parameters, each template data includes reference area indication information and corresponding reference scale information.
[0017] S02, During the target tracking process, based on the scale information of the current tracking area, target template data matching the current scale is selected from multiple template data, and the selected target template data is dynamically changed as the scale of the current tracking area changes.
[0018] S03, obtain historical cumulative spatial transformation parameters, and use the historical cumulative spatial transformation parameters to perform spatial correction on the reference area indication information and template image in the newly selected target template data each time the selected target template data is changed, and use the corrected template data to initialize the tracker for subsequent tracking.
[0019] In this embodiment, the image acquisition parameter is the field of view angle. Dynamically changing the selected target template data only allows unidirectional switching from a larger field of view angle to a smaller one. The template data acquisition module acquires multiple template data corresponding to different image acquisition parameters and stores them in the template storage unit. Each template data corresponds to a specific image acquisition parameter, and the template data includes reference area indication information and corresponding reference scale information. The reference area indication information indicates the position and extent of the image region where the target is located under the given image acquisition parameters, represented as an axis-aligned circumscribed rectangle, including the upper left x-coordinate, upper left y-coordinate, width, and height of the rectangle in the image coordinate system. The reference scale information quantifies the size of the region indicated by the reference area indication information, including width and height values in pixels.
[0020] In this embodiment, during target tracking, the target template data selection and modification module selects target template data matching the current scale from multiple template data stored in the template storage unit based on the scale information of the current tracking area. The scale information of the current tracking area reflects the actual pixel size of the target in the current frame image, which gradually increases as the optical system flies closer. The historical accumulated spatial transformation parameter storage module acquires and stores historical accumulated spatial transformation parameters. These parameters record the cumulative amount of spatial transformation of the image caused by target rotation or other reasons since the last template switch or system initialization, represented in the form of a 3×3 homography matrix, with the initial value of the homography matrix being the identity matrix. Each time the selected target template data is changed, the spatial correction and tracker initialization module uses the historical accumulated spatial transformation parameters stored in the historical accumulated spatial transformation parameter storage module to perform spatial correction on the reference area indication information and template image in the newly selected target template data.
[0021] The target tracking method based on multi-focal-length template relay provided in this application acquires multiple template data under different image acquisition parameters and dynamically switches to the most matching template according to the change of the current target scale during the tracking process. This decomposes the entire change process of the target from extremely small scale to extremely large scale into multiple small-step transitions, each of which is within the effective response range of the base tracker. This achieves continuous tracking across extreme scale ranges within a single frame, effectively avoiding matching response degradation caused by excessive scale changes. The switching timing is determined by real-time comparison between the actual pixel scale of the current predicted bounding box and the scale of the pre-stored reference bounding box. This ensures that the switching decision is entirely driven by the target's true imaging state in the current image, without relying on external prior information such as flight speed or zoom rate. It can adaptively trigger switching in different flight scenarios, eliminating the problem of premature or late switching that may occur with fixed-timing switching. By maintaining historically accumulated spatial transformation parameters and performing one-time spatial correction on the new template data and reference area indication information during template switching, the directional deviation accumulated by rotation can be completely transmitted across templates. This ensures that the new template is consistent with the current scene direction during initialization, avoiding tracking failure due to inconsistency in direction.
[0022] Optionally, acquiring multiple template data corresponding to different image acquisition parameters includes: acquiring multiple frames of images under different image acquisition parameters and the first region indication information of the initial frame; determining the correspondence between local features between adjacent frames, and calculating spatial mapping parameters based on the correspondence; and sequentially transmitting the first region indication information to each adjacent frame according to the spatial mapping parameters to generate reference region indication information and corresponding reference scale information for each frame.
[0023] In this embodiment, the template data acquisition module acquires multiple frames of images under different image acquisition parameters and the first region indication information of the initial frame. The multiple frames include N images acquired sequentially from the maximum field of view to the minimum field of view. The initial frame is selected as the image with the largest field of view, i.e., the frame with the smallest target pixel size. A bounding box is marked on the initial frame to indicate the target's location; the coordinate information of this bounding box serves as the first region indication information. The template data acquisition module determines the local feature correspondence between adjacent frames. This correspondence is determined by extracting local feature points and descriptors from each frame and performing descriptor matching between adjacent frames. Based on this correspondence, spatial mapping parameters are calculated. The spatial mapping parameters characterize the geometric transformation relationship of pixel coordinates between two adjacent frames.
[0024] In this embodiment, the template data acquisition module projects the region indication information of the current frame onto the next frame according to the spatial mapping parameters to obtain the region indication information of the next frame. Then, using this next frame as the new current frame, the projection operation is repeated frame by frame along the image sequence, ultimately generating the reference region indication information and corresponding reference scale information for each frame. This method only requires manual annotation of the target bounding box for a single focal length to automatically obtain the bounding boxes for all focal lengths, replacing the tedious manual frame-by-frame annotation. Furthermore, based on actual image feature matching rather than geometric linear interpolation, it can adapt to optical distortion and parallax shift during zooming, resulting in higher propagation accuracy.
[0025] In this embodiment, the spatial mapping parameter is a 3×3 homography matrix. The template data acquisition module uses a random sampling consensus algorithm to estimate the homography matrix based on reliable matching point pairs. The 3×3 homography matrix has 8 degrees of freedom, requiring at least 4 non-collinear matching point pairs for estimation. The random sampling consensus algorithm calculates candidate homography matrices by repeatedly randomly sampling the minimum sample set, then counts the number of matching point pairs that satisfy the candidate matrix (i.e., the number of inliers), and selects the candidate matrix with the largest number of inliers as the final estimated homography matrix. This effectively eliminates outliers (i.e., erroneous matches) from the matching point pairs. Reliable matching point pairs refer to the matching point pairs retained after bidirectional feature matching. The template data acquisition module extracts the feature point set and descriptor set for each adjacent frame image, searches for the most similar match in the descriptor set of the next frame for each descriptor of the previous frame, and simultaneously performs a reverse search in the descriptor set of the previous frame for each descriptor of the next frame, retaining matching pairs with consistent bidirectional search results as the matching point pair set. Bidirectional matching can effectively filter out erroneous correspondences that may occur in unidirectional matching.
[0026] In this embodiment, during the process of the template data acquisition module sequentially transmitting the first region indication information to each adjacent frame according to the spatial mapping parameters, for each pair of adjacent frames, the four corner points of the first region indication information of the current frame are multiplied by the homography matrix from the current frame to the adjacent frame to obtain the coordinates of the four projected corner points in the image coordinate system of the adjacent frames. The minimum and maximum values of the row coordinates and column coordinates of the four projected corner points are taken, and an outer horizontal rectangle is constructed with the minimum row coordinates and minimum column coordinates as the upper left corner point and the maximum row coordinates and maximum column coordinates as the lower right corner point as the region indication information of the adjacent frame. The template data acquisition module repeats the above operation for all adjacent frames, propagating sequentially from the initial frame until the last frame in the image sequence is processed, generating the reference region indication information and the corresponding reference scale information for each frame.
[0027] In this way, the manually annotated single focal length target box is automatically propagated to all focal lengths through the homography matrix propagation method, generating a template database covering the entire field of view. This replaces the tedious operation of manual frame-by-frame annotation. At the same time, based on actual image feature matching rather than geometric linear interpolation, it can adapt to optical distortion and parallax shift during zooming, resulting in higher propagation accuracy.
[0028] Optionally, acquiring multiple frames of images under different image acquisition parameters includes: acquiring multiple frames of images sequentially from the maximum field of view to the minimum field of view, with an acquisition step size of a fixed field of view step size, and the number of frames being N, where N is a positive integer.
[0029] In this embodiment, the maximum field of view corresponds to the shortest focal length state of the optical system, where the imaging field of view is the largest and the pixel size of the target in the image is the smallest. The minimum field of view corresponds to the longest focal length state of the optical system, where the imaging field of view is the smallest and the pixel size of the target in the image is the largest. The acquisition sequence from the maximum to the minimum field of view corresponds to the natural change sequence of the optical system's flight from far to near. The image acquisition unit uses a fixed field of view difference as the acquisition step size, for example, acquiring one frame every 5 degrees of field of view. The difference in field of view between adjacent frames is a constant value, and the target scale change amplitude between adjacent frames is basically uniform. The total range of field of view change divided by the fixed step size yields the number of frames N. The smaller the fixed step size, the higher the focal length density in the template library, the smaller the scale difference between adjacent templates, and the lower the difficulty of the tracker adapting during switching. The larger the fixed step size, the lower the focal length density in the template library, the greater the scale difference between adjacent templates, but the computational load of offline preprocessing is correspondingly reduced. The selection of the field of view step size is determined comprehensively based on the zoom range of the actual optical system and the target tracking accuracy requirements. By covering the full range from the maximum to the minimum field of view, the template library ensures that it covers all intermediate states of the target from the minimum pixel size to the maximum pixel size.
[0030] In this way, by acquiring multiple frames of images with a fixed field of view step size, the target scale variation between adjacent frames is basically uniform, which helps to ensure the stability of feature matching between adjacent frames and the estimation accuracy of spatial mapping parameters. At the same time, it ensures that the template library is uniformly covered in the field of view dimension, avoiding template missing or redundancy in certain focal lengths.
[0031] Optionally, determining the correspondence of local features between adjacent frames includes: extracting local feature points and corresponding descriptors of each frame image using a first neural network; and matching the descriptors of adjacent frames using a second neural network to determine a set of matching point pairs.
[0032] In this embodiment, the first neural network is a SuperPoint network, the second neural network is a LightGlue network, and the set of matching point pairs is a reliable set of matching point pairs filtered by bidirectional feature matching. The template data acquisition module inputs each frame of image into the SuperPoint network. This network first downsamples the input image into a high-dimensional feature map through an encoder, and then outputs a feature point location probability map and a descriptor map through two parallel decoder heads. The template data acquisition module selects pixel locations with response values higher than a preset threshold from the feature point location probability map as local feature points, and extracts the descriptor vectors of the corresponding locations from the descriptor map.
[0033] In this embodiment, the template data acquisition module inputs the descriptor sets of two adjacent frames as the source set and target set, respectively, into the LightGlue network. This network enhances the context of the two sets of descriptors through multiple self-attention layers and cross-attention layers, then calculates the similarity matrix between the enhanced source and target descriptors, determines the matching relationship by solving the optimal transmission problem, and outputs a set of bidirectionally verified matching point pairs. The SuperPoint network has a fully convolutional architecture, capable of accepting input images of arbitrary size and outputting dense feature point locations and their corresponding descriptors. Trained in a self-supervised manner, it exhibits good robustness to in-image rotation and scale changes. The LightGlue network is a lightweight local feature matching network with high computational efficiency and good matching accuracy. The first neural network can also employ other deep convolutional networks with local feature extraction capabilities, and the second neural network can also employ other attention-based matching networks, as long as they can extract rotation-invariant and scale-invariant local feature points and their corresponding descriptors from the image and establish reliable matching relationships between adjacent frames.
[0034] In this way, by extracting deep learning feature points and descriptors through the SuperPoint network and then performing efficient feature matching through the LightGlue network, a high-precision set of matching point pairs can still be obtained even when optical distortion and parallax shift exist during zooming, providing a reliable data foundation for the accurate estimation of the homography matrix in the future.
[0035] Optionally, the process of sequentially transmitting the first region indication information to each adjacent frame according to the spatial mapping parameters to generate the reference region indication information and the corresponding reference scale information for each frame includes: projecting the corner points of the first region indication information of the current frame to the adjacent frames through the spatial mapping parameters; taking the circumscribed horizontal rectangle of the projected corner points as the region indication information of the adjacent frames; repeating the above operation for all adjacent frames to generate the reference region indication information and the corresponding reference scale information for each frame.
[0036] In this embodiment, the first region indication information is represented by an axis-aligned circumscribed rectangle. This rectangle has four corner points: the top-left corner, the top-right corner, the bottom-left corner, and the bottom-right corner. Each corner point is represented by its row and column coordinates in the image coordinate system. The template data acquisition module multiplies the coordinates of these four corner points by the homography matrix from the current frame to the adjacent frame, respectively, to obtain the coordinates of the four projected corner points in the image coordinate system of the adjacent frame. Since the homography matrix describes perspective transformation, the quadrilateral enclosed by the four projected corner points is generally no longer an axis-aligned rectangle, but a quadrilateral with a certain rotation or distortion. To be compatible with the axis-aligned horizontal bounding box format used by the tracker, the minimum and maximum values of the row coordinates and column coordinates of the four projected corner points are taken. The minimum row and column coordinates are used as the top-left corner point, and the maximum row and column coordinates are used as the bottom-right corner point to construct a circumscribed horizontal rectangle. This circumscribed horizontal rectangle is the region indication information of the adjacent frame.
[0037] In this embodiment, the template data acquisition module repeats the above operation for all adjacent frames, propagating sequentially from the initial frame until the last frame in the image sequence has been processed. For the region indication information of already generated adjacent frames, this region indication information is used as the first region indication information of the current frame in subsequent propagation steps to continue propagating to the next frame. That is, starting from the first region indication information of the initial frame, the region indication information of the second frame is obtained through the first projection. Then, using the four corner points of the region indication information of the second frame as starting points, the region indication information of the third frame is obtained through homography matrix projection from the second frame to the third frame, and so on until the last frame.
[0038] In this way, through the chain propagation of the homography matrix of adjacent frames, the manually marked boxes on the initial frame are projected onto the entire focal length image frame by frame. The region indication information of each frame is generated based on the transformation relationship obtained by matching the actual image features. This can adapt to the nonlinear geometric changes in the zoom process, and the propagation error will not accumulate and amplify along the sequence.
[0039] Optionally, each template data also includes extended area indication information, which is generated by extending the area indicated by the reference area indication information outward by a preset ratio; the area indicated by the extended area indication information is larger than the area indicated by the reference area indication information.
[0040] In this embodiment, the preset ratio is 0.5. During the offline preprocessing stage, the template data acquisition module uses the geometric center of the reference region indication information as a reference, expanding both the width and height of the reference region indication information by 50%. Specifically, the expanded width equals the width of the reference region indication information multiplied by a coefficient of 1.5, and the expanded height equals the height of the reference region indication information multiplied by a coefficient of 1.5. The expanded geometric center coincides with the geometric center of the reference region indication information. The area indicated by the expanded region indication information encompasses a larger range of image content surrounding the reference region, including the contextual scenery around the target.
[0041] In this embodiment, the preset ratio can also be selected according to the target size and background texture richness in the actual application scenario. For example, the preset ratio can be 0.3, 0.5, or 0.8. A larger preset ratio means more background information is contained in the extended area, but it may also introduce too much background noise when the target size is large. A preset ratio of 0.5 can provide sufficient contextual auxiliary information when the target is too small, while avoiding introducing too much background interference when the target size is moderate. After the extended area indication information is generated, it is stored together with the reference area indication information as part of the template data. When the pixel size of the target in the image is too small, the texture information in the reference area is insufficient to support effective template matching, while the contextual background texture contained in the extended area can provide additional auxiliary information for target localization.
[0042] In this way, by storing reference area indication information and extended area indication information in the template data at the same time, the online tracking stage can adaptively select whether to use the target's own area or the extended area including the context background for template initialization based on the target's current actual pixel size. When the target is too small, the background texture is used to assist in positioning, and when the target size is sufficient, the focus is on the target itself to obtain more accurate positioning.
[0043] Optionally, during target tracking, selecting target template data matching the current scale from multiple template data based on the scale information of the current tracking area includes: obtaining the scale value of the prediction box output by the tracker in the current frame, wherein the prediction box includes center coordinates, width, and height; traversing all candidate image acquisition parameters smaller than the image acquisition parameters corresponding to the currently selected target template data; for each candidate image acquisition parameter, comparing the difference between the reference scale value of its corresponding reference region indication information and the scale value of the prediction box; if the difference does not exceed a preset pixel threshold, then selecting the template data corresponding to the candidate image acquisition parameter as the modified target template data.
[0044] In this embodiment, the scale value of the prediction box is the width and height of the prediction box, and the reference scale value is the width and height of the reference area indication information. The difference includes the width difference and the height difference, and the preset pixel threshold is 10 pixels. The target template data selection and modification module obtains the prediction box output by the tracker in the current frame, which includes the center coordinates, width, and height, where the width and height are in pixels. This module traverses all candidate field angles smaller than the field angle corresponding to the currently selected target template data, that is, the values of the candidate field angles are all smaller than the currently active field angle, corresponding to directions with longer focal lengths and larger target imaging sizes.
[0045] In this embodiment, for each candidate field of view, the target template data selection and modification module obtains the reference width and reference height of the reference region indication information in the corresponding template data. It then compares the width and height of the current prediction box with the reference width and reference height of the candidate template data, calculating the absolute values of the width and height differences. If both the absolute values of the width and height differences do not exceed 10 pixels, it is determined that the current target scale is sufficiently close to the reference scale of the candidate template data, and the candidate template data is selected as the modified target template data. The preset pixel threshold can also be adjusted according to the tracker's scale tolerance and image resolution. When the image resolution is high, the preset pixel threshold can be appropriately increased to speed up the switching process; when the image resolution is low, the preset pixel threshold can be appropriately decreased to avoid premature switching. A preset pixel threshold of 10 pixels matches the scale tolerance of the Siamese network tracker.
[0046] In this way, the switching timing is determined by comparing the difference between the actual pixel width and height of the predicted bounding box and the reference width and height of the pre-stored template. The switching decision is driven entirely by the actual imaging scale of the target in the current image, without relying on external prior information such as flight speed and zoom rate. It can adaptively trigger switching in different flight scenarios.
[0047] Optionally, during target tracking, selecting target template data that matches the current scale from multiple template data based on the scale information of the current tracking area also includes forced switching: if no dynamic change has occurred within a consecutive preset number of frames, and the image acquisition parameters corresponding to the currently selected target template data are not the smallest image acquisition parameters, then the selection is forcibly changed to the template data corresponding to the next smaller image acquisition parameters.
[0048] In this embodiment, the preset frame count is 10 frames. The target template data selection and modification module continuously counts the number of frames since the most recent template change during target tracking. If no natural switch based on difference determination occurs for 10 consecutive frames, and the field of view corresponding to the currently selected target template data is not the minimum field of view, the module forcibly changes the selected template data to the one corresponding to the next smaller field of view, i.e., forcibly advancing one step in the direction of increasing target size. The preset frame count for forced switching can also be adjusted according to the zoom rate in the actual flight scenario. When the zoom rate is fast, the preset frame count can be appropriately reduced to avoid target loss due to switching delay; when the zoom rate is slow, the preset frame count can be appropriately increased to fully utilize the tracking capability of the current template. Setting the preset frame count to 10 frames ensures sufficient opportunity for natural switching while avoiding target loss due to excessive waiting time.
[0049] In this way, through the forced switching protection mechanism, it is ensured that even if the natural switching conditions cannot be triggered temporarily due to noise or other interference, the system can still gradually advance the template focal length as the target continues to approach, and will not stay at an excessively large field of view, causing the target size to exceed the effective tracking range of the current template.
[0050] Optionally, before initializing the tracker with the corrected template data, an initialization box type selection is also included. The initialization box type selection includes: obtaining the scale of the reference region indication information corresponding to the target template data; if the scale is less than a preset size threshold, then the extended region indication information in the target template data is selected as the initialization basis; otherwise, the reference region indication information is selected as the initialization basis.
[0051] In this embodiment, the scale is the larger of the width and height, and the preset size threshold is 15 pixels. The extended region indication information is generated by expanding the region indicated by the reference region indication information outward by a preset ratio. The region indicated by the extended region indication information is larger than the region indicated by the reference region indication information. The spatial correction and tracker initialization module obtains the width and height of the reference region indication information corresponding to the target template data, takes the larger of the width and height as the scale value, and determines whether the scale value is less than 15 pixels. If it is less than 15 pixels, the module selects the extended region indication information as the initialization basis; otherwise, it selects the reference region indication information as the initialization basis. The preset size threshold can also be adjusted according to the tracker's requirement for the minimum resolvable size of the target. When the image signal-to-noise ratio is high, the preset size threshold can be appropriately reduced; when the image signal-to-noise ratio is low, the preset size threshold can be appropriately increased. The preset size threshold of 15 pixels is adapted to the requirement of the twin network tracker for the minimum size of the template target.
[0052] In this way, by adaptively selecting the initial bounding box type based on the target pixel size, when the target is too small, the contextual scene in the extended region is used to assist in localization, and when the target size is sufficient, the target bounding box is used directly to obtain more accurate target features, thereby improving the effectiveness of template initialization at different scale stages.
[0053] Optionally, spatial correction of the reference region indication information and template image in the newly selected target template data using historical cumulative spatial transformation parameters includes: determining whether the historical cumulative spatial transformation parameters are an identity matrix; if not an identity matrix, performing a perspective transformation on the template image corresponding to the newly selected target template data, and projecting the corner points of the reference region indication information in the template data through the historical cumulative spatial transformation parameters, taking the bounding rectangle of the projection as the corrected reference region indication information; using the perspective-transformed template image and the corrected reference region indication information as the corrected template data; and after completing the spatial correction, resetting the historical cumulative spatial transformation parameters to an identity matrix.
[0054] In this embodiment, the identity matrix is a 3×3 matrix with diagonal elements of 1 and all other elements of 0. The spatial correction and tracker initialization module determines whether the historical accumulated spatial transformation parameters stored in the historical accumulated spatial transformation parameter storage module are an identity matrix, that is, whether all diagonal elements of the matrix are 1 and all off-diagonal elements are 0. If it is an identity matrix, it means that no valid spatial transformation accumulation has occurred since the last template switch or system initialization, and this module does not need to perform correction operations, but directly initializes with the original new template data.
[0055] In this embodiment, if it is not an identity matrix, it indicates that the system has accumulated a certain amount of spatial transformation during previous tracking processes. This module performs perspective transformation on the template image corresponding to the newly selected target template data, using historically accumulated spatial transformation parameters as the transformation matrix, and performs bilinear interpolation remapping on each pixel in the template image. Simultaneously, it projects the four corner points of the reference region indication information in the template data using the historically accumulated spatial transformation parameters, obtaining the coordinates of the four projected corner points. The minimum and maximum values of the row coordinates and column coordinates of the four projected corner points are used to construct an circumscribed horizontal rectangle as the corrected reference region indication information. This module uses the perspective-transformed template image and the corrected reference region indication information together to construct the corrected template data, and uses this to initialize the tracker. After completing spatial correction, this module resets the historically accumulated spatial transformation parameters in the historically accumulated spatial transformation parameter storage module to an identity matrix.
[0056] In this embodiment, the perspective transformation employs bilinear interpolation to remap the template image. Specifically, for each pixel position in the transformed image, its corresponding coordinates in the original image are calculated through an inverse transformation. These corresponding coordinates are typically non-integer positions, and the grayscale value of the transformed pixel is obtained by bilinear interpolation of the grayscale values of the surrounding four integer pixel positions. Bilinear interpolation enables continuous spatial transformation while maintaining image quality.
[0057] In this way, by determining whether the historical cumulative spatial transformation parameters are identity matrices, the need for correction is determined. Perspective transformation and corner projection are only performed when cumulative transformation exists, avoiding unnecessary computational overhead. After correction, the historical cumulative spatial transformation parameters are reset so that subsequent rotational accumulations start from zero, ensuring that the cumulative transformation is fully propagated and compensated.
[0058] Optionally, such as Figure 2 As shown, the subsequent tracking process also includes rotational bottoming repositioning. Rotational bottoming repositioning includes: S21, in response to the tracking confidence being lower than a preset confidence threshold and the existence of a reference frame buffer, extract rotation-invariant feature points and corresponding descriptors from the reference frame image in the reference frame buffer and the current frame image, respectively.
[0059] S22, match the descriptors of the reference frame and the current frame, and filter matching point pairs; estimate the current spatial transformation parameters from the reference frame to the current frame based on the filtered matching point pairs, and determine the number of interior points.
[0060] S23, if the number of interior points is not less than the preset interior point threshold, the reference region indication information buffered in the reference frame is projected onto the current frame through the current spatial transformation parameters to determine the relocation region indication information.
[0061] S24, reinitialize the tracker with relocation area indication information.
[0062] In this embodiment, a tracking confidence score below a preset confidence threshold is defined as a tracker output confidence score below 0.25. Matching the descriptors of the reference frame and the current frame uses a brute-force matcher to perform K-nearest neighbor matching, where K equals 2, and Lowe's ratio test is used to filter mismatches, with a threshold of 0.75. The estimation of the current spatial transformation parameters uses a random sample consensus algorithm, with an inlier distance threshold of 5.0 pixels and a preset inlier threshold of 15. Rotation-invariant feature points are scale-invariant feature transform feature points, and the descriptor is a 128-dimensional scale-invariant feature transform descriptor. When the tracker output tracking confidence score is below 0.25, it indicates that the template matching response map has no obvious peak, and the target location is unreliable. The reference frame cache stores the reference frame image and reference region indication information corresponding to the most recent high-confidence tracking result.
[0063] In this embodiment, the spatial correction and tracker initialization module extracts rotation-invariant feature points and corresponding descriptors from the reference frame image and the current frame image, respectively. A brute-force matcher calculates the Euclidean distance between each descriptor in the reference frame and all descriptors in the current frame, selecting the two closest current frame descriptors as candidate matching pairs for each reference frame descriptor, and then filtering out false matches using Lowe's ratio test. The principle of Lowe's ratio test is that for a feature point in the reference frame, a matching pair is accepted if the ratio of its nearest neighbor distance to its second nearest neighbor distance is less than 0.75. The random sampling consensus algorithm uses the filtered matching point pairs as input, estimates the homography matrix by repeatedly randomly sampling samples, and counts the number of inliers. The inlier distance threshold is 5.0 pixels. When the number of inliers reaches or exceeds 15, the estimated transformation matrix is considered to have sufficient reliability. The spatial correction and tracker initialization module projects the four corner points of the reference region indication information cached in the reference frame onto the current frame using the current spatial transformation parameters, takes the bounding rectangle of the projected region as the relocation region indication information, and reinitializes the tracker with this relocation region indication information.
[0064] In this embodiment, the scale-invariant feature transform algorithm determines the location and scale of feature points by detecting local extrema in scale space, and then constructs a 128-dimensional descriptor vector based on the gradient direction histogram of the region surrounding the feature point. This descriptor achieves invariance to image rotation by performing rotation normalization on the gradient direction. Matching the descriptors of the reference frame and the current frame can also employ a fast nearest neighbor search library or a hash-based approximate nearest neighbor method instead of a brute-force matcher to improve matching speed.
[0065] In this way, rotation-invariant feature matching through scale-invariant feature transformation provides a reliable alternative positioning method when the twin network tracker fails due to rotation, enabling the system to automatically find the target after large-angle maneuvers such as rolling without manual intervention.
[0066] Optionally, after rotational bottom-loop repositioning, the process also includes updating the cumulative spatial transformation parameters. Updating the cumulative spatial transformation parameters involves: superimposing the current spatial transformation parameters with the historical cumulative spatial transformation parameters to update the historical cumulative spatial transformation parameters; the superposition is a right-multiplication matrix superposition, and the updated historical cumulative spatial transformation parameters are the product of the current spatial transformation parameters and the historical cumulative spatial transformation parameters.
[0067] In this embodiment, the current spatial transformation parameter is the 3×3 homography matrix from the reference frame to the current frame estimated during the current rotation-based repositioning, and the historical cumulative spatial transformation parameter is the cumulative 3×3 homography matrix of all historical rotations since the last template switch. The historical cumulative spatial transformation parameter storage module performs a matrix right multiplication and superposition of the current spatial transformation parameter and the historical cumulative spatial transformation parameter to obtain the updated historical cumulative spatial transformation parameter. The physical meaning of this matrix multiplication is to apply the transformation amount from the reference frame to the current frame estimated during the current repositioning to the existing cumulative transformation amount, forming an equivalent total transformation. Through matrix right multiplication and superposition, the spatial transformation amounts generated by multiple rotations are accumulated into the same matrix, which completely records the comprehensive effect of all rotations since the last template switch. The update of the cumulative spatial transformation parameter is performed after each successful rotation-based repositioning. When a subsequent template switch occurs, the historical cumulative spatial transformation parameter already contains the cumulative amount of all previous rotations, and only a one-time perspective transformation needs to be performed on the total transformation represented by the cumulative matrix to complete the compensation for all historical rotations.
[0068] In this way, by accumulating the spatial transformation amount of multiple rotations through matrix right multiplication and superposition, all historical rotation transformations are integrated into a single homography matrix. When switching templates, only one perspective transformation needs to be performed to fully compensate for all historical rotations, avoiding the accumulation of image interpolation blur caused by successive transformations.
[0069] Optionally, during subsequent tracking, if the tracking confidence is not lower than a preset confidence threshold, the reference frame buffer is updated with the current frame image and its corresponding tracking region indication information.
[0070] In this embodiment, the preset confidence threshold is 0.25. When the tracking confidence output by the tracker is not lower than 0.25, it indicates that the tracking result of the current frame is reliable, and the spatial correction and tracker initialization module updates the reference frame cache with the current frame image and its corresponding tracking region indication information. The reference frame cache always stores the image data and target box coordinates of the most recent high-confidence frame. The content stored in the reference frame cache includes the reference frame image data, the tracking region indication information corresponding to the reference frame (i.e., the coordinate position of the target box), and the timestamp or frame number corresponding to that frame. When the tracking confidence decreases in subsequent frames due to rotation or other reasons, the reference frame in this cache serves as the reference image for relocalization.
[0071] In this embodiment, the spatial correction and tracker initialization module clears the reference frame buffer each time the selected target template data is changed. After template switching, the tracker's template reference has changed to the template image of the new focal length. The reference frame image under the old focal length differs significantly from the current scene in image content and scale, and is no longer suitable as a reference reference for rotational bottoming repositioning. The reference frame buffer is actively cleared each time the template is switched. After the tracker runs stably and the confidence level recovers to above the threshold, the reference frame buffer is refilled by subsequent high-confidence frames. The reference frame buffer can also be set with a maximum storage capacity. When the buffer is full and a new high-confidence frame needs to be updated, the oldest buffer content is evicted according to the first-in, first-out principle to control storage overhead.
[0072] In this way, by clearing the reference frame buffer when switching templates, the problem of old focal length reference frames erroneously triggering rotational bottoming repositioning during the low confidence phase of the new focal length hot start is avoided, thus ensuring the accuracy of the repositioning mechanism.
[0073] Combination Figure 3 As shown, this application provides a target tracking device 800 based on multi-focal length template relay, including a processor 801 and a memory 802. Optionally, the device may further include a communication interface 803 and a bus 804. The processor 801, communication interface 803, and memory 802 can communicate with each other via the bus 804. The communication interface 803 can be used for information transmission. The processor 801 can call logical instructions in the memory 802 to execute the target tracking method based on multi-focal length template relay described in the above embodiment.
[0074] Furthermore, the logic instructions in the aforementioned memory 802 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0075] The memory 802, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as the program instructions / modules corresponding to the methods in the embodiments of this application. The processor 801 executes functional applications and data processing by running the program instructions / modules stored in the memory 802, that is, it implements the target tracking method based on multi-focal length template relay in the above embodiments.
[0076] The memory 802 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 802 may include high-speed random access memory and may also include non-volatile memory.
[0077] This application provides a computer-readable storage medium storing computer-executable instructions configured to execute the above-described target tracking method based on multi-focal length template relay.
[0078] The technical solutions of this application embodiment can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in this application embodiment. The aforementioned storage medium can be a non-transitory storage medium, including: USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, and other media capable of storing program code.
[0079] The foregoing description and accompanying drawings fully illustrate embodiments of this application to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the terminology used in this application is for describing embodiments only and is not intended to limit the claims. As used in the description of embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Similarly, the term “and / or” as used in this application means including one or more of the associated listed items and all possible combinations thereof. Additionally, when used in this application, the term "comprise" and its variations "comprises" and / or "comprising" refer to the presence of stated features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., of the embodiments claimed, if they correspond to the method section of the embodiments claimed, then the relevant parts can be referred to the description of the method section.
[0080] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments claimed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0081] The methods and products (including but not limited to devices and equipment) disclosed in the embodiments herein can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units may be merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to implement this embodiment according to actual needs. In addition, the functional units in the embodiments of this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0082] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description; sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
Claims
1. A target tracking method based on multi-focal length template relay, characterized in that, include: Multiple template data corresponding to different image acquisition parameters are obtained, and each template data includes reference area indication information and corresponding reference scale information; During target tracking, target template data matching the current scale is selected from the multiple template data based on the scale information of the current tracking area, and the selected target template data is dynamically changed as the scale of the current tracking area changes. Historical cumulative spatial transformation parameters are obtained. Each time the selected target template data is changed, the historical cumulative spatial transformation parameters are used to perform spatial correction on the reference area indication information and template image in the newly selected target template data. The tracker is then initialized with the corrected template data for subsequent tracking.
2. The method according to claim 1, characterized in that, The acquisition of multiple template data corresponding to different image acquisition parameters includes: Acquire multiple frames of images under different image acquisition parameters and the first region indication information of the initial frame; Determine the correspondence between local features of adjacent frames, and calculate spatial mapping parameters based on the correspondence; The first region indication information is sequentially transmitted to each adjacent frame according to the spatial mapping parameters, generating reference region indication information and corresponding reference scale information for each frame.
3. The method according to claim 2, characterized in that, The acquisition of multiple frames of images under different image acquisition parameters includes: The multi-frame images are acquired sequentially from the maximum field of view to the minimum field of view, with a fixed field of view step size and N frames, where N is a positive integer.
4. The method according to claim 2, characterized in that, Determining the correspondence of local features between adjacent frames includes: The first neural network is used to extract local feature points and corresponding descriptors of each frame of the image; The descriptors of adjacent frames are matched using a second neural network to determine the set of matching point pairs.
5. The method according to claim 2, characterized in that, The step of sequentially transmitting the first region indication information to each adjacent frame according to the spatial mapping parameters, and generating reference region indication information and corresponding reference scale information for each frame, includes: The corner points of the first region indication information in the current frame are projected to the adjacent frames using the spatial mapping parameters; Take the circumscribed horizontal rectangle of the projected corner point as the region indication information of the adjacent frame; Repeat the above operation for all adjacent frames to generate reference region indication information and corresponding reference scale information for each frame.
6. The method according to any one of claims 1 to 5, characterized in that, In the target tracking process, selecting target template data that matches the current scale from the plurality of template data based on the scale information of the current tracking area includes: Obtain the scale value of the predicted bounding box output by the tracker in the current frame, wherein the predicted bounding box includes center coordinates, width, and height; Iterate through all candidate image acquisition parameters that are smaller than the image acquisition parameters corresponding to the currently selected target template data; For each candidate image, parameters are acquired, and the difference between the reference scale value of its corresponding reference region indication information and the scale value of the prediction box is compared. If the difference does not exceed a preset pixel threshold, then the template data corresponding to the candidate image acquisition parameters is selected as the changed target template data.
7. The method according to any one of claims 1 to 5, characterized in that, The spatial correction of the reference region indication information and template image in the newly selected target template data using the historical cumulative spatial transformation parameters includes: Determine whether the historical cumulative spatial transformation parameters are identity matrices; If it is not an identity matrix, then perform perspective transformation on the template image corresponding to the newly selected target template data, and project the corner points of the reference area indication information in the template data through the historical cumulative spatial transformation parameters, and take the outer rectangle of the projection as the corrected reference area indication information. The corrected template data is the template image after perspective transformation and the corrected reference area indication information. After completing the spatial correction, the historical cumulative spatial transformation parameters are reset to the identity matrix.
8. A target tracking device based on multi-focal length template relay, comprising a processor and a memory storing program instructions, characterized in that, The processor is configured to execute the target tracking method based on multi-focal length template relay as described in any one of claims 1 to 7 when running the program instructions.
9. A target tracking system based on multi-focal length template relay, characterized in that, include: The target tracking system body based on multi-focal length template relay; as well as, The target tracking device based on multi-focal length template relay as described in claim 8 is installed on the target tracking system body based on multi-focal length template relay.
10. A computer-readable storage medium storing program instructions, characterized in that, When the program instructions are executed, they cause the computer to perform the target tracking method based on multi-focal length template relay as described in any one of claims 1 to 7.
