Motion target tracking method and device, electronic equipment and readable storage medium
By training a target tracking model and defining multiple tracking states, the problem of low compatibility of moving target tracking methods is solved, achieving adaptation to multiple tracking algorithms and smooth camera operation.
Patent Information
- Application Number
- CN202211691097.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2042-12-27
AI Technical Summary
Existing moving target tracking methods have low compatibility and are difficult to adapt to various tracking algorithms, leading to improper handling when tracking fails.
The target tracking model is trained by acquiring video frames corresponding to the moving target, and various tracking states are defined (such as tracking, target acquisition, training, target loss, etc.). Based on the tracking state, camera rotation commands are generated to control the camera to track or reset its position, adapting to different tracking algorithms.
It improves the compatibility of moving target tracking methods, can adapt to multiple tracking algorithms, reduces the complexity of handling tracking failures, and ensures smooth camera operation.
Smart Images

Figure CN115908499B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of target tracking, and in particular to a moving target tracking method and device, an electronic device, and a readable storage medium. BACKGROUND
[0002] In the current application of tracking camera devices, the main task of moving target tracking is to track a specific moving target in a video, to control the camera to follow the target to rotate, and to capture the position of the moving target in real time, so that the position of the moving target tends to the center of the image. However, in practice, no matter what tracking algorithm is used, tracking failure will inevitably occur. Therefore, the key to automatic tracking lies in how to handle the start, end, and tracking failure of moving target tracking, as well as the corresponding camera control strategy. The current moving target tracking method mainly designs a corresponding target tracking model and moving target tracking scheme based on a specific moving target tracking algorithm, that is, the migration of the scheme is poor, and it is difficult to adapt to various tracking algorithms, thereby causing the problem of low compatibility of the moving target tracking method. SUMMARY
[0003] The main purpose of the present application is to provide a moving target tracking method, device, electronic device, and readable storage medium, which aims to solve the technical problem of low compatibility of the moving target tracking method.
[0004] To achieve the above-mentioned purpose, the present application provides a moving target tracking method, which comprises:
[0005] When a first moving target appears in a target video image, a first preset number of video frames corresponding to the first moving target are obtained, and an initial target tracking model is trained according to each video frame to obtain a target tracking model;
[0006] The first moving target is tracked by using the target tracking model to obtain the tracking state of the first moving target;
[0007] If the tracking state is a tracking state, a tracking frame is obtained, and a corresponding camera rotation command is generated according to the tracking frame and the center position of the target video image;
[0008] The camera is rotated by using the camera rotation command to track the first moving target;
[0009] If the tracking state is not a tracking state, the tracking segment state is determined according to the tracking state, and it is judged whether to reset the camera position according to the tracking segment state.
[0010] Optionally, the tracking state comprises at least one of a target acquisition state and a training state.
[0011] Before the step of tracking the first moving target through the target tracking model to obtain a tracking state of the first moving target, the method further comprises:
[0012] obtaining a target video image of a target scene through a camera, detecting the target video image, and setting the tracking state as a target obtaining state;
[0013] when detecting that there is a moving target in the target video image, taking a video frame in which the first moving target is located as a training frame, and switching the tracking state to a training state;
[0014] training the initial target tracking model according to the training frame until the training frame reaches the first preset number, and obtaining the target tracking model.
[0015] Optionally, the step of training the initial target tracking model according to the training frame until the training frame reaches the first preset number, and obtaining the target tracking model comprises:
[0016] obtaining position information of a current moving target, judging whether the position information is of a same moving target based on a detection frame corresponding to the position information and a detection frame of a previous video frame;
[0017] if yes, taking a video frame corresponding to the position information as a training frame to train the initial target tracking model, and obtaining the target tracking model;
[0018] if no, switching the tracking state to a target obtaining state.
[0019] Optionally, the tracking state comprises at least a tracking state and a target loss state.
[0020] The step of tracking the first moving target through the target tracking model to obtain a tracking state of the first moving target comprises:
[0021] tracking the first moving target through the target tracking model to obtain a tracking result corresponding to each video frame and switching the tracking state to a tracking state;
[0022] performing normalization analysis on each tracking result to obtain a confidence degree corresponding to each tracking result;
[0023] when there are a second preset number of video frames corresponding to a confidence degree lower than a first preset confidence threshold, switching the tracking state to a target loss state;
[0024] switch the tracking state to a target acquisition state when the position information of the first moving target changes less than a preset distance within a first preset time length.
[0025] Optionally, after the step of switching the tracking state to the target loss state, the method further comprises:
[0026] analyzing the second preset number of video frames by the target tracking model to obtain corresponding tracking results and confidence degrees of each video frame;
[0027] if there is a video frame with a confidence degree exceeding a second preset confidence threshold in the second preset number of video frames, switching the tracking state to a tracking-in-state;
[0028] if there is no video frame with a confidence degree exceeding the second preset confidence threshold in the second preset number of video frames, switching the tracking state to a target acquisition state, and acquiring each moving target by performing target detection on the target video image;
[0029] selecting a second moving target from each of the moving targets based on the tracking result of the first moving target;
[0030] tracking the second moving target by the target tracking model to obtain a tracking result of the second moving target;
[0031] performing normalized analysis on the tracking result of the second moving target to obtain a confidence degree of the tracking result of the second moving target corresponding to each video frame;
[0032] when the confidence degree of the tracking result of the second moving target is not less than the second preset confidence threshold, switching the tracking state to the tracking-in-state;
[0033] when the confidence degrees of the tracking results corresponding to the second preset number of video frames are all less than the second preset confidence threshold, switching the tracking state to the target acquisition state.
[0034] Optionally, the step of selecting the second moving target from each of the moving targets based on the tracking result of the first moving target comprises:
[0035] obtaining corresponding tracking box information in the tracking result of the first moving target and detection box information of each of the moving targets;
[0036] determining the degree of overlap between the tracking box and each of the detection boxes based on the corresponding tracking box information in the tracking result of the first moving target and the detection box information of each of the moving targets;
[0037] Select a second moving target based on the degree of overlap between the tracking frame and each of the detection frames.
[0038] Optionally, the tracking state includes at least a target acquisition state, and the tracking segment state includes at least a working state and an undefined state, the undefined state being used to represent that a tracking segment has ended.
[0039] The step of determining a tracking segment state according to the tracking state, and judging whether to reset the camera position according to the tracking segment state includes:
[0040] When the duration of the tracking state in the target acquisition state reaches a second preset duration, the tracking segment state is switched from the working state to the undefined state.
[0041] When the tracking state is in the undefined state, the camera position is reset, and the moving target in the target video image is detected again.
[0042] The application also provides a moving target tracking device, which is applied to a moving target tracking apparatus, and includes:
[0043] A model training module is configured to acquire a first preset number of video frames corresponding to a first moving target when the first moving target appears in a target video image, and train an initial target tracking model according to each of the video frames to obtain a target tracking model.
[0044] A target tracking module is configured to track the first moving target through the target tracking model to obtain a tracking state of the first moving target.
[0045] A command generation module is configured to acquire a tracking frame and generate a corresponding camera rotation command according to the tracking frame and a center position of the target video image if the tracking state is in the tracking state.
[0046] A moving tracking module is configured to control a camera to rotate through the camera rotation command to track the first moving target.
[0047] A camera position resetting module is configured to determine a tracking segment state according to the tracking state if the tracking state is not in the tracking state, and judge whether to reset the camera position according to the tracking segment state.
[0048] Optionally, the model training module is further configured to:
[0049] A target video image of a target scene is acquired through a camera, the target video image is detected, and the tracking state is set to a target acquisition state.
[0050] When it is detected that there is a moving target in the target video image, a video frame in which the first moving target is located is taken as a training frame, and the tracking state is switched to a training state;
[0051] The initial target tracking model is trained according to the training frame until the training frame reaches the first preset number, and the target tracking model is obtained.
[0052] Optionally, the model training module is further configured to:
[0053] acquire position information of a current moving target, and determine whether the position information is of a same moving target based on a detection frame corresponding to the position information and a detection frame of a previous video frame;
[0054] If yes, a video frame corresponding to the position information is taken as a training frame to train the initial target tracking model, and the target tracking model is obtained;
[0055] If no, the tracking state is switched to a target acquisition state.
[0056] Optionally, the target tracking module is further configured to:
[0057] track the first moving target by using the target tracking model, acquire a tracking result corresponding to each video frame, and switch the tracking state to a tracking-in-state;
[0058] perform normalization analysis on each tracking result to obtain a confidence degree corresponding to each tracking result;
[0059] When confidence degrees corresponding to a second preset number of video frames are lower than a first preset confidence threshold, the tracking state is switched to a target loss state;
[0060] When a change in position information of the first moving target within a first preset time length is less than a preset distance, the tracking state is switched to a target acquisition state.
[0061] Optionally, the target tracking module is further configured to:
[0062] analyze the second preset number of video frames by using the target tracking model to obtain corresponding tracking results and confidence degrees of the video frames;
[0063] If there is a video frame with a confidence degree exceeding a second preset confidence threshold in the second preset number of video frames, the tracking state is switched to a tracking-in-state;
[0064] if there is no video frame with a confidence exceeding the second preset confidence threshold in the second preset number of video frames, switching the tracking state to a target acquisition state, and acquiring each moving target by performing target detection on the target video image;
[0065] selecting a second moving target from each of the moving targets based on the tracking result of the first moving target;
[0066] tracking the second moving target by using the target tracking model to obtain a tracking result of the second moving target;
[0067] performing normalization analysis on the tracking result of the second moving target to obtain a confidence of the tracking result of the second moving target in each video frame;
[0068] when the confidence of the tracking result of the second moving target is not less than the second preset confidence threshold, switching the tracking state to a tracking-in-progress state;
[0069] when the confidence of the tracking result of each of the second preset number of video frames is less than the second preset confidence threshold, switching the tracking state to the target acquisition state.
[0070] Optionally, the target tracking module is further configured to:
[0071] obtain tracking box information corresponding to the tracking result of the first moving target and detection box information of each of the moving targets;
[0072] determine a degree of overlap between the tracking box and each of the detection boxes based on the tracking box information corresponding to the tracking result of the first moving target and the detection box information of each of the moving targets;
[0073] select the second moving target based on the degree of overlap between the tracking box and each of the detection boxes.
[0074] Optionally, the camera position resetting module is further configured to:
[0075] when a duration of the tracking state in the target acquisition state reaches a second preset duration, switching the tracking segment state from the working state to an undefined state;
[0076] when the tracking state is in the undefined state, resetting the camera position and re-detecting the moving targets in the target video image.
[0077] The application further provides an electronic device, which is a physical device, comprising a memory, a processor, and a program of the motion target tracking method stored in the memory and executable on the processor, wherein the program of the motion target tracking method, when executed by the processor, can implement the steps of the motion target tracking method as described above.
[0078] The application further provides a computer readable storage medium, which stores a program of a motion target tracking method, wherein the program of the motion target tracking method, when executed by a processor, implements the steps of the motion target tracking method as described above.
[0079] The application further provides a computer program product, which comprises a computer program, wherein the computer program, when executed by a processor, implements the steps of the motion target tracking method as described above.
[0080] The application provides a motion target tracking method and device, an electronic device, and a readable storage medium. First, when a first motion target appears in a target video image, a first preset number of video frames corresponding to the first motion target are acquired, and an initial target tracking model is trained according to each video frame to obtain a target tracking model. Then, the first motion target is tracked by using the target tracking model to obtain a tracking state of the first motion target. If the tracking state is a tracking state, a tracking frame is acquired, and a corresponding camera rotation command is generated according to the tracking frame and a center position of the target video image. The camera is rotated by using the camera rotation command to track the first motion target. If the tracking state is not the tracking state, a tracking segment state is determined according to the tracking state, and whether the camera position is reset is determined according to the tracking segment state. The technical solution of the application first trains a target tracking model by using video frames, and then performs corresponding operations according to a tracking state to track a target or reset a camera position. Various tracking algorithms only need to perform corresponding operations according to the tracking state mentioned in the technical solution of the application to adapt to the technical solution, thereby overcoming the technical defect that a corresponding target tracking model and a motion target tracking scheme need to be designed based on a specific motion target tracking algorithm, and improving the compatibility of the motion target tracking method. BRIEF DESCRIPTION OF DRAWINGS
[0081] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the application and, together with the description, further serve to explain the principles of the application.
[0082] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, for those of ordinary skill in the art, the other drawings can be obtained based on these drawings without any creative effort.
[0083] Figure 1 Flowchart of the first embodiment of the motion target tracking method of the present application;
[0084] Figure 2 Flowchart of the target tracking data processing in the first embodiment of the motion target tracking method of the present application;
[0085] Figure 3 Flowchart of steps B10 to B60 in the first embodiment of the motion target tracking method of the present application;
[0086] Figure 4 Schematic diagram of the composition structure of the motion target tracking device in the embodiments of the present application;
[0087] Figure 5 Schematic diagram of the device structure of the hardware running environment involved in the motion target tracking method in the embodiments of the present application.
[0088] The purposes, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0089] In order to make the above purposes, features and advantages of the present application more apparent and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those of ordinary skill in the art without any creative effort fall within the scope of the present application.
[0090] Embodiment One
[0091] In the application of the moving target tracking device, the main task of the moving target tracking is to track a specific target in a video, capture its position in real time, control the pan-tilt to follow the target rotation, and make the target position tend to the image center. In actual application, no matter what tracking algorithm is used, tracking failure will inevitably occur. Therefore, the key of automatic tracking lies in how to handle the starting, stopping and tracking failure of the tracker, and the control strategy of the pan-tilt, so that the ball machine can follow the moving target rotation smoothly. However, in practice, no matter what tracking algorithm is used, tracking failure will inevitably occur. Therefore, the key of automatic tracking lies in how to handle the starting, stopping and tracking failure of the moving target tracking, and the control strategy of the corresponding camera. The current moving target tracking method mainly designs a corresponding target tracking model and a moving target tracking scheme based on a specific moving target tracking algorithm, that is, the migration of the scheme is poor, and it is difficult to adapt to various tracking algorithms, thereby causing the problem of low compatibility of the moving target tracking method.
[0092] The embodiment of the application provides a moving target tracking method. In the first embodiment of the moving target tracking method, referring to Figure 1 , the moving target tracking method comprises the following steps.
[0093] In step S10, when a first moving target appears in a target video image, a first preset number of video frames corresponding to the first moving target are acquired, and an initial target tracking model is trained according to each video frame to obtain a target tracking model.
[0094] In step S20, the first moving target is tracked by using the target tracking model to obtain a tracking state of the first moving target.
[0095] In step S30, if the tracking state is a tracking state, a tracking frame is acquired, and a corresponding camera rotation command is generated according to the tracking frame and a center position of the target video image.
[0096] In step S40, the camera is controlled to rotate by using the camera rotation command to track the first moving target.
[0097] In step S50, if the tracking state is not the tracking state, a tracking segment state is determined according to the tracking state, and whether the camera position is reset is judged according to the tracking segment state.
[0098] In the embodiments of the present application, it should be noted that the target video image is a video image of a target scene acquired by a camera, and the target video image is detected by a detection module, when a first moving target appears, the video frame starts to be acquired to train the target tracking model, the tracking state is used to represent the running state of the tracking algorithm corresponding to the target tracking model, in different running states, the tracking algorithm has different processing on the image and data, so as to improve the compatibility of the moving target tracking method, so that the moving target tracking method can adapt to more tracking algorithms, only the corresponding operation is realized according to the several tracking states defined in the embodiments of the present application, and the scheme can be adapted; the tracking state can be Tracking, indicating that the tracking module is in the process of tracking a certain moving target.
[0099] As an example, steps S10 to S50 include: initializing the tracking module, the initialization process includes memory allocation, parameter configuration and thread creation; setting the tracking state to Free, wherein Free indicates that there is no target being tracked and a target is being acquired; acquiring a new moving target from the target video image by the detection module, when a first moving target appears in the target video image, the video frame corresponding to the first moving target is continuously acquired until the number of video frames is not less than a first preset number, and the tracking state is switched to Training, wherein Training indicates that the model training is being performed; training an initial target tracking model based on the acquired video frames to obtain a target tracking model, wherein the initial target tracking model is constructed based on the tracking algorithm input by the user; tracking the first moving target by the target tracking model to obtain a tracking result, and switching the tracking state to Tracking, wherein Tracking indicates that a certain target is being tracked; in the process of tracking the first moving target by the target tracking model, if the tracking is lost, the tracking state is switched to Miss, wherein Miss indicates that the target being tracked is lost and is trying to be found back; determining whether the tracking state is in tracking, if the tracking state is in tracking, a tracking box is acquired from the tracking result; determining camera rotation direction information and step number information according to the tracking box and the center position of the target video image, and generating corresponding camera rotation commands; transmitting the camera rotation commands to a gimbal control module, and controlling the camera to rotate by the gimbal control module according to the camera rotation commands to track the first moving target; if the tracking state is not in tracking, determining whether the tracking state is Free; if the tracking state is Free and a preset time duration has been continued, setting the tracking segment state to an undefined state, wherein the undefined state indicates that the tracking segment has ended; and restoring the position of the camera to an initial state.
[0100] As an example, with reference to Figure 2 , the tracking module is configured to perform a tracking function, the detection module is configured to detect a moving target from a target video image, and is responsible for providing position information of the target, which is the basis for tracking initiation, termination, and relocation; the gimbal control module is configured to receive a command for rotation and control the camera to rotate, and the camera can be a gimbal. The above modules cooperate to complete each step of the moving target tracking method, and steps S10 to S50 include: initializing the tracking module, determining whether the tracking function needs to be started according to the tracking state; if the tracking state is Tracking, starting the tracking function of the tracking module, and tracking the moving target based on a detection frame obtained from the target video image by the detection module, and generating a tracking result, wherein the tracking result includes a tracking frame; generating a gimbal rotation command according to the deviation of the tracking frame from the image center, wherein the gimbal rotation command is used to control the gimbal to rotate by the gimbal control module; if the tracked moving target is lost during tracking, switching the tracking state to Miss, and re-finding the lost moving target; if the moving target is found within a first preset time period, switching the tracking state back to Tracking; otherwise, switching the tracking state to Free; if the tracking state is Free for a second preset time period, switching the state of the tracking segment to an undefined state, i.e., the tracking segment is terminated, and resetting the position of the gimbal.
[0101] Before the step of tracking the first moving target by using the target tracking model to obtain the tracking state of the first moving target, the method further includes:
[0102] Step A10: obtaining a target video image of a target scene by using a camera, detecting the target video image, and setting the tracking state to a target acquisition state.
[0103] Step A20: when detecting that there is a moving target in the target video image, taking a video frame of the first moving target as a training frame, and switching the tracking state to a training state.
[0104] Step A30: training the initial target tracking model according to the training frame until the training frame reaches a first preset number, and obtaining the target tracking model.
[0105] In the embodiment of the present application, it should be noted that the embodiment of the present application provides a target tracking model training method before a moving target is tracked, and two tracking states are defined, wherein the target acquisition state is Free, indicating that no moving target is currently detected and the moving target is being acquired, and the training state is Training, used to indicate that the target tracking model is currently being trained according to the training frame. The embodiment of the present application can adapt to the corresponding tracking algorithm by defining two tracking states, and different tracking algorithms are executed in different tracking states, so as to improve the compatibility of the moving target tracking method.
[0106] As an example, steps A10 to A30 include: acquiring a target video image by controlling a camera through a pan-tilt to collect a target scene, obtaining a target video image; continuously detecting a moving target from each video frame of the target video image by a detection module, and setting the tracking state to Free; when the detection module detects a first moving target from a video frame of the target video image, acquiring a video frame corresponding to the first moving target, and switching the tracking state to Training; continuously acquiring video frames of the first moving target until a first preset number is reached; training the initial target tracking model through the first preset number of video frames to obtain the target tracking model.
[0107] The step of training the initial target tracking model according to the training frame until the training frame reaches the first preset number to obtain the target tracking model includes:
[0108] Step A31, acquiring position information of a current moving target, and determining whether the position information is the same moving target based on a detection frame corresponding to the position information and a detection frame of a previous video frame;
[0109] Step A32, if yes, training the initial target tracking model through a video frame corresponding to the position information as a training frame to obtain the target tracking model;
[0110] Step A33, if no, switching the tracking state to a target acquisition state.
[0111] In the embodiment of the present application, it should be noted that the embodiment of the present application provides a method for continuously acquiring video frames corresponding to a first moving target as training frames to train a target tracking model, and the position information of the first moving target is acquired by a detection module, that is, a detection frame corresponding to the first moving target.
[0112] As an example, steps A31 to A33 include: detecting, by a detection module, a current motion target to obtain a detection box of the current motion target; calculating an IOU (intersection over union) of the detection box and a detection box corresponding to the first motion target in a previous video frame; determining whether the IOU is greater than a preset IOU threshold; if the IOU is greater than the preset IOU threshold, determining that the current motion target and the first motion target are the same motion target; taking a current video frame as a training frame for training an initial target tracking model until a number of training frames reaches a first preset number, and obtaining the target tracking model; if the IOU is not greater than the preset IOU threshold, determining that the current motion target and the first motion target are not the same motion target; and switching the tracking state to Free.
[0113] The step of tracking, by the target tracking model, the first motion target to obtain a tracking state of the first motion target includes:
[0114] Step S21: tracking, by the target tracking model, the first motion target to obtain a tracking result corresponding to each video frame and switching the tracking state to a tracking state.
[0115] Step S22: performing normalization analysis on each tracking result to obtain a confidence corresponding to each tracking result.
[0116] Step S23: when there are a second preset number of video frames corresponding to a confidence lower than a first preset confidence threshold, switching the tracking state to a target loss state.
[0117] Step S24: when a position information of the first motion target changes by less than a preset distance within a first preset time length, switching the tracking state to a target acquisition state.
[0118] In the embodiments of the present application, it should be noted that the tracking state at least includes a tracking state and a target loss state, and the embodiments of the present application provide definitions of the two tracking states, wherein the tracking state is Tracking, which is used to indicate that the current motion target is being tracked, and the target loss state is Miss, which is used to indicate that the current tracked motion target has been lost and is being recovered, that is, the motion target is being relocated; the confidence is an index for measuring the credibility of the tracking result, which can be defined by the user according to the specific needs, and in the embodiments of the present application, the accuracy of the tracking frame in the tracking result and the continuity of the motion target trajectory can be used to represent the confidence. In addition, the confidence can be used to judge the credibility of the tracking result in the current frame in the embodiments of the present application, but the actual application scenario is usually complex, and the target may appear temporary occlusion, blur, large deformation and the like, resulting in low confidence. Therefore, only by judging the success or failure of tracking through the confidence of the current frame, the overall tracking effect will be negatively affected, such as increasing the training cost, target loss, and unsmooth pan-tilt control. Therefore, in the technical scheme of the embodiments of the present application, the confidence of the tracking result corresponding to the second preset number of video frames is used to judge whether the tracking loss occurs, which overcomes the influence of interference factors and improves the accuracy of the judgment of target loss.
[0119] As an example, steps S21 to S24 include: tracking the first motion target by a target tracking model in the tracking module to obtain tracking results of the first motion target in each video frame, wherein each tracking result includes a tracking frame; switching the tracking state to Tracking when tracking the first motion target; obtaining the confidence of each tracking result by analyzing the corresponding tracking frame and the corresponding detection frame in each video frame in each tracking result, wherein the confidence is used to represent the accuracy or credibility of the tracking result; judging whether the confidence corresponding to the tracking result is lower than a first confidence threshold frame by frame, determining that the tracking of the first motion target has been lost when the confidence corresponding to the second preset number of video frames is lower than the first preset confidence threshold, and switching the tracking state to Miss; detecting the position information of the first motion target, and switching the tracking state to Free when the position information of the first motion target has no change or the change distance is less than a preset distance within a first preset time length.
[0120] In the embodiments of the present application, it should be noted that the tracking state at least includes a tracking state and a target loss state, and the embodiments of the present application provide definitions of the two tracking states, wherein the tracking state is Tracking, which is used to indicate that the current motion target is being tracked, and the target loss state is Miss, which is used to indicate that the current tracked motion target has been lost and is being recovered, that is, the motion target is being relocated; the confidence is an index for measuring the credibility of the tracking result, which can be defined by the user according to the specific needs, and in the embodiments of the present application, the accuracy of the tracking frame in the tracking result and the continuity of the motion target trajectory can be used to represent the confidence. In addition, the confidence can be used to judge the credibility of the tracking result in the current frame in the embodiments of the present application, but the actual application scenario is usually complex, and the target may appear temporary occlusion, blur, large deformation and the like, resulting in low confidence. Therefore, only by judging the success or failure of tracking through the confidence of the current frame, the overall tracking effect will be negatively affected, such as increasing the training cost, target loss, and unsmooth pan-tilt control. Therefore, in the technical scheme of the embodiments of the present application, the confidence of the tracking result corresponding to the second preset number of video frames is used to judge whether the tracking loss occurs, which overcomes the influence of interference factors and improves the accuracy of the judgment of target loss. Figure 3 , the method further comprises:
[0121] Step B10: analyzing the second preset number of video frames by the target tracking model to obtain corresponding tracking results and the confidence of each video frame;
[0122] Step B20, if there is a video frame whose confidence exceeds a second preset confidence threshold in the second preset number of video frames, switching the tracking state to a tracking-in-state;
[0123] Step B30, if there is no video frame whose confidence exceeds the second preset confidence threshold in the second preset number of video frames, switching the tracking state to a target acquisition state, and acquiring each moving target by performing target detection on the target video image;
[0124] Step B40, selecting a second moving target from each of the moving targets based on the tracking result of the first moving target;
[0125] Step B50, tracking the second moving target by using the target tracking model to obtain a tracking result of the second moving target;
[0126] Step B60, performing normalization analysis on the tracking result of the second moving target to obtain a confidence of the tracking result of the second moving target corresponding to each video frame;
[0127] Step B70, when the confidence of the tracking result of the second moving target is not less than the second preset confidence threshold, switching the tracking state to the tracking-in-state;
[0128] Step B80, when the confidence of the tracking result corresponding to the second preset number of video frames is less than the second preset confidence threshold, switching the tracking state to the target acquisition state.
[0129] In the embodiments of the present application, it should be noted that the embodiments of the present application provide a method for repositioning and finding a first moving target after the first moving target is lost. When tracking fails, the first moving target needs to be repositioned, that is, a detection result is obtained from a detection module, and one of the moving targets is selected for tracking. The moving target may be the first moving target that is lost or a new target. Because the tracking process processes continuous video images, when tracking fails, there is a high probability that the target is still nearby. Therefore, the first moving target is selected from each of the moving targets detected.
[0130] As an example, steps B10 to B80 include: analyzing the second preset number of video frames by the target tracking model to find the first moving target, obtaining tracking results corresponding to each video frame and confidence degrees corresponding to each handover video frame; if there is a video frame with a confidence degree exceeding a second preset confidence threshold in the second preset number of video frames, it is determined that the first moving target is successfully found, and the tracking state is switched to Tracking; if the first moving target is not found, the detection module is used to detect the moving targets in the target video image to obtain position information of each moving target, wherein the position information includes a detection box; if there is no moving target in the target video image for a second preset time length, the tracking state is switched to Free; according to the detection box of the tracking result of the first moving target and the detection box of each moving target, a second moving target closest to the first moving target is selected; the target tracking model is used to track the second moving target to obtain a tracking result corresponding to the second moving target, wherein the tracking result includes a tracking box; based on the tracking box of the second moving target in each video frame and the detection box of the second moving target obtained by the detection module, the confidence degree of the tracking result of the second moving target in each video frame is determined; when the confidence degree of the tracking result of the second moving target in each video frame is not less than the second preset confidence threshold, it is determined that the second moving target is the same moving target as the first moving target, that is, the moving target is successfully found, and the tracking state is switched to Tracking; when the confidence degrees of the tracking results of the second preset number of video frames are all less than the second preset confidence threshold, it is determined that the second moving target is not the same moving target as the first moving target, that is, the moving target is not found, and the tracking state is switched to Free.
[0131] The step of selecting the second moving target based on the tracking result of the first moving target from the moving targets includes:
[0132] Step B21: obtaining tracking box information corresponding to the tracking result of the first moving target and detection box information of each moving target.
[0133] Step B22: determining the overlap degree of the tracking box and each detection box based on the tracking box information corresponding to the tracking result of the first moving target and the detection box information of each moving target.
[0134] Step B23: selecting the second moving target based on the overlap degree of the tracking box and each detection box.
[0135] In the embodiments of the present application, it should be noted that the embodiments of the present application provide a method for repositioning after the loss of tracking of a moving target, which mainly considers the distance, coincidence rate and scale of two bounding boxes through the corresponding tracking box information in the tracking result of the first moving target and the detection box information of each moving target to select the moving target closest to the first moving target.
[0136] As an example, steps B21 to B23 include: extracting the corresponding tracking box information in the tracking result of the first moving target from the tracking module, wherein the tracking box information includes the position information of the tracking box center point; extracting the detection box information of each moving target from the detection module, wherein the detection box information includes the position information of the detection box center point; determining the coincidence degree of the tracking box and each detection box based on the position information corresponding to the tracking box and each detection box, the Euclidean distance of the center points, and the diagonal length of the minimum closed area that can contain the tracking box and the detection box; selecting the moving target corresponding to the detection box with the highest coincidence degree with the tracking box from each detection box to obtain the second moving target.
[0137] As an example, when the tracking state is Tracking, the tracking rectangular frame of the first moving target is recorded, and the tracking box is used as the basis for selecting the target from the detection result, and the distance, coincidence rate and scale of the detection box of each moving target and the tracking box are considered to select the second moving target, and the expression is as follows:
[0138]
[0139] wherein, represents the intersection-over-union of the two bounding boxes, b d and b t represent the center points of the detection box and the recorded tracking box, f represents the Euclidean distance of the two center points, and c represents the diagonal length of the minimum closed area that can contain b d and b t two bounding boxes, and the D value is used to represent the coincidence degree of the tracking box and each detection box, that is, the repositioning method is to select the target with the maximum D value from all detection results.
[0140] In addition, the step of obtaining the tracking frame and generating a corresponding camera rotation command according to the tracking frame and the center position of the target video image comprises: after obtaining the tracking frame corresponding to the tracking result, calculating the pixel number deviation of the center point of the tracking frame and the center point of the target video image; converting the pixel number deviation into the number of pan-tilt rotation steps through a preset proportion coefficient, wherein the number of pan-tilt rotation steps comprises the number of horizontal rotation steps and the number of vertical rotation steps, and the preset proportion coefficient is obtained through experiments, the initial value k set by the user according to experience is obtained, and the rotation of the pan-tilt is analyzed; if the phenomenon of back-and-forth rotation occurs, it indicates that the value of k is too large, if the rotation is slow and stuttering, it indicates that the value of k is too small, and the value of k is iteratively optimized; and the camera rotation command is determined through the number of pan-tilt rotation steps.
[0141] As an example, the expression of the pixel number deviation and the deviation direction of the center point of the tracking frame and the center point of the target video image is as follows:
[0142]
[0143] Wherein, the subscripts x and y represent the horizontal and vertical directions respectively, S x and S y are the number of pan-tilt rotation steps in the horizontal direction and the vertical direction respectively, k is a preset proportion coefficient, C t and C i represent the center point coordinates of the tracking frame and the target video image respectively, wherein C tx and C ix represent the coordinate values in the horizontal direction, C ty and C iy represent the coordinate values in the vertical direction, S min is the minimum number of preset pan-tilt rotation steps, to avoid the phenomenon of back-and-forth rotation of the pan-tilt when the target is near the center of the image.
[0144] The present application calculates S x and S y by the above expression, and then sends the number of pan-tilt rotation steps, the direction and other information to the pan-tilt control module, so that the pan-tilt (camera) is controlled by the above-mentioned pan-tilt control module to complete the tracking of the moving target.
[0145] In addition, the step of determining the tracking segment state according to the tracking state and judging whether to reset the camera position according to the tracking segment state comprises:
[0146] Step S51, when the duration of the tracking state in the target acquisition state reaches the second preset duration, the tracking segment state is switched from the working state to the undefined state;
[0147] Step S52, when the tracking state is in the undefined state, resetting the camera position, and re-detecting the moving target in the target video image.
[0148] In the embodiments of the present application, it should be noted that the embodiments of the present application define a tracking segment state and feedback to the upper module, when a tracking segment ends, the position of the camera is reset. The tracking process is a long time, which can be divided into segments. Through the timing and the running state of the tracking algorithm, a tracking segment can be described as "start", "end", "working", "undefined" four states. Among them, "start" and "end" are short states, which are effective only in the start and end frames of the tracking segment, "working" and "undefined" are relatively long states, after the end of the tracking segment, it is in the "undefined" state, until a new tracking target appears, enter a new tracking segment. When the tracking process is in "working" and the tracking state remains in the target acquisition state (Free) for more than a second preset time length, it is determined that the tracking segment ends, and the tracking segment state is switched to the undefined state.
[0149] As an example, steps S51 to S52 include: if the tracking state is not in the tracking state, it is judged whether the tracking state is Free; if the tracking state is Miss, the duration of the tracking state is continuously detected until the tracking state is switched to Tracking or Free; if the tracking state is Free and has lasted for a second preset time length, the tracking segment state is set to the undefined state, wherein the undefined state indicates that the tracking segment has ended; the position of the camera is restored to the initial state, wherein the initial state is set according to the actual demand of the user.
[0150] The embodiment of the application provides a kind of moving target tracking method, first when the first moving target appears in target video image, the first preset number of video frames corresponding to the first moving target is acquired, and initial target tracking model is trained according to each video frame, and target tracking model is obtained, the first moving target is tracked by the target tracking model, and the tracking state of the first moving target is obtained, if the tracking state is in tracking state, tracking frame is acquired and corresponding camera rotation command is generated according to the center position of the tracking frame and the target video image, the camera rotation command is controlled to rotate camera, and the first moving target is tracked, if the tracking state is not in tracking state, tracking segment state is determined according to the tracking state, and whether camera position is reset is judged according to the tracking segment state, the technical scheme of the embodiment of the application is first trained by video frame target tracking model, then according to tracking state, corresponding operation can be executed, target tracking or camera position reset is carried out, various tracking algorithms only need to execute corresponding operation according to the tracking state mentioned in the technical scheme of the application, i.e. can adapt to the scheme, overcome the technical defects that corresponding target tracking model and moving target tracking scheme need to be designed based on specific moving target tracking algorithm, improve the compatibility of moving target tracking method.
[0151] Embodiment two
[0152] The embodiment of the application also provides a kind of moving target tracking device, the moving target tracking device is applied to moving target tracking equipment, refer to Figure 4 , the moving target tracking device includes:
[0153] Model training module, for when the first moving target appears in target video image, the first preset number of video frames corresponding to the first moving target is acquired, and initial target tracking model is trained according to each video frame, and target tracking model is obtained;
[0154] Target tracking module, for tracking the first moving target by the target tracking model, and the tracking state of the first moving target is obtained;
[0155] Command generation module, for if the tracking state is in tracking state, tracking frame is acquired and corresponding camera rotation command is generated according to the center position of the tracking frame and the target video image;
[0156] Moving tracking module, for rotating camera by the camera rotation command, and tracking the first moving target;
[0157] The camera position resetting module is configured to determine a tracking segment state according to the tracking state if the tracking state is not the tracking-in state, and determine whether to reset the camera position according to the tracking segment state.
[0158] Optionally, the model training module is further configured to:
[0159] acquire a target video image of a target scene through the camera, detect the target video image, and set the tracking state as a target acquisition state;
[0160] when it is detected that there is a moving target in the target video image, take a video frame in which the first moving target is located as a training frame, and switch the tracking state to a training state;
[0161] train the initial target tracking model according to the training frame until the training frame reaches the first preset number, and obtain the target tracking model.
[0162] Optionally, the model training module is further configured to:
[0163] acquire position information of a current moving target, determine whether the position information is of a same moving target based on a detection frame corresponding to the position information and a detection frame of a previous video frame;
[0164] if yes, take a video frame corresponding to the position information as a training frame to train the initial target tracking model, and obtain the target tracking model;
[0165] if no, switch the tracking state to a target acquisition state.
[0166] Optionally, the target tracking module is further configured to:
[0167] track the first moving target through the target tracking model, obtain a tracking result corresponding to each video frame, and switch the tracking state to a tracking-in state;
[0168] perform normalization analysis on each tracking result to obtain a confidence degree corresponding to each tracking result;
[0169] when confidence degrees corresponding to a second preset number of video frames are lower than a first preset confidence threshold, switch the tracking state to a target loss state;
[0170] when a change in position information of the first moving target within a first preset time length is less than a preset distance, switch the tracking state to a target acquisition state.
[0171] Optionally, the target tracking module is further configured to:
[0172] analyzing the second preset number of video frames by the target tracking model to obtain corresponding tracking results and confidence degrees of each video frame;
[0173] if there is a video frame with a confidence degree exceeding a second preset confidence threshold in the second preset number of video frames, switching the tracking state to a tracking-in-state;
[0174] if there is no video frame with a confidence degree exceeding the second preset confidence threshold in the second preset number of video frames, switching the tracking state to a target acquisition state, and acquiring each moving target by performing target detection on the target video image;
[0175] selecting a second moving target from each of the moving targets based on the tracking result of the first moving target;
[0176] tracking the second moving target by the target tracking model to obtain a tracking result of the second moving target;
[0177] performing normalized analysis on the tracking result of the second moving target to obtain a confidence degree of the tracking result of the second moving target in each video frame;
[0178] when the confidence degree of the tracking result of the second moving target is not less than the second preset confidence threshold, switching the tracking state to the tracking-in-state;
[0179] when the confidence degrees of the tracking results corresponding to the second preset number of video frames are all less than the second preset confidence threshold, switching the tracking state to the target acquisition state.
[0180] Optionally, the target tracking module is further configured to:
[0181] obtain corresponding tracking box information in the tracking result of the first moving target and detection box information of each of the moving targets;
[0182] determine a coincidence degree of the tracking box and each of the detection boxes based on the corresponding tracking box information in the tracking result of the first moving target and the detection box information of each of the moving targets;
[0183] select the second moving target based on the coincidence degree of the tracking box and each of the detection boxes.
[0184] Optionally, the camera position resetting module is further configured to:
[0185] when a duration of the tracking state in the target acquisition state reaches a second preset duration, switching the tracking segment state from the working state to an undefined state;
[0186] When the tracking state is in an undefined state, resetting the camera position and re-detecting the moving target in the target video image.
[0187] The motion target tracking device provided in the present application adopts the motion target tracking method in the above embodiments, and solves the technical problem of low compatibility of the motion target tracking method. Compared with the prior art, the motion target tracking device provided in the embodiments of the present application has the same beneficial effects as the motion target tracking method provided in the above embodiments, and other technical features in the motion target tracking device are the same as the features disclosed in the previous embodiment method, which will not be repeated here.
[0188] Embodiment Three
[0189] The embodiments of the present application provide an electronic device, which includes at least one processor, and a memory communicatively linked with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the motion target tracking method in the above embodiment one.
[0190] Reference will now be made to the following description Figure 5 , which shows a structural schematic diagram of an electronic device suitable for implementing the embodiments of the present disclosure. The electronic device in the embodiments of the present disclosure can include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Personal Computers), PMPs (Portable Multimedia Players), vehicle terminals (such as vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. Figure 5 The electronic device shown is only an example, and should not bring any limitation to the functions and use range of the embodiments of the present disclosure.
[0191] As shown in Figure 5 , the electronic device can include a processing device (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) or loaded into a random access memory (RAM) from a storage device. In the RAM, various programs and data required for the operation of the electronic device are also stored. The processing device, the ROM, and the RAM are connected to each other through a bus. An input / output (I / O) interface is also linked to the bus.
[0192] Generally, the following systems can be linked to the I / O interface: input devices including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices including, for example, a magnetic tape, a hard disk, etc.; and communication devices. The communication devices can allow the electronic device to communicate wirelessly or wiredly with other devices to exchange data. Although the electronic device is illustrated as having various systems, it is understood that all of the illustrated systems are not required to implement or have. More or less systems can alternatively be implemented or have.
[0193] In particular, the processes described above with reference to the flowcharts can be implemented as computer software programs according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product including a computer program carried on a computer readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication device, or installed from the storage device, or installed from the ROM. When the computer program is executed by the processing device, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.
[0194] The electronic device provided in the present application adopts the motion target tracking method in the above-mentioned embodiments, and solves the technical problem of low compatibility of the motion target tracking method. Compared with the prior art, the electronic device provided in the embodiments of the present application has the same beneficial effects as the motion target tracking method provided in the above-mentioned embodiments, and other technical features in the electronic device are the same as the features disclosed in the previous embodiment method, which will not be repeated here.
[0195] It should be understood that parts of the present disclosure can be realized by hardware, software, firmware or a combination thereof. In the description of the above-mentioned embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0196] The above is merely specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0197] Embodiment Four
[0198] The present embodiment provides a computer readable storage medium having stored thereon computer readable program instructions for performing the motion target tracking method in the above-mentioned embodiment one.
[0199] The computer readable storage medium provided by the embodiments of the present application may, for example, be a U disk, but is not limited to an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system, system, or device, or any combination of the above. More specific examples of the computer readable storage medium may include, but are not limited to, an electric link with one or more conductive lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiments, the computer readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system, or device. The program code contained on the computer readable storage medium can be transmitted by any suitable medium, including but not limited to an electric wire, an optical cable, an RF (radio frequency), and the like, or any suitable combination of the above.
[0200] The computer readable storage medium described above may be contained in an electronic device, or may exist separately without being assembled into an electronic device.
[0201] The computer readable storage medium described above carries one or more programs, when the one or more programs are executed by an electronic device, the electronic device is caused to: when a first moving target appears in a target video image, obtain a first preset number of video frames corresponding to the first moving target, and train an initial target tracking model according to each of the video frames to obtain a target tracking model; track the first moving target through the target tracking model to obtain a tracking state of the first moving target; if the tracking state is a tracking state, obtain a tracking frame and generate a corresponding camera rotation command according to the tracking frame and a center position of the target video image; control the camera to rotate through the camera rotation command to track the first moving target; if the tracking state is not the tracking state, determine a tracking segment state according to the tracking state, and judge whether to reset the camera position according to the tracking segment state.
[0202] Computer program code for carrying out operations of the present disclosure can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be linked to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0203] The flow diagrams and the block diagrams in the drawings are illustrations of architectures, functionalities, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may
[0204] The modules involved in the embodiments of the present disclosure can be implemented in the manner of software or in the manner of hardware. Among them, the name of the module does not constitute a limitation on the unit itself in some cases.
[0205] The computer readable storage medium provided by the present application stores computer readable program instructions for executing the motion target tracking method, and solves the technical problem of low compatibility of the motion target tracking method. Compared with the prior art, the beneficial effects of the computer readable storage medium provided by the embodiments of the present application are the same as those of the motion target tracking method provided by the above-mentioned embodiments, and are not described here.
[0206] Embodiment five
[0207] The application further provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the motion target tracking method as described above.
[0208] The computer program product provided by the application solves the technical problem of low compatibility of the motion target tracking method. Compared with the prior art, the computer program product provided by the embodiment of the application has the same beneficial effects as the motion target tracking method provided by the above-mentioned embodiment, and will not be described here.
[0209] The above is only the preferred embodiment of the application, and does not limit the patent scope of the application, and any equivalent structure or equivalent process transformation using the content of the specification and drawings, or direct or indirect application in other related technical fields, are also included in the patent processing scope of the application.
Claims
1. A moving object tracking method characterized by, The motion target tracking method comprises: When a first motion target appears in a target video image, a first preset number of video frames corresponding to the first motion target are acquired, and an initial target tracking model is trained according to each video frame to obtain a target tracking model; The first motion target is tracked by using the target tracking model to obtain a tracking state of the first motion target; If the tracking state is a tracking state, a tracking frame is acquired, and a corresponding camera rotation command is generated according to the tracking frame and a center position of the target video image; The camera is controlled to rotate by using the camera rotation command to track the first motion target; If the tracking state is not the tracking state, a tracking segment state is determined according to the tracking state, and it is judged whether to reset a camera position according to the tracking segment state, the tracking segment state at least comprising a working state and an undefined state, and the undefined state being used to represent that a tracking segment has ended; The tracking state at least comprises one of a target acquisition state and a training state; Before the step of tracking the first motion target by using the target tracking model to obtain the tracking state of the first motion target, the method further comprises: A target video image of a target scene is acquired by using a camera, the target video image is detected, and the tracking state is set to a target acquisition state; When it is detected that there is a first motion target in the target video image, a video frame in which the first motion target is located is taken as a training frame, and the tracking state is switched to a training state; The initial target tracking model is trained according to the training frame until the training frame reaches the first preset number to obtain the target tracking model.
2. The moving object tracking method of claim 1, wherein, The step of training the initial target tracking model according to the training frame until the training frame reaches the first preset number to obtain the target tracking model comprises: Position information of a current motion target is acquired, and it is judged whether the position information is a same motion target based on a detection frame corresponding to the position information and a detection frame of a previous video frame; If yes, a video frame corresponding to the position information is taken as a training frame to train the initial target tracking model to obtain the target tracking model; If no, the tracking state is switched to a target acquisition state.
3. The moving object tracking method of claim 1, wherein, The tracking state at least comprises a tracking state and a target loss state; The step of tracking the first motion target by using the target tracking model to obtain the tracking state of the first motion target comprises: The first motion target is tracked by using the target tracking model to obtain a tracking result corresponding to each video frame and switch the tracking state to a tracking state; Each tracking result is normalized and analyzed to obtain a confidence degree corresponding to each tracking result; When confidence degrees corresponding to a second preset number of video frames are lower than a first preset confidence threshold, the tracking state is switched to a target loss state; When position information of the first motion target changes by less than a preset distance within a first preset time length, the tracking state is switched to a target acquisition state.
4. The moving object tracking method of claim 3, wherein, The method further comprises, after the step of switching the tracking state to a target loss state: analyzing the second preset number of video frames by the target tracking model to obtain corresponding tracking results and confidence levels of each video frame; if there is a video frame with a confidence level exceeding a second preset confidence threshold in the second preset number of video frames, switching the tracking state to a tracking-in-state; if there is no video frame with a confidence level exceeding the second preset confidence threshold in the second preset number of video frames, switching the tracking state to a target acquisition state, and acquiring each moving target by performing target detection on the target video image; selecting a second moving target from each moving target based on the tracking result of the first moving target; tracking the second moving target by the target tracking model to obtain a tracking result of the second moving target; performing normalized analysis on the tracking result of the second moving target to obtain a confidence level of the tracking result of the second moving target corresponding to each video frame; when the confidence level of the tracking result of the second moving target is not less than the second preset confidence threshold, switching the tracking state to the tracking-in-state; when the confidence levels of the tracking results corresponding to the second preset number of video frames are all less than the second preset confidence threshold, switching the tracking state to the target acquisition state.
5. The moving object tracking method of claim 4, wherein, The step of selecting a second moving target from each moving target based on the tracking result of the first moving target comprises: obtaining corresponding tracking box information in the tracking result of the first moving target and detection box information of each moving target; determining the degree of overlap between the tracking box and each detection box based on the corresponding tracking box information in the tracking result of the first moving target and the detection box information of each moving target; selecting a second moving target based on the degree of overlap between the tracking box and each detection box.
6. The moving object tracking method of claim 1, wherein, The step of determining a tracking segment state according to the tracking state, and judging whether to reset the camera position according to the tracking segment state comprises: when the duration of the tracking state in the target acquisition state reaches a second preset duration, switching the tracking segment state from a working state to an undefined state; when the tracking state is in the undefined state, resetting the camera position and re-detecting the moving target in the target video image.
7. A moving object tracking apparatus characterized by comprising: The moving target tracking device comprises: a model training module configured to, when a first moving target appears in a target video image, acquire a first preset number of video frames corresponding to the first moving target, and train an initial target tracking model according to each video frame to obtain a target tracking model; a target tracking module configured to track the first moving target by the target tracking model to obtain a tracking state of the first moving target; a command generation module configured to, if the tracking state is a tracking-in-state, acquire a tracking box and generate a corresponding camera rotation command according to the tracking box and a center position of the target video image. The motion tracking module is configured to track the first moving target by controlling the camera to rotate according to the camera rotation command. The camera position resetting module is configured to determine a tracking segment state according to the tracking state if the tracking state is not the tracking-in state, and determine whether to reset the camera position according to the tracking segment state. The tracking segment state includes at least a working state and an undefined state, and the undefined state is used to represent that the tracking segment has ended. The tracking state includes at least one of a target acquisition state and a training state. The target tracking module is further configured to acquire a target video image of a target scene by using the camera, detect the target video image, set the tracking state as the target acquisition state, and when the first moving target is detected in the target video image, set a video frame in which the first moving target is located as a training frame, switch the tracking state to the training state, train the initial target tracking model according to the training frame, and obtain the target tracking model until the training frame reaches the first preset number.
8. An electronic device, comprising: The electronic device includes: at least one processor; and a memory communicatively linked to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the motion target tracking method in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a program for implementing a motion target tracking method, and the program is executed by a processor to implement the steps of the motion target tracking method in any one of claims 1 to 6.
Citation Information
Patent Citations
Target tracking method and device
CN108269269A
Tracking recording and playing method and system based on head and shoulder detection
CN110021034A