An indoor unmanned aerial vehicle target tracking system based on depth vision

By combining visual inertial SLAM, target tracking, and path planning algorithms, a deep vision UAV system has solved the challenges of target tracking accuracy and real-time performance in indoor UAV target tracking systems, enabling UAVs to achieve real-time tracking and obstacle avoidance capabilities in indoor environments.

CN117745765BActive Publication Date: 2026-11-27BEIHANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311858077.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2026-11-27
Estimated Expiration
2043-12-29

AI Technical Summary

Technical Problem

Existing vision-based drone target tracking systems struggle to simultaneously guarantee target tracking accuracy and real-time path planning in indoor environments, and are unable to effectively avoid obstacles or recover lost targets.

Method used

An indoor UAV target tracking system based on depth vision is adopted, which combines visual inertial SLAM algorithm, target tracking algorithm and UAV path planning algorithm. The system acquires UAV pose and environmental map through depth camera and IMU data, tracks target position in real time, and plans flight trajectory. The NanoDet target detection model and ECO-HC target tracker are used for target detection and tracking. Kalman filter is used for state estimation and flight trajectory optimization to achieve obstacle avoidance and target retrieval.

Benefits of technology

It enables real-time tracking and flight following of UAV targets in indoor environments, and has the ability to retrieve targets after they are lost, ensuring tracking accuracy and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117745765B_ABST
    Figure CN117745765B_ABST
Patent Text Reader

Abstract

The application relates to a kind of indoor unmanned aerial vehicle target tracking systems based on depth vision, method includes: visual inertial SLAM algorithm module, for according to the image and IMU raw data of unmanned aerial vehicle on-board camera output, the pose of indoor unmanned aerial vehicle is acquired and the grid map of the environment around unmanned aerial vehicle is established;Target tracking algorithm module is used for according to the RGB image and depth image of unmanned aerial vehicle on-board camera output, specified target is tracked, and the position of tracking target is acquired;Unmanned aerial vehicle path planning algorithm module is used for according to the pose of the unmanned aerial vehicle, grid map and the target position of the tracking target, the flight trajectory for tracking target is planned.The above scheme realizes the target tracking, flight following and loss after finding back of unmanned aerial vehicle in indoor environment without GNSS, and has real-time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to computer technology, and more particularly to an indoor drone target tracking system based on depth vision. Background Technology

[0002] With the advancement of science and technology, the increased computing power of airborne computers and the low cost and portability of visual sensors have led to the widespread application of UAV target tracking technology in various fields, such as aerial photography, traffic monitoring, disaster relief, and military operations. The basic principle of a vision-based UAV target tracking system is to use a visual sensor to obtain a two-dimensional image of the surrounding environment, detect the desired target from the image, and then control the UAV to follow the target while ensuring the distance between them remains within a certain range. This system involves technologies such as target detection, target tracking, and path planning; different combinations of these technologies will produce different tracking effects. Target detection calculates highly accurate bounding boxes, which can be used to accurately calculate the relative position and distance of the target, but its disadvantage is that it requires a large amount of computing power. Conversely, target tracking has lower accuracy but consumes fewer computing resources. In terms of UAV flight control for following targets, vision-based servo control methods are simple and can achieve basic flight tracking, but this method cannot avoid obstacles and is not suitable for confined indoor environments. Path planning-based control methods require prior maps or real-time construction of local maps before path planning, which also increases the required computing resources. Therefore, ensuring both the accuracy and real-time performance of target tracking and path planning simultaneously becomes a major challenge.

[0003] Existing vision-based UAV target tracking systems mainly include fast target tracking methods for quadrotor UAVs and vision-based forward-looking target tracking methods for UAVs. Fast target tracking methods for quadrotor UAVs rely solely on neural networks for target detection and position calculation, resulting in extremely high computational resource consumption and making it difficult to meet real-time requirements on low-cost airborne computing platforms. Vision-based servo control and artificial flow methods for path planning are prone to getting trapped in local optima and cannot address the issue of target tracking loss. Summary of the Invention

[0004] (a) Technical problems to be solved

[0005] To address the shortcomings of existing technologies, this invention provides an indoor drone target tracking system based on depth vision.

[0006] (II) Technical Solution

[0007] To achieve the above objectives, the main technical solutions adopted by the present invention include:

[0008] In a first aspect, embodiments of the present invention provide an indoor unmanned aerial vehicle (UAV) target tracking system based on depth vision, comprising:

[0009] The visual-inertial SLAM algorithm module is used to obtain the drone's pose and build a grid map of the drone's surrounding environment based on the images output by the depth camera on the drone and the raw data from the IMU.

[0010] The target tracking algorithm module is used to visually track a specified target based on the RGB image and depth image output by the depth camera on the UAV, and to obtain the position of the tracked target.

[0011] The UAV path planning algorithm module is used to plan a flight trajectory for tracking the target based on the UAV's pose, grid map, and the target position of the target.

[0012] Among them, the visual inertial SLAM algorithm module, the target tracking algorithm module, and the UAV path planning algorithm module are all information executed in real time by independent threads in the mobile device.

[0013] Optionally, the target tracking algorithm module is specifically used for:

[0014] The image reading unit is used to read the RGB and depth images output by the depth camera on the drone in real time;

[0015] The target detection and tracking unit is used to obtain candidate targets based on the real-time read RGB image and depth image using the NanoDet target detection model, select the tracking target from the candidate targets, and initialize the ECO-HC target tracker based on the tracking target to complete the target tracking;

[0016] The target state estimation unit is used to obtain the absolute position information of the tracked target in the world coordinate system;

[0017] The target detection and tracking unit is also used to calculate the tracking quality of the tracked target after the ECO-HC target tracker initialization is completed; if N continues d If the tracking quality of all frames is less than a preset threshold, then the ECO-HC target tracker is reinitialized. d It is a natural number greater than or equal to 5.

[0018] Optionally, the target detection and tracking unit is specifically used for:

[0019] S01. Using a pre-trained NanoDet object detection model, the NCNN neural network inference framework is used to perform object detection on the RGB image, resulting in multiple detection boxes with specified labels; the color features of each detection box are extracted.

[0020] S02. Compare the color features of each detection box with the features of the desired target in the sample database to obtain the similarity r, and select the box with the highest similarity and a similarity greater than the threshold σ. r The detection bounding box is used as the target bounding box, which is used for the initialization of the ECO-HC target tracker;

[0021] The formula for calculating the similarity r is:

[0022]

[0023] In formula (1), S ij T represents the j-th element of the i-th channel of the color feature matrix corresponding to the detection box. ij Let r represent the j-th element of the i-th channel of the color feature matrix of the desired target in the sample database, with similarity r in the interval [0,1].

[0024] Optionally, the target detection and tracking unit is further configured to:

[0025] When initializing the ECO-HC target tracker, a correlation filter is generated;

[0026] Perform cross-correlation operation between the RGB image and the correlation filter to obtain the position of the target in the current image, the target bounding box r. tg ={x tg ,y tg ,w tg ,h tg}, where x tg and y tg These are the horizontal and vertical pixel coordinates of the top-left corner of the target bounding box, w tg and h tg These are the pixel width and pixel height of the target bounding box, respectively.

[0027] Calculate the target bounding box r tg The color feature is used, and its similarity r is compared with all features in the sample database. The highest similarity is selected as the target tracking quality q. track Target tracking quality q track The calculation formula is:

[0028] q track =max{r1,r2,...,r m} (2)

[0029] In formula (2), m is the number of samples in the sample database; r i This represents the similarity between the color feature of the i-th sample data in the sample database and the color feature of the target bounding box; i = 1,...,m;

[0030] Based on target tracking quality qtrack Complete the sample database update every N a The frame is updated once if the target tracking quality of the current frame is greater than the threshold σ. s If the target box's color feature is added to the sample database, then the sample with the lowest score in the sample database will be replaced.

[0031] The formula for calculating the retained fraction s is:

[0032] In formula (3), r is the similarity between the color feature of each detection box and the feature of the desired target in the sample database, and t c t is the current frame number. f α is the frame number in which the sample first appears. s The time weights of the sample features.

[0033] Optionally, the target state estimation unit is specifically used for:

[0034] S11, Based on the target bounding box r tg And camera parameters, to obtain the relative position between the target and the camera.

[0035] S12, Based on the relative position Based on the pose of the drone, obtain the absolute position observations of the target.

[0036] S13. Based on the target's absolute position observations Target state estimation is performed using a Kalman filter to obtain the filtered target position. and speed

[0037] Optionally, S11 includes: selecting a specified pixel point (u,v) in the target bounding box as the target point p. tg , where u and v are the horizontal and vertical pixel coordinates of the target point in the image, respectively;

[0038] The position of the target in the camera coordinate system is obtained based on the pinhole camera imaging formula. Right now

[0039] In formula (4), f x and f y c is the camera's intrinsic parameter. x and c y is the pixel coordinate offset, and d is the depth of the target pixel;

[0040] Target point p tg When selected for the first time, the selection coordinates are (x...tg +w tg / 2,y+h tg / 3) of the pixels, and in the subsequent target position calculation, the depth d of the target point in the previous frame image is used. last As a priori value, multiple pixels with equal horizontal coordinates are selected within the target bounding box of the current frame image, while the vertical coordinates remain unchanged. The absolute value of the difference between the depth of each point and the prior depth value is calculated, and the pixel with the smallest absolute value that is not greater than a threshold σ is selected. d The pixel is used as the target point of the current frame.

[0041] Optionally, S12 includes: assuming the attitude of the UAV in the world coordinate system is R. wb The absolute position is The camera's attitude in the UAV's body coordinate system is R. bc The location is Combined with the target's position in the camera coordinate system Calculate the target's position in the world coordinate system

[0042]

[0043] S13 includes: using a Kalman filter to estimate the target state, and obtaining the filtered target position based on formulas (6) to (10). and speed

[0044] Specifically, a Kalman filter based on a constant velocity model is used to estimate the target's state, where the state variables are represented as follows:

[0045] x tg,k / k-1 =Ax tg,k-1 (6)

[0046] ∑ tg,k / k-1 =A∑ tg,k-1 A T +BQB T (7)

[0047] K tg,k =∑ tg,k / k-1 C T (C∑ tg,k / k-1 C T +R) -1 (8)

[0048] x tg,k =x tg,k-1 +K tg,k (y tg,k -Cx tg,k-1 (9)

[0049] ∑ tg,k = (1-K) tg,k C)∑ tg,k / k-1 (10)

[0050] Where, x tg,k / k-1 x is the predicted state value. tg,k-1 Let x be the target state value at time k-1. tg,k y is the target state value at time k; tg,k Let ∑ be the target state observation value at time k. tg,k / k-1 Let ∑ be the predicted value of the error covariance. tg,k-1 Let K be the error covariance at time k-1. tg,k The Kalman gain at time k; Let I be the state transition matrix. 3×3 The identity matrix is ​​T = diag(Δt, Δt, Δt), which is a diagonal matrix where Δt is the time interval between two consecutive states. 3×3 It is a zero matrix; B = [T T2] T The noise driving matrix is ​​T2 = diag(0.5Δt). 2 ,0.5Δt 2 ,0.5Δt 2 ) is a diagonal matrix, C = [I 3×3 0 3×3 ] is the measurement matrix; Q is the covariance matrix of the process noise, and R is the covariance matrix of the observation noise.

[0051] Optionally, the UAV path planning algorithm module is specifically used for:

[0052] Based on the drone's pose, grid map, and target location;

[0053] Select the drone's location as the path start point q0, and determine the path end point q according to specific rules. M ;

[0054] Among them, the selection rule for the endpoint of the path is that if the target is within the drone's field of vision, the endpoint will be set at 2.5 to 3.0m on the line connecting the target position to the drone's position.

[0055] If the target is suddenly obscured by an obstacle and the current target position cannot be obtained, and the obscuration time does not exceed 5 seconds, the target position is predicted according to the Kalman filter, and the predicted position is used as the path endpoint.

[0056] If no target is detected, the drone remains hovering.

[0057] Optionally, the UAV path planning algorithm module is specifically used for:

[0058] Start the search from the path starting point q0, find the next node q1, and then search based on q1. Repeat this operation until the path reaches the end point q. M This yields a set of path nodes q = [q0, q1, ..., q M ] T ;

[0059] An initial representation of the UAV trajectory is generated using a piecewise polynomial curve; the piecewise polynomial curve is represented as p tj (t), where the curve contains M segments, the polynomial degree is N, and the curve of the i-th segment is

[0060] In the formula, c i =[c i1 ,c i2 ,…,c iN ] T The coefficients are polynomials, β(t) = [1, t, t] 2 ,…,t N ] T T is a basis of polynomials. pt.i Let be the time of the i-th segment.

[0061] For the initial trajectory p tj (t) is optimized; the trajectory cost, which consists of smoothness constraints, dynamic constraints, safety constraints and visibility constraints, is minimized using the L-BFGS optimization method to obtain the final flight trajectory.

[0062] Optionally, the UAV path planning algorithm module is specifically used for:

[0063] Trajectory cost consists of four parts, specifically:

[0064] In the formula, J s For smoothness constraints, J d For dynamic constraints, J f For safety constraints, J v For the target visibility constraint, λ s , λ d , λ f , λ v These are the weighting coefficients.

[0065] Smoothness constraints are used to ensure that the jerk of the trajectory is not too large, i.e.

[0066]

[0067] In the formula, This represents the jerk of the i-th trajectory segment;

[0068] Dynamic constraints are used to ensure that the velocity and acceleration of the trajectory do not exceed their maximum values, i.e.

[0069]

[0070] In the formula, g(x) = max{x, 0} 3 For the penalty function, and Let v represent the velocity and acceleration of the i-th trajectory segment, respectively. m and a m ρ represents the maximum velocity and maximum acceleration of the trajectory, respectively. v ρ a ρ t As weight;

[0071] Safety constraints are used to ensure that the drone does not collide with obstacles. Before constructing safety constraints, a safe flight corridor needs to be generated based on the grid map. The flight corridor is a set of polyhedra that do not contain obstacles, represented as follows:

[0072]

[0073] In the formula, C i This indicates that it contains two consecutive path nodes q. i-1 and q i The polyhedra, each polyhedron having parameters represented by D and e, i.e.

[0074] C i ={x c ∈R 3 |D i x c ≤e i} (19)

[0075] Based on the safe flight corridor, safety constraints are set to ensure that each trajectory node is within the safe area, and the cost is...

[0076]

[0077] In the formula, 1 is a vector whose elements are all 1, and ln[·] is the logarithm of the elements;

[0078] Target visibility constraints are used to ensure that the tracked target remains within the field of view of the UAV's camera during UAV-following flight. First, a set of target position prediction points p is obtained using a Kalman filter. tg ={p tg,0 ,p tg,1 ,...,p tg,M ] TThen, a target visible sector region is generated for each predicted point. Finally, a polyhedral target visible region represented by F and g is generated based on the sector region, as follows:

[0079] C v ={x d ∈R 3 |Fx d ≤g}

[0080] If the trajectory points are constrained within the visible area of ​​the target, then the cost of the target visibility constraint is:

[0081]

[0082] Based on the position at the corresponding time point in the flight trajectory, a position control command is generated and sent to the UAV flight controller, enabling the UAV to fly to the designated position and achieve real-time tracking and obstacle avoidance of the target.

[0083] (III) Beneficial Effects

[0084] The indoor UAV target tracking system of the present invention enables UAVs to track targets in indoor environments without GNSS (Global Navigation Satellite System). It integrates target detection, target tracking, visual-inertial SLAM and path planning algorithms, ensuring tracking accuracy while providing real-time performance, and has the ability to retrieve the target when it is lost. Attached Figure Description

[0085] Figure 1 This is a schematic diagram of the framework of an indoor unmanned aerial vehicle (UAV) target tracking system provided in an embodiment of the present invention;

[0086] Figure 2 This is a flowchart illustrating the target tracking algorithm module in an embodiment of the present invention;

[0087] Figure 3 This is a schematic diagram of the sample database update process according to an embodiment of the present invention;

[0088] Figure 4 This is a schematic diagram illustrating the calculation process of the target location in an embodiment of the present invention;

[0089] Figure 5 This is a schematic diagram of the drone target following process according to an embodiment of the present invention.

[0090] Figure 6 This is a target visible area diagram according to an embodiment of the present invention. Detailed Implementation

[0091] To better explain and facilitate understanding of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0092] In existing technologies, vision-based UAV target tracking relies on the imaging quality of visual images. High-speed movement of the UAV and changes in the target environment can lead to problems such as image blurring, target deformation, target occlusion, and target loss, thus reducing the success rate of target tracking. Vision-based servo control cannot perform obstacle avoidance and has poor tracking robustness.

[0093] The system in this embodiment is applied to target tracking of UAVs in indoor environments. It first uses the UAV's onboard camera, namely a depth camera and an IMU, to calculate the UAV's pose and build a map of the UAV's surrounding environment. Then, it continuously tracks the target and calculates the target's position. Finally, it plans a flight trajectory for tracking the target. This system enables UAV target tracking, flight following, and recovery after loss in indoor environments and other non-GNSS environments, and it is real-time.

[0094] Example 1

[0095] like Figure 1 As shown, Figure 1 The diagram shows a framework of an indoor UAV target tracking system based on depth vision according to an embodiment of the present invention. The system of the present invention is implemented on a mobile device. The system of this embodiment includes: a visual-inertial SLAM algorithm module, a target tracking algorithm module, and a UAV path planning algorithm module.

[0096] The visual-inertial SLAM algorithm module is used to obtain the drone's pose and build a grid map around the drone based on the images output by the depth camera on the drone and the raw IMU data. For example, the grid map here can be a grid map of a certain range around the drone itself. The grid map size can be 10m×10m×5m, with the drone itself at the center, and the grid map only records the environment around the drone.

[0097] The target tracking algorithm module is used to visually track a specified target based on the RGB image and depth image output by the depth camera on the UAV, and to obtain the position of the tracked target.

[0098] The UAV path planning algorithm module is used to plan a flight trajectory for tracking the target based on the UAV's pose, grid map, and the target position of the target.

[0099] Among them, the visual-inertial SLAM algorithm module, the target tracking algorithm module, and the UAV path planning algorithm module are all information executed in real time by independent threads within the mobile device. That is to say, each module is executed by its own thread, and is updated in real time. The threads do not conflict with each other, and when the calculation of the second thread combines the information of the first thread, it can obtain the latest information executed by the first thread for subsequent calculations.

[0100] The target tracking algorithm module in this embodiment can be specifically used for:

[0101] The image reading unit is used to read the RGB and depth images output by the depth camera on the drone in real time;

[0102] The target detection and tracking unit is used to obtain candidate targets based on the real-time read RGB image and depth image using the NanoDet target detection model, select the tracking target from the candidate targets, and initialize the ECO-HC target tracker based on the tracking target to complete the target tracking;

[0103] The target state estimation unit is used to obtain the absolute position information of the tracked target in the world coordinate system;

[0104] The target detection and tracking unit is also used to calculate the tracking quality of the tracked target after the ECO-HC target tracker initialization is completed; if N continues d Frame (N) d If the tracking quality (greater than or equal to 5) is less than the preset threshold, then the ECO-HC target tracker will be reinitialized.

[0105] The indoor UAV target tracking system based on depth vision in this embodiment integrates target detection, target tracking, visual inertial SLAM and path planning algorithms to achieve target tracking, flight following and retrieval after loss of UAV in indoor and other non-GNSS environments, and it has real-time performance.

[0106] Example 2

[0107] Combination Figures 2 to 6 This invention provides a detailed description of an indoor unmanned aerial vehicle (UAV) target tracking system based on depth vision, according to an embodiment of the present invention. The system in this embodiment is the same as the system described in Embodiment 1, and the processes executed in this embodiment can also be executed in Embodiment 1.

[0108] like Figure 1 As shown, the indoor UAV target tracking system based on depth vision in this embodiment includes: a visual-inertial SLAM algorithm module, a target tracking algorithm module, and a UAV path planning algorithm module.

[0109] The visual-inertial SLAM algorithm module is used to calculate the position and attitude of the UAV in the world coordinate system and simultaneously build a grid map of the surrounding environment.

[0110] The target tracking algorithm module is used to first detect all targets in the RGB image, then find the desired target to track, initialize the tracker, and finally complete the continuous tracking of the desired target, while calculating the target's position in the world coordinate system.

[0111] The UAV path planning module is used to plan a safe and feasible three-dimensional path based on the UAV's pose (pose and attitude), the target's position in the world coordinate system, and the grid map, so as to complete the UAV's real-time following flight of the desired target (i.e., the tracking target).

[0112] Figure 1 The three modules can be composed of three independent threads, and the basic operation process of each thread is described below.

[0113] 1. The thread to which the visual-inertial SLAM algorithm module belongs (i.e., the visual-inertial SLAM algorithm thread) can execute the following procedures:

[0114] (11) Read camera images and IMU raw data and perform data preprocessing;

[0115] (12) The pose of the UAV was calculated using a nonlinear optimization method;

[0116] (13) Create a grid map based on the UAV pose and camera depth images;

[0117] (14) Output the UAV pose and grid map.

[0118] (15) Return to step (11) and repeat this process.

[0119] 2. The thread to which the target tracking algorithm module belongs (i.e., the target tracking algorithm thread) can execute the following procedures:

[0120] (21) Read the input data, including RGB images and depth images;

[0121] (22) Check the tracker's status. If the tracker has not completed initialization, proceed to step [step 1].

[0122] (23), otherwise proceed to step (24);

[0123] (23) Perform target detection. If the desired target is detected, initialize the target tracker and then jump to step (25). If there is no desired target, jump to step (26).

[0124] (24) Run the target tracker to obtain the target's position in the new image and calculate the target tracking quality. If the target tracking quality is less than a certain threshold for several consecutive frames, proceed to step (23); otherwise, continue to step (25).

[0125] (25) Calculate and output the three-dimensional position of the target;

[0126] (26) Return to step (21) and repeat this process.

[0127] 3. The thread to which the UAV path planning algorithm module belongs (i.e., the UAV path planning algorithm thread) can execute the following process:

[0128] (31) Read the input data, including UAV pose, grid map, and target location;

[0129] (32) Determine the destination of the path and the flight status of the UAV based on the target status and whether the target is lost;

[0130] (33) Perform path search and generate path points, and complete the initial trajectory representation based on the path points;

[0131] (34) Set costs and constraints based on the initial trajectory, perform numerical optimization to obtain the final trajectory;

[0132] (35) Execute the flight trajectory and output control commands to the flight controller.

[0133] (36) Return to step (31) and repeat this process.

[0134] Based on the steps implemented by each thread, the functionality of each thread's module is explained in detail.

[0135] Visual Inertial SLAM Algorithm Module

[0136] The Visual Inertial SLAM algorithm module is used to calculate the position and attitude of the UAV in the world coordinate system and simultaneously build a grid map of the UAV's surrounding environment. This module consists of two units: a VINS-Fusion-based visual inertial odometry processing unit and a grid map building unit.

[0137] The VINS-Fusion-based visual inertial odometry processing unit is used to calculate visual inertial odometry using the existing VINS-Fusion algorithm. The input is a binocular RGB image and raw IMU data. The raw data is preprocessed first, then a cost function and constraint terms are constructed, and a nonlinear optimization method is used to solve the problem to obtain the position (i.e., the absolute position of the UAV) and attitude in the world coordinate system.

[0138] The grid map building unit is used to build a grid map of the surrounding environment based on the UAV pose and depth images provided by the depth camera. The grids occupied by obstacles will be appropriately expanded to improve the safety of subsequent UAV path planning.

[0139] Target tracking algorithm module

[0140] like Figure 2 As shown, the target tracking algorithm module is used to track a desired target for an extended period of time while simultaneously estimating the target's state. Specifically, it is used for:

[0141] (1) Read the image data from the depth camera, including RGB images and depth images;

[0142] (2) Check the initialization status of the ECO-HC target tracker. If the ECO-HC target tracker has not been initialized, proceed to step (3); otherwise, proceed to step (4).

[0143] (3) The NanoDet target detection model is used to detect the expected target. If the target is detected, the ECO-HC target tracker is initialized using the expected target box. After successful initialization, the process jumps to step (5). If the expected target is not detected, the process jumps to step (6).

[0144] (4) Execute the ECO-HC target tracker, complete the tracker update, obtain the target's position in the new image, and calculate the target tracking quality. If N consecutive d Frame (N) d If the target tracking quality (greater than or equal to 5) is less than a certain threshold, the target tracker needs to be reinitialized and the process jumps to step (3); otherwise, continue to execute step (5).

[0145] (5) Execute the target state estimation unit to calculate and output the absolute position of the target in the world coordinate system;

[0146] (6) End the current cycle and jump to step (1).

[0147] In practical applications, the target tracking algorithm module may include: a target detection and tracking unit and a target state estimation unit.

[0148] The target detection and tracking unit is specifically used to detect candidate targets in the image and identify the desired target to be tracked. NanoDet is a lightweight target detection model with fast computation speed and high accuracy, making it suitable for mobile devices. In this embodiment, a pre-trained model can be used to perform target detection on the image through the NCNN neural network inference computing framework.

[0149] First, target detection is performed on the RGB image, which may yield one or more bounding boxes, or none. Then, all bounding boxes labeled "human" are selected, and their color features are extracted sequentially. These bounding boxes are then compared for similarity with features in a sample database (which stores the features of the desired target before the program runs). Finally, if the similarity of the most similar bounding box exceeds a threshold σ... r If no detection box exists, it is used as the target box for target tracking initialization. If no detection box exists or no similarity is greater than the threshold σ, then... r If the detection box is not found, the current loop will end prematurely.

[0150] The formula for calculating feature similarity r is:

[0151]

[0152] In the formula, S ij T represents the j-th element of the i-th channel of the color feature matrix corresponding to the detection box. ij This represents the j-th element of the i-th channel of the color feature matrix of the desired target in the sample database. The similarity r is in the range [0,1], and the larger the value, the higher the feature similarity.

[0153] The target detection and tracking unit is also used to track the desired target in a continuous image sequence and calculate the target's position in each image. Specifically, the tracker is initialized using the results of NanoDet target detection. The initialization process uses target detection boxes to generate correlation filters. These filters are used to perform cross-correlation operations with the images to determine the similarity between the images and the desired target. The more similar the image is to the desired target, the greater the response of the image to the correlation filter. Therefore, after initializing and generating the correlation filters, subsequent images can be directly cross-correlated with the correlation filters to obtain the target's position in the new image. After initialization, target detection is no longer required for each frame, effectively reducing computational resources.

[0154] like Figure 3 As shown, for an initialized ECO-HC target tracker, it can be specifically used for:

[0155] The first step is to perform a cross-correlation operation between the RGB image and the correlation filter to obtain the position of the target in the current image, i.e., the target bounding box r. tg ={x tg ,y tg ,w tg ,h tg}, where x tg and y tg These are the horizontal and vertical pixel coordinates of the top-left corner of the rectangle (i.e., the target box), w tg and h tg These are the pixel width and pixel height of the rectangle, respectively.

[0156] The second step is to calculate the target bounding box r. tg The color feature is compared with all features in the sample database, and the highest similarity is selected as the target tracking quality q. track Target tracking quality q track The calculation formula is:

[0157] q track =max{r1,r2,...,r m} (2)

[0158] In the formula, m is the number of samples in the sample database, and q track A larger value indicates higher tracking quality. i This represents the similarity between the color features of the i-th sample data in the sample database and the color features of the target bounding box.

[0159] The third step is to determine the target tracking quality q. track Complete the sample database update every N a (N a An update is performed on frames 5 or more (e.g., 5, 9, 10, etc.). If the target tracking quality of the current frame is greater than the threshold σ, an update is performed. s If the target bounding box's color feature is added to the sample database, then the sample with the lowest retention score in the database is replaced. The formula for calculating the retention score s is:

[0160]

[0161] In the formula, r is the feature similarity mentioned above, and t c t is the current frame number. f σ is the frame number in which the sample first appears. s The time weights of the sample features.

[0162] The target state estimation unit is specifically used to calculate the absolute position of the target in the world coordinate system, and includes:

[0163] The first step is to calculate the relative position between the target and the camera. The input is the target bounding box r from the ECO-HC target tracker. tg Select the specified pixel (u,v) in the target bounding box as the target point p. tg Here, u and v are the horizontal and vertical pixel coordinates of the target point in the image, respectively. Then, the position of the target in the camera coordinate system can be obtained according to the pinhole camera imaging formula. Right now

[0164]

[0165] In the formula, f x and f y c is the camera's intrinsic parameter. x and c y d is the pixel coordinate offset, and d is the depth of the target pixel.

[0166] Target point p tg When selected for the first time, the selection coordinates are (x... tg +w tg / 2,y+h tg / 3) of the pixels, while in the subsequent target position calculation, the target point p tg The selection of is not fixed because deviations in the target tracking results may cause the target point to appear on the background or obstacles. Therefore, the depth d of the target point in the previous frame image is used. last As a priori value, multiple pixels with equal horizontal coordinate intervals are selected within the target bounding box of the current frame image, while the vertical coordinate remains unchanged. Then, the absolute value of the difference between the depth of each point and the prior depth value is calculated, where the absolute value is the smallest and not greater than a threshold σ. d The pixel is used as the target point of the current frame.

[0167] The second step is to calculate the absolute position observations of the target. relative position Combined with the UAV pose given by the SLAM algorithm, the absolute position of the target in the world coordinate system is calculated.

[0168] like Figure 4 The diagram shows the principle of target position calculation. Let the attitude of the UAV in the world coordinate system be R. wb The location is These two variables are provided by the visual-inertial SLAM algorithm module. The camera's attitude in the UAV's body coordinate system is R. bc The location is These two variables represent the camera's assembly position and attitude on the drone, which can be obtained in advance through calibration. Combining the target's position in the camera coordinate system, the target's position in the world coordinate system can be calculated. for

[0169]

[0170] The third step is to use a Kalman filter to estimate the target state. By calculating formulas (6) to (10) in sequence, the filtered target position can be obtained. and speed This invention uses a Kalman filter based on a constant velocity model to estimate the state of the target, where the state variables are represented as follows: The filtered target state can be obtained by calculating the following five fundamental equations of the Kalman filter:

[0171] x tg,k / k-1 =Ax tg,k-1 (6)

[0172] ∑ tg,k / k-1 =AΣ tg,k-1 A T +BQB T (7)

[0173] K tg,k =Σtg,k / k-1 C T (C∑ tg,k / k-1 C T +R) -1 (8)

[0174] x tg,k =x tg,k-1 +K tg,k (y tg,k -Cx tg,k-1 (9)

[0175] ∑ tg,k = (1-K) tg,k C)∑ tg,k / k-1 (10)

[0176] In the formula, x tg,k / k-1 x is the predicted state value. tg,k-1 Let x be the target state value at time k-1. tg,k Let y be the target state value at time k. tg,k For the target state observation value at time k, it is necessary to convert it into the value during the calculation. Substitute into y tg,k . ∑ tg,k / k-1 Let ∑ be the predicted value of the error covariance. tg,k-1 Let K be the error covariance at time k-1. tg,k Let K be the Kalman gain at time k. Let I be the state transition matrix. 3×3 The identity matrix is ​​T = diag(Δt, Δt, Δt), which is a diagonal matrix where Δt is the time interval between two consecutive states. 3×3 It is a zero matrix. B = [T T2] T The noise driving matrix is ​​T2 = diag(0.5Δt). 2 ,0.5Δt 2 ,0.5Δt 2 ) is a diagonal matrix, C = [I 3×3 0 3×3 ] is the measurement matrix. Q is the covariance matrix of the process noise, and R is the covariance matrix of the observation noise.

[0177] UAV path planning algorithm module

[0178] The UAV path planning algorithm module is used to plan a safe and feasible path in a grid map, enabling the UAV to follow the target. The UAV path planning algorithm needs to run in a loop at a rate of 10Hz, and its specific process includes:

[0179] (1) Read the input, including the UAV pose and grid map output by the SLAM algorithm module and the target position output by the target tracking algorithm module;

[0180] (2) Determine the start and end points of the path. Select the drone's location as the path start point q0, and determine the path end point q according to specific rules. M .

[0181] Regarding the path endpoint selection rules, if the target is within the drone's field of vision, the endpoint is set 2.5 to 3.0 meters above the line connecting the target's location to the drone's location; that is, the drone needs to maintain a safe distance of 2.5 to 3.0 meters from the target. If the target is suddenly obscured by an obstacle, making it impossible to determine the target's current location, and the obscuration time does not exceed 5 seconds, the target's location is predicted using a Kalman filter, and this predicted location is used as the path endpoint. If no target is detected, the drone remains hovering. The drone's flight control strategy for following the target is as follows: Figure 5 As shown.

[0182] (3) Use the Hybrid A* algorithm to complete the path search.

[0183] Start the search from the path starting point q0, find the next node q1, and then search based on q1. Repeat this operation until the path reaches the end point q. M Finally, a set of path nodes q = [q0, q1, ..., q] is obtained. M ] T The following section details the methods for path searching.

[0184] First, expand the nodes based on their states. Let the state of the (k-1)th path node be... The control input is u pt,k-1 The unit time for node expansion is ΔT. pt Then, the state of the next node after the expansion is:

[0185]

[0186] Where the control input u pt Uniform discretization is required, u pt It can be divided into three directions according to the coordinate axes, and each direction is divided into... By combining the control inputs from three directions, a node can ultimately expand into... Each node.

[0187] Then calculate the cost of each expansion node, cost f. pt,c From actual cost g pt,c and heuristic cost h pt,c Composition, of which the actual cost g pt,c The sum of the control inputs and time for the generated path, i.e.

[0188]

[0189] In the formula, u pt,i ρ is the control input for the i-th path segment. g T is the time-weighted component of the actual cost. pt This represents the total time for the generated paths.

[0190] And heuristic cost h pt,c Set the current node position p pt,c With the endpoint position p pt,g The distance between them, and the expected time required to traverse the remaining distance, i.e.

[0191]

[0192] In the formula, ρ h The time component weighting is used for heuristic costs.

[0193] Finally, all expansion nodes are stored in the search queue, and the node with the lowest cost is selected as the next search node for expansion, until the expansion node reaches the end of the path.

[0194] (4) Based on the path search, the path nodes q = [q0, q1, ..., q1] are generated. M ] T An initial representation of the UAV's trajectory is generated using a piecewise polynomial curve. The piecewise polynomial curve is represented as p... tj (t), where the curve contains M segments, the polynomial degree is N, and the curve of the i-th segment is

[0195]

[0196] In the formula, c i =[c i1 ,c i2 ,...,c iN ] T The coefficients are polynomials, β(t) = [1, t, t] 2 ,...,t N ] T T is a basis of polynomials. pt.i Let be the time of the i-th segment.

[0197] (5) For the initial trajectory p tj (t) is optimized. The trajectory cost, consisting of smoothness constraints, dynamic constraints, safety constraints, and visibility constraints, is calculated. The L-BFGS optimization method is used to minimize this cost to obtain the final flight trajectory.

[0198] Trajectory cost consists of four parts, specifically expressed as follows:

[0199]

[0200] In the formula, J s For smoothness constraints, J d For dynamic constraints, J f For safety constraints, J v For the target visibility constraint, λ s , λ d , λ f , λ v These are the weighting coefficients.

[0201] a. Smoothness constraint

[0202] Smoothness constraints ensure that the jerk of the trajectory will not be too large, i.e.

[0203]

[0204] In the formula, This represents the jerk of the i-th trajectory segment.

[0205] b. Dynamic constraints

[0206] Dynamic constraints ensure that the velocity and acceleration of the trajectory do not exceed their maximum values, i.e.

[0207]

[0208] In the formula, g(x) = max{x, 0} 3 For the penalty function, and Let v represent the velocity and acceleration of the i-th trajectory segment, respectively. m and a m ρ represents the maximum velocity and maximum acceleration of the trajectory, respectively. v ρ a ρ t As weight.

[0209] c. Security constraints

[0210] Before constructing safety constraints, a safe flight corridor needs to be generated based on the grid map. The flight corridor is a set of polyhedra that do not contain obstacles, represented as follows:

[0211]

[0212] In the formula, C i This indicates that it contains two consecutive path nodes q. i-1 and q i The polyhedra, each polyhedron having parameters represented by D and e, i.e.

[0213] C i ={x c ∈R3 |D i x c ≤e i} (19)

[0214] Based on the safe flight corridor, safety constraints are set to ensure that each trajectory node is within the safe area, and the cost is...

[0215]

[0216] In the formula, 1 is a vector whose elements are all 1, and ln[·] is the logarithm of the elements.

[0217] d. Target visibility constraints

[0218] During the drone's flight while following a target, it needs to ensure that the target remains within the drone's camera's field of view at all times. Firstly, the target's current position can be obtained using the Kalman filter in the target tracking algorithm module. and speed According to the time interval ΔT pt By calculating the predicted positions of the targets sequentially, a set of predicted target position points p can be obtained. tg =[p tg,0 ,p tg,1 ,...,p tg,M ] T .

[0219] Then, for each predicted target point, a target visibility area is generated based on the surrounding raster map, such as... Figure 6 As shown, the generation method uses the target prediction point as the center and the line segment from the target prediction point to the UAV trajectory point as the radius, expanding the fan-shaped region clockwise and counterclockwise respectively. During the expansion process, it checks whether there are obstacles on the radius line segments on both sides; if there are, the expansion stops, thus obtaining... Figure 6 The green fan-shaped area in the middle.

[0220] Finally, connecting the midpoint of the arc in the sector region to the endpoints on both sides, a quadrilateral region is obtained. Figure 6 The black line segment in the diagram represents the boundary of the target visible area generated by the quadrilateral.

[0221] C v ={x d ∈R 3 |Fx d ≤g}(21)

[0222] Where F and g represent parameters of the target's visible area, which can be obtained from the expansion process.

[0223] Similar to safety constraints, the trajectory points need to be constrained within the target's visible area; therefore, the cost of the target visibility constraint is...

[0224]

[0225] (6) Execute the flight trajectory. Generate a position control command based on the position at the corresponding time point in the flight trajectory, and send the command to the UAV flight controller to make the UAV fly to the designated position, thereby realizing the UAV's real-time tracking and obstacle avoidance of the target.

[0226] This invention also provides a mobile electronic device that can connect to a drone. The electronic device includes a memory and a processor. The memory stores instructions, and the processor executes the instructions stored in the memory, specifically performing the functions of a depth vision-based indoor drone target tracking system described in any of the above embodiments.

[0227] To better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present invention can be understood more clearly and thoroughly, and that the scope of the present invention can be fully conveyed to those skilled in the art.

[0228] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0229] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions.

[0230] It should be noted that any reference numerals placed between parentheses in the claims should not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In claims that enumerate several means, several of these means may be embodied by the same hardware. The use of the terms first, second, third, etc., is merely for convenience of expression and does not indicate any order. These terms can be understood as part of the component names.

[0231] Furthermore, it should be noted that in the description of this specification, the terms "one embodiment," "some embodiments," "embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0232] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the claims should be interpreted to include both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0233] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, then this invention should also include these modifications and variations.

Claims

1. An indoor unmanned aerial vehicle (UAV) target tracking system based on depth vision, characterized in that, include: The visual-inertial SLAM algorithm module is used to obtain the drone's pose and build a grid map of the drone's surrounding environment based on the images output by the depth camera on the drone and the raw data from the IMU. The target tracking algorithm module is used to visually track a specified target based on the RGB image and depth image output by the depth camera on the UAV, and to obtain the position of the tracked target. The UAV path planning algorithm module is used to plan a flight trajectory for tracking the target based on the UAV's pose, grid map, and the target position of the target. Among them, the visual inertial SLAM algorithm module, the target tracking algorithm module, and the UAV path planning algorithm module are all information executed in real time by independent threads in the mobile device; The target tracking algorithm module includes a target detection and tracking unit, which is used to obtain candidate targets based on real-time read RGB images and depth images using the NanoDet target detection model, select tracking targets from the candidate targets, initialize the ECO-HC target tracker based on the tracking targets, and complete target tracking; Specifically, during the initialization of the ECO-HC target tracker, a correlation filter is generated; the RGB image is then cross-correlated with the correlation filter to obtain the target's position and bounding box in the current image. ,in and These are the horizontal and vertical pixel coordinates of the top-left corner of the target bounding box. and These are the pixel width and pixel height of the target bounding box, respectively. Calculate the target box The color feature is compared with all features in the sample database. The highest similarity score was selected as the target tracking quality score. Target tracking quality The calculation formula is: (2); The number of samples in the sample database; This represents the similarity between the color features of the i-th sample data in the sample database and the color features of the target bounding box; ; Based on target tracking quality Complete the sample database update every [time period]. The frame is updated once if the target tracking quality of the current frame is greater than the threshold. If the target box's color feature is added to the sample database, then the sample with the lowest score in the sample database will be replaced. Retaining fractions The calculation formula is: (3) In formula (3), The similarity between the color features of each detection box and the features of the desired target in the sample database is calculated. The current frame number. The frame number in which the sample first appears. The time weights of the sample features; The target state estimation unit is used to acquire the absolute position information of the tracked target in the world coordinate system; specifically, S11, based on the target bounding box... And camera parameters, to obtain the relative position between the target and the camera. S12, based on the relative position Based on the pose of the drone, obtain the absolute position observations of the target. S13. Based on the target's absolute position observations. The target state is estimated using a Kalman filter to obtain the filtered target position. and speed ; S11 includes: selecting a specified pixel point in the target box. As the target point ,in and These are the horizontal and vertical pixel coordinates of the target point in the image, respectively; The position of the target in the camera coordinate system is obtained based on the pinhole camera imaging formula. ,Right now (4) In formula (4), and For camera internal parameters, and This is the pixel coordinate offset. The depth of the target pixel; Target point When selected for the first time, the selected coordinates are: The pixels, and in subsequent target location calculations, the depth of the target points in the previous frame image. As a priori value, multiple pixels with equal horizontal coordinates are selected within the target bounding box of the current frame image, while the vertical coordinates remain unchanged. The absolute value of the difference between the depth of each point and the prior depth value is calculated, and the pixel with the smallest absolute value that is not greater than a threshold is selected. The pixel is used as the target point of the current frame.

2. The system according to claim 1, characterized in that, The target tracking algorithm module further includes: The image reading unit is used to read the RGB and depth images output by the depth camera on the drone in real time; The target detection and tracking unit is also used to calculate the tracking quality of the target after the ECO-HC target tracker initialization is completed; if continuous If the tracking quality of all frames is below a preset threshold, the ECO-HC target tracker will be reinitialized. It is a natural number greater than or equal to 5.

3. The system according to claim 2, characterized in that, The target detection and tracking unit is specifically used for: S01. Using a pre-trained NanoDet object detection model, the NCNN neural network inference framework is used to perform object detection on the RGB image, resulting in multiple detection boxes with specified labels; the color features of each detection box are extracted. S02. Compare the color features of each detection box with the features of the desired target in the sample database to obtain the similarity score. Select the highest similarity score that is greater than the threshold. The detection bounding box is used as the target bounding box, which is used for the initialization of the ECO-HC target tracker; Similarity The calculation formula is: (1) In formula (1), The first element of the color feature matrix corresponding to the detection box is... The first channel One element, The first element represents the color feature matrix of the desired target in the sample database. The first channel Each element, similarity exist Within the range.

4. The system according to claim 1, characterized in that, S12 includes: Assume the attitude of the UAV in the world coordinate system is The absolute position is The camera's attitude in the drone's body coordinate system is The location is Combined with the target's position in the camera coordinate system Calculate the target's position in the world coordinate system. , (5); S13 includes: using a Kalman filter to estimate the target state, and obtaining the filtered target position based on formulas (6) to (10). and speed ; Specifically, a Kalman filter based on a constant velocity model is used to estimate the target's state, where the state variables are represented as follows: ; (6) (7) (8) (9) (10) in, This is the predicted state value. for The target state value at time t. for The target state value at any given time; for The target state observation value at time t. This is the predicted value of the error covariance. for The error covariance at time, for Kalman gain at time step; Here is the state transition matrix. It is the identity matrix. It is a diagonal matrix. The time interval between the two states. It is a zero matrix; For noise driving matrix, It is a diagonal matrix. For measurement matrix; Let be the covariance matrix of the process noise. Let be the covariance matrix of the observation noise.

5. The system according to claim 1, characterized in that, The drone path planning algorithm module is specifically used for: Based on the drone's pose, grid map, and target location; Select the drone's location as the path starting point. And determine the path endpoint according to specific rules. ; Among them, the selection rule for the endpoint of the path is that if the target is within the drone's field of vision, the endpoint will be set at 2.5 to 3.0m on the line connecting the target position to the drone's position. If the target is suddenly obscured by an obstacle and the current target position cannot be obtained, and the obscuration time does not exceed 5 seconds, the target position is predicted according to the Kalman filter, and the predicted position is used as the path endpoint. If no target is detected, the drone remains hovering.

6. The system according to claim 5, characterized in that, The drone path planning algorithm module is specifically used for: From the starting point of the path Start the search, and the search will return the next node. Then Based on this, perform a search, repeating this operation until the path reaches its destination. A set of path nodes is obtained. ; An initial representation of the UAV trajectory is generated using a piecewise polynomial curve; the piecewise polynomial curve is represented as... The curve contains There are segments, and the degree of the polynomial is... , No. The curve of each segment is ; in, For polynomial coefficients, It is a basis for polynomials. For the first A segment of time; For the initial trajectory The trajectory cost, which consists of smoothness constraints, dynamic constraints, safety constraints, and visibility constraints, is minimized using the L-BFGS optimization method to obtain the final flight trajectory.

7. The system according to claim 6, characterized in that, Trajectory cost consists of four parts, specifically: ; in, For smoothness constraints, For dynamic constraints, For safety constraints, As a constraint on target visibility, , , , These are the weighting coefficients.

Citation Information

Patent Citations

  • Quad-rotor unmanned aerial vehicle visual target tracking method based on binocular camera

    CN110222581A

  • Target positioning method based on VI-SLAM in unknown rescue environment

    CN114459467A