Object tracking method and device and electronic equipment

By extracting frames from the video and weighting the position frame of the target video frame, the problem of target object position frame drift is solved and the tracking accuracy is improved.

CN118628524APending Publication Date: 2024-09-10BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410817280.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

In the existing technology, the target object position frame in the video frame is prone to drift, resulting in reduced tracking accuracy.

Method used

By extracting frames at preset time intervals in the video, determining the time range of the target video frame, and performing weighting processing based on the position frames of multiple target prior video frames, the drift probability of the target object position frame is reduced.

Benefits of technology

It effectively reduces the drift probability of the target object position frame and improves the tracking precision and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118628524A
    Figure CN118628524A
Patent Text Reader

Abstract

The embodiment of the invention provides an object tracking method and device and electronic equipment, and relates to the technical field of image processing. The method comprises the following steps: performing frame extraction on a target video to obtain a plurality of prior video frames; performing object detection on the plurality of prior video frames to obtain each target position frame; aiming at each target prior video frame with a target position frame in the plurality of prior video frames, determining each video frame in a target time range corresponding to the frame, and obtaining each video frame to be tracked; for target frames located in at least two target time ranges in the obtained to-be-tracked video frames, performing object tracking on the target frames based on target prior video frames corresponding to the at least two target time ranges to obtain candidate position frames; and for the target frame, based on the plurality of candidate position frames of the target frame, determining a position frame tracking result of the target frame for the target object. Through the scheme, the drifting probability of the position frame of the target object can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an object tracking method, device and electronic device. Background Art

[0002] In the process of video production, there is a need to track the position of objects such as trademarks or people in the video frame. For example, the position of the target person in the video is tracked, and another example is the position of the trademark that needs to be erased in the video is tracked.

[0003] In the related art, a deep learning tracking model is usually used to track the target object in the video. Specifically, after determining the target object to be tracked in the video, a corresponding position frame can be generated according to the position and size of the target object, and the position frame can be continuously updated in each subsequent frame to keep tracking the target object and determine the position information of the target object in each video frame.

[0004] However, the inventors discovered during actual operation that the position frame of the target object obtained by using the relevant technology has drift, that is, the area located by the position frame does not match the actual area of ​​the target object.

[0005] Based on this, how to track the target object to reduce the probability of drift of the target object's position frame has become a technical problem that urgently needs to be solved. Summary of the invention

[0006] The purpose of the embodiments of the present application is to provide an object tracking method, device and electronic device to reduce the probability of drift of the position frame of the target object. The specific technical solution is as follows:

[0007] In a first aspect provided by an embodiment of the present application, a method for tracking an object is first provided, the method comprising:

[0008] Extract frames from the target video at a preset time interval to obtain multiple prior video frames;

[0009] Performing object detection on the multiple prior video frames for the target object to obtain each target position frame;

[0010] For each target a priori video frame having a target position frame among the multiple a priori video frames, determine from the target video each video frame within a target time range corresponding to the target a priori video frame, and obtain each to-be-tracked video frame of the target a priori video frame; wherein the target time range corresponding to the target a priori video frame is a time range including the playback time of the target a priori video frame, and the target time ranges corresponding to adjacent target a priori video frames overlap;

[0011] For the target frames in the obtained video frames to be tracked and located in at least two target time ranges, object tracking for the target object is performed on the target frames based on the target priori video frames corresponding to the at least two target time ranges, to obtain candidate position frames;

[0012] For the target frame, based on a plurality of candidate position frames of the target frame, a position frame tracking result for a target object of the target frame is determined.

[0013] Optionally, in a specific implementation, the target time ranges corresponding to adjacent target a priori video frames overlap by no less than a specified duration, and the specified duration is the duration corresponding to the difference between the playback moments corresponding to the two target a priori video frames.

[0014] Optionally, in a specific implementation, the target time range includes a first time range and / or a second time range; the first time range is a time range with the playback time of the target a priori video frame as the starting playback time and having a first duration; the second time range is a time range with the playback time of the target a priori video frame as the ending playback time and having a second duration; the first duration and / or the second duration is greater than the preset time interval.

[0015] Optionally, in a specific implementation, determining, for the target frame, a position frame tracking result for the target object in the target frame based on a plurality of candidate position frames in the target frame includes:

[0016] For the target frame, weighted processing is performed on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame of the target frame to obtain a position frame tracking result for the target object of the target frame;

[0017] The weight of each candidate position frame is: a weight determined based on the time difference between the target frame and the target prior video frame used to track the candidate position frame; the larger the time difference, the smaller the determined weight.

[0018] Optionally, in a specific implementation manner, before performing weighted processing on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame of the target frame to obtain the position frame tracking result for the target object of the target frame, the method further includes:

[0019] For the target frame, determining each candidate position frame belonging to the same target object in the target frame, and forming a position frame group of the target frame with each candidate position frame belonging to the same target object;

[0020] The step of performing weighted processing on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame of the target frame to obtain a position frame tracking result for the target object of the target frame includes:

[0021] For the target frame, the position information of each candidate position frame in the position frame group of the target frame is weighted according to the corresponding weight to obtain the position frame tracking result of the target object represented by the position frame group.

[0022] Optionally, in a specific implementation, when there are multiple target frames and multiple target objects, after obtaining the position box tracking result for the target object in each target frame, the method further includes:

[0023] The location box tracking results belonging to the same target object are clustered to obtain the final location box tracking result for each target object.

[0024] Optionally, in a specific implementation, a method for determining the location box tracking results belonging to the same target object includes:

[0025] Based on the playback time of each target frame in the target video, multiple position frame tracking results that meet the screening conditions are determined to obtain position frame tracking results belonging to the same target object; wherein the screening conditions include: the target frames are video frames with continuous playback times, and the position areas represented by any two position frame tracking results that meet the adjacent relationship have an overlapping area greater than a predetermined threshold; the adjacent relationship is that the target frames are adjacent video frames;

[0026] or,

[0027] For each position frame group, a position frame group associated with the position frame group is determined as the position frame group to be divided; the position frame tracking result corresponding to the position frame group and the position frame tracking result corresponding to the position frame group to be divided are determined as position frame tracking results belonging to the same target object; the position frame tracking results belonging to the same target object are divided into a result set for the target object; wherein the position frame group associated with the position frame group and the position frame group contain candidate position frames obtained by tracking the same target position frame.

[0028] Optionally, in a specific implementation, determining, for the target frame, candidate position boxes belonging to the same target object in the target frame includes:

[0029] For the target frame, calculating the intersection-and-union ratio of any two candidate position frames of the target frame; determining each candidate position frame whose calculated intersection-and-union ratio is greater than a preset intersection-and-union ratio as each candidate position frame belonging to the same target object in the target frame;

[0030] or,

[0031] For the target frame, each candidate position frame having an overlapping portion with an area greater than a preset area is determined as each candidate position frame belonging to the same target object in the target frame.

[0032] Optionally, in a specific implementation, a method for calculating the weight of each candidate position box in the position box group in the target frame includes:

[0033] For the target frame, a predetermined first formula is used to calculate the weight of each candidate position frame in the position frame group of the target frame; wherein the first formula includes:

[0034]

[0035] Wherein, W is the weight of any candidate position frame in the position frame group of the target frame, TD is the inverse of the time difference between the target frame and the target prior video frame corresponding to any candidate position frame, n represents the total number of candidate position frames in the position frame group, TD i is the reciprocal of the time difference between the target frame and the target a priori video frame corresponding to the i-th candidate position frame in the position frame group.

[0036] In a second aspect provided by an embodiment of the present application, an object tracking device is further provided, the device comprising:

[0037] A frame extraction module is used to extract frames of the target video at a preset time interval to obtain multiple prior video frames;

[0038] A detection module, configured to perform object detection on the plurality of prior video frames for the target object to obtain respective target position frames;

[0039] The module for determining the video frame to be tracked is used to determine, from the target video, each video frame within a target time range corresponding to the target a priori video frame having a target position frame among the multiple a priori video frames, and obtain each video frame to be tracked of the target a priori video frame; wherein the target time range corresponding to the target a priori video frame is a time range including the playback time of the target a priori video frame, and the target time ranges corresponding to adjacent target a priori video frames overlap;

[0040] A candidate position frame determination module is used to perform object tracking for a target object on a target frame located in at least two target time ranges in the obtained video frames to be tracked, based on target prior video frames corresponding to the at least two target time ranges, to obtain a candidate position frame;

[0041] The position frame merging module is used to determine, for the target frame, a position frame tracking result for the target object in the target frame based on a plurality of candidate position frames in the target frame.

[0042] Optionally, in a specific implementation, the target time ranges corresponding to adjacent target a priori video frames overlap by no less than a specified duration, and the specified duration is the duration corresponding to the difference between the playback moments corresponding to the two target a priori video frames.

[0043] Optionally, in a specific implementation, the target time range includes a first time range and / or a second time range; the first time range is a time range with the playback time of the target a priori video frame as the starting playback time and having a first duration; the second time range is a time range with the playback time of the target a priori video frame as the ending playback time and having a second duration; the first duration and / or the second duration is greater than the preset time interval.

[0044] Optionally, in a specific implementation, the position frame merging module is specifically used to:

[0045] For the target frame, weighted processing is performed on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame of the target frame to obtain a position frame tracking result for the target object of the target frame;

[0046] The weight of each candidate position frame is: a weight determined based on the time difference between the target frame and the target prior video frame used to track the candidate position frame; the larger the time difference, the smaller the determined weight.

[0047] Optionally, in a specific implementation, the device further includes:

[0048] a position frame group determination module, for performing weighted processing on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame of the target frame, and determining each candidate position frame belonging to the same target object in the target frame before obtaining the position frame tracking result for the target object of the target frame, and forming a position frame group of the target frame with each candidate position frame belonging to the same target object;

[0049] The position frame merging module is specifically used for:

[0050] For the target frame, the position information of each candidate position frame in the position frame group of the target frame is weighted according to the corresponding weight to obtain the position frame tracking result of the target object represented by the position frame group.

[0051] Optionally, in a specific implementation, when there are multiple target frames and multiple target objects, the device further includes:

[0052] The target object clustering module is used to cluster the position frame tracking results belonging to the same target object after obtaining the position frame tracking results for the target object in each target frame, so as to obtain the final position frame tracking results for each target object.

[0053] Optionally, in a specific implementation, a method for determining the location box tracking results belonging to the same target object includes:

[0054] Based on the playback time of each target frame in the target video, multiple position frame tracking results that meet the screening conditions are determined to obtain position frame tracking results belonging to the same target object; wherein the screening conditions include: the target frames are video frames with continuous playback times, and the position areas represented by any two position frame tracking results that meet the adjacent relationship have an overlapping area greater than a predetermined threshold; the adjacent relationship is that the target frames are adjacent video frames;

[0055] or,

[0056] For each position frame group, a position frame group associated with the position frame group is determined as the position frame group to be divided; the position frame tracking result corresponding to the position frame group and the position frame tracking result corresponding to the position frame group to be divided are determined as position frame tracking results belonging to the same target object; the position frame tracking results belonging to the same target object are divided into a result set for the target object; wherein the position frame group associated with the position frame group and the position frame group contain candidate position frames obtained by tracking the same target position frame.

[0057] Optionally, in a specific implementation, the position frame group determination module is specifically used to:

[0058] For the target frame, calculate the intersection-and-union ratio of any two candidate position frames of the target frame; determine each candidate position frame whose calculated intersection-and-union ratio is greater than a preset intersection-and-union ratio as a candidate position frame belonging to the same target object in the target frame; or, for the target frame, determine each candidate position frame whose area of ​​overlapping parts of the target frame is greater than a preset area as a candidate position frame belonging to the same target object in the target frame.

[0059] Optionally, in a specific implementation, a method for calculating the weight of each candidate position box in the position box group in the target frame includes:

[0060] For the target frame, a predetermined first formula is used to calculate the weight of each candidate position frame in the position frame group of the target frame; wherein the first formula includes:

[0061]

[0062] Wherein, W is the weight of any candidate position frame in the position frame group of the target frame, TD is the inverse of the time difference between the target frame and the target prior video frame corresponding to any candidate position frame, n represents the total number of candidate position frames in the position frame group, TD i is the reciprocal of the time difference between the target frame and the target a priori video frame corresponding to the i-th candidate position frame in the position frame group.

[0063] In the third aspect provided by the embodiment of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; the processor is used to implement any object tracking method provided in the first aspect when executing the program stored in the memory.

[0064] In another aspect of the embodiments of the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any object tracking method provided in the first aspect is implemented.

[0065] In another aspect of the embodiments of the present application, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any object tracking method provided in the first aspect.

[0066] The solution provided by the embodiment of the present application, when performing object tracking, first, extract frames of the target video at a preset time interval to obtain multiple a priori video frames, thereby performing object detection for the target object on the obtained multiple a priori video frames respectively, and obtaining each target position frame. Then, for each target a priori video frame with a target position frame in the multiple a priori video frames, determine from the target video each video frame within the target time range corresponding to the target a priori video frame, and obtain each video frame to be tracked of the target a priori video frame. In this way, for the target frames in the obtained video frames to be tracked that are located in at least two target time ranges, the target frames can be respectively based on the target a priori video frames corresponding to each of the at least two target time ranges, and the target frames can be tracked for the target objects to obtain candidate position frames, thereby, for the target frame, based on the multiple candidate position frames of the above target frame, the position frame tracking result for the target object of the above target frame is determined.

[0067] Based on this, by applying the scheme provided by the embodiment of the present application, after determining the target a priori video frame with the target position frame, the time range containing the playback moment of the target a priori video frame can be determined in the target video as the target time range corresponding to the target a priori video frame, and the target time ranges corresponding to adjacent target a priori video frames overlap, so that the target frame within the above-mentioned overlapping time range can be used as a video frame to be tracked of different target a priori video frames, that is, the same video frame to be tracked can contain different target a priori video frames that are tracked to the candidate position frame of the video frame. In this way, when tracking the position frame of the determined target frame, the position frames in multiple target a priori video frames can be referenced, thereby reducing the possibility that the position frame of the target object of the target frame has drift. It can be seen that through this scheme, the probability of drift of the position frame of the target object can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0069] FIG. 1( a ) is a schematic diagram of matching an area located by a position box with a real area of ​​a target object provided by an embodiment of the present application;

[0070] FIG1( b ) is a schematic diagram showing that an area located by a position box provided in an embodiment of the present application does not match a real area of ​​a target object;

[0071] Figure 2 A schematic diagram of a flow chart of a first object tracking method provided in an embodiment of the present application;

[0072] Figure 3 A schematic diagram of a flow chart of a second object tracking method provided in an embodiment of the present application;

[0073] Figure 4 A schematic diagram of a flow chart of a third object tracking method provided in an embodiment of the present application;

[0074] Figure 5 A schematic diagram of a specific embodiment provided for the present application;

[0075] Figure 6 A flowchart of another specific embodiment provided for the embodiment of the present application;

[0076] Figure 7 A schematic diagram of generating 9 anchor frames of different sizes for one pixel provided in an embodiment of the present application;

[0077] Figure 8 A schematic diagram of a single trademark tracking process based on trademark detection provided in an embodiment of the present application

[0078] Fig. 9 A schematic diagram of the structure of an object tracking device provided in an embodiment of the present application;

[0079] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0080] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.

[0081] In order to facilitate the understanding of this solution, the following first introduces the professional terms involved in this application:

[0082] Object tracking is one of the important applications in the field of computer vision. It is currently widely used in sports broadcasting, security monitoring, drones and unmanned vehicles. Existing object tracking technologies can be roughly divided into two categories: online tracking and offline tracking. Among them, online tracking requires real-time processing of tracking tasks. According to the position of the target object in the current frame and the position of the past frame to be tracked, the position of the target object in the future frame is tracked. Offline tracking can determine the position information of the target object based on the position information of the past frame, current frame and future frame containing the target object.

[0083] In the process of video production, there is a need to track the position of objects such as trademarks or people in the video frame. For example, the position of the target person in the video is tracked, and another example is the position of the trademark that needs to be erased in the video. In the related art, the object tracking is usually performed by offline tracking.

[0084] In the related art, a deep learning tracking model is usually used to track the target object in the video. Specifically, after determining the target object to be tracked in the video, a corresponding position frame can be generated according to the position and size of the target object, and the position frame can be continuously updated in each subsequent frame to keep tracking the target object and determine the position information of the target object in each video frame.

[0085] However, the inventors discovered during actual operation that the position frame of the target object obtained using the relevant technology drifts, that is, the area located by the position frame does not match the real area of ​​the target object. For example, FIG1(a) is a schematic diagram of a position frame provided in an embodiment of the present application, in which the area located by the position frame matches the real area of ​​the target object, and FIG1(b) is a schematic diagram of a position frame provided in an embodiment of the present application, in which the area located by the position frame does not match the real area of ​​the target object, that is, the position frame of the target object drifts.

[0086] Based on this, how to track the target object to reduce the probability of drift of the target object's position frame has become a technical problem that urgently needs to be solved.

[0087] The following is an explanation of the reasons why the position frame of the target object drifts:

[0088] 1. The target object may change its posture when in motion, causing the features and appearance of the target object to change, thus causing the deep learning tracking model to fail to track the target object. For example, athletes in sports games, pedestrians on the road, etc.

[0089] 2. When the size of the target object is reduced, since the location box of the target object cannot be adaptively tracked, a lot of background information in the video other than the target object will be included, resulting in update errors of the deep learning tracking model; when the size of the target object is increased, since the location box of the target object cannot completely include the target object, the information about the target object in the location box is incomplete, resulting in update errors of the deep learning tracking model.

[0090] 3. The target object may be obscured or disappear temporarily during the movement. In this case, the location frame of the target object is likely to include the obstruction and background information in the frame, causing the location frame in subsequent frames to drift above the obstruction. If the target object is completely obscured, the deep learning tracking model will not be able to find the target object and the object tracking will fail.

[0091] 4. Changes in light intensity, rapid movement of the target object, low image resolution, etc. can cause the deep learning tracking model to be unable to find the target object and object tracking to fail, especially when the moving target object is similar to the background information.

[0092] It should be noted that the above four reasons are exemplary reasons for causing the position box of the target object to drift.

[0093] In order to solve the technical problem of how to track a target object to reduce the probability of drift of a position frame of the target object, an embodiment of the present application provides an object tracking method, device and electronic device.

[0094] Among them, the method can be applied to various application scenarios for tracking target objects in videos. For example, the position of a target person in a video is tracked, and for another example, the position of a trademark that needs to be erased in a video is tracked. In addition, the method can be applied to various electronic devices such as laptops, tablet computers, and desktop computers, hereinafter referred to as electronic devices. Based on this, the embodiments of the present application do not limit the application scenarios and execution subjects of the method.

[0095] An object tracking method provided in an embodiment of the present application may include the following steps:

[0096] Extract frames from the target video at a preset time interval to obtain multiple prior video frames;

[0097] Performing object detection on the multiple prior video frames for the target object respectively to obtain each target position frame;

[0098] For each target a priori video frame having a target position frame among the multiple a priori video frames, determine from the target video each video frame within a target time range corresponding to the target a priori video frame, and obtain each to-be-tracked video frame of the target a priori video frame; wherein the target time range corresponding to the target a priori video frame is a time range including the playback time of the target a priori video frame, and the target time ranges corresponding to adjacent target a priori video frames overlap;

[0099] For the target frames in the obtained video frames to be tracked and located in at least two target time ranges, object tracking is performed on the target object based on the target prior video frames corresponding to the at least two target time ranges, to obtain candidate position frames;

[0100] For the target frame, based on a plurality of candidate position frames of the target frame, a position frame tracking result for a target object of the target frame is determined.

[0101] As can be seen from the above, by applying the solution provided by the embodiment of the present application, when tracking an object, first, the target video is framed at a preset time interval to obtain a plurality of a priori video frames, and then, the plurality of a priori video frames obtained are respectively subjected to object detection for the target object to obtain each target position frame. Then, for each target a priori video frame having a target position frame in the plurality of a priori video frames, each video frame within the target time range corresponding to the target a priori video frame is determined from the target video to obtain each video frame to be tracked of the target a priori video frame. In this way, for the target frames in the obtained video frames to be tracked that are located in at least two target time ranges, the target frames can be respectively subjected to object tracking for the target object based on the target a priori video frames corresponding to each of the at least two target time ranges to obtain a candidate position frame, and thus, for the target frame, based on the plurality of candidate position frames of the target frame, the position frame tracking result for the target object of the target frame can be determined.

[0102] Based on this, by applying the scheme provided by the embodiment of the present application, after determining the target a priori video frame with the target position frame, the time range containing the playback moment of the target a priori video frame can be determined in the target video as the target time range corresponding to the target a priori video frame, and the target time ranges corresponding to adjacent target a priori video frames overlap, so that the target frame within the above-mentioned overlapping time range can be used as a video frame to be tracked of different target a priori video frames, that is, the same video frame to be tracked can contain different target a priori video frames that are tracked to the candidate position frame of the video frame. In this way, when tracking the position frame of the determined target frame, the position frames in multiple target a priori video frames can be referenced, thereby reducing the possibility that the position frame of the target object of the target frame has drift. It can be seen that through this scheme, the probability of drift of the position frame of the target object can be reduced.

[0103] An object tracking method provided in an embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0104] Figure 2 A flowchart of an object tracking method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the method includes the following steps S201-S205.

[0105] S201: Extract frames of a target video at a preset time interval to obtain a plurality of prior video frames.

[0106] In this application, considering that objects such as people and trademarks in a video are edited together with the original video, when tracking objects such as people and trademarks in a video, it is necessary to determine the position information of the object in each video frame including the above-mentioned object in the video. However, in a complete video, the number of video frames including the target object is huge.

[0107] Therefore, when tracking an object, first, the target video can be sampled at a preset time interval to obtain multiple prior video frames. Compared with the video frames to be tracked mentioned later, object detection needs to be performed on the multiple prior video frames. Therefore, in terms of naming, the multiple prior video frames can also be referred to as multiple frames to be detected.

[0108] Optionally, the preset time interval is a duration corresponding to a specified value, wherein the specified value may be 1 second, 5 seconds, etc., or may be 5 frames, 10 frames, etc., which is not specifically limited in the embodiment of the present application.

[0109] S202: Perform object detection on the target object on each of the multiple prior video frames to obtain each target position frame.

[0110] In the present application, the electronic device can perform object detection for the target object on the multiple a priori video frames obtained by the extraction of frames according to a predetermined detection algorithm; thereby, in the multiple a priori video frames, each target a priori video frame containing the target object is determined, and after each target a priori video frame is determined, the target position frame corresponding to the target object is generated according to the position information and size of the target object in the target a priori video frame. It should be noted that since the multiple a priori video frames are obtained by extraction, and any frame obtained by extraction may or may not contain the target object, each frame in the multiple a priori video frames may have a target position frame, and of course, the target position frame may also exist in some video frames. In addition, the target object in the present application may be a pre-specified object, such as a trademark object, a character object or other object, and the present application does not specifically limit the target object.

[0111] Optionally, in one implementation, a predetermined detection algorithm is used to perform object detection on multiple a priori video frames for target objects to obtain each target position frame. The predetermined detection algorithm may be an anchor-frame-based target detection algorithm, a YOLO (You Only Look Once) algorithm, an SSD (Single Shot MultiBox Detector) algorithm, etc., which is not specifically limited in the present embodiment of the application.

[0112] S203: For each target a priori video frame having a target position frame among the multiple a priori video frames, determine from the target video each video frame within a target time range corresponding to the target a priori video frame, and obtain each to-be-tracked video frame of the target a priori video frame.

[0113] The target time range corresponding to the target a priori video frame is a time range including the playback time of the target a priori video frame, and the target time ranges corresponding to adjacent target a priori video frames overlap.

[0114] In the present application, taking into account that the position frames of the same target object in different video frames may be different, after determining each target prior video frame with a target position frame in multiple prior video frames, it is possible to determine, for each target prior video frame, each video frame within the target time range corresponding to the target prior video frame from the target video, as each video frame to be tracked of the target prior video frame, thereby performing object tracking for each determined video frame to be tracked, that is, tracking the position frame.

[0115] Therefore, when determining the video frame to be tracked corresponding to each target a priori video frame having a target position frame in multiple a priori video frames, the play time of the target a priori video frame in the target video can be determined first. In this way, the time range containing the play time of the target a priori video frame can be determined from the target video as the target time range corresponding to the target a priori video frame. In this way, each video frame within the target time range corresponding to the target a priori video frame is determined, and each video frame to be tracked of the target a priori video frame is obtained.

[0116] Among them, the target time ranges corresponding to adjacent target prior video frames overlap, so that there are repeatedly determined video frames to be tracked in the video frames to be tracked corresponding to each target prior video frame, that is, each video frame to be tracked within the above-mentioned overlapping time range can be used as a video frame to be tracked of a different target prior video frame, and the same video frame to be tracked can contain candidate position boxes of different target prior video frames tracked to the video frame.

[0117] Optionally, in a specific implementation, the target time ranges corresponding to adjacent target a priori video frames overlap by no less than a specified duration, and the specified duration is the duration corresponding to the difference between the playback moments corresponding to the two target a priori video frames.

[0118] In the present implementation, in order to increase the possibility that the same video frame to be tracked contains candidate position frames tracked by different target prior video frames to the video frame, that is, to increase the possibility that the same video frame to be tracked contains multiple candidate position frames tracked by different target prior videos to the video frame to be tracked, and in order to reduce the missed detection rate of video frames to be tracked in which target objects exist, the target time ranges corresponding to adjacent target prior video frames overlap for a duration that is not less than the duration corresponding to the difference between the playback times corresponding to the two target prior video frames.

[0119] Optionally, in a specific implementation, the target time range includes a first time range and / or a second time range; the first time range is a time range with the playback time of the target priori video frame as the starting playback time and having a first duration; the second time range is a time range with the playback time of the target priori video frame as the ending playback time and having a second duration; the first duration and / or the second duration is greater than the preset time interval.

[0120] In this implementation, the target time range includes the first time range and / or the second time range, specifically:

[0121] When the target time range includes the first time range, the electronic device can determine each video frame in the first time range with the playing time of the target a priori video frame as the starting playing time and having the first duration as the video frame to be tracked corresponding to the target a priori video frame. In other words, each video frame in the target video within the first duration after the playing time corresponding to the target a priori video frame is determined as the video frame to be tracked corresponding to the target a priori video frame.

[0122] The first duration is a predetermined duration, for example, 1 second, 3 seconds, 5 frames, 10 frames, etc. This embodiment of the present application does not make any specific limitation on this.

[0123] When the target time range includes the second time range, the electronic device can determine each video frame within the time range with the playback moment of the target a priori video frame as the end playback moment and having the second duration as the video frame to be tracked corresponding to the target a priori video frame. In other words, each video frame within the second duration before the playback moment corresponding to the target a priori video frame in the target video is determined as each video frame to be tracked corresponding to the target a priori video frame.

[0124] The second duration is a predetermined duration, for example, 1 second, 3 seconds, 5 frames, 10 frames, etc. This embodiment of the present application does not make any specific limitation on this.

[0125] When the target time range includes a first time range and a second time range, the electronic device can determine a first range with a first duration and a playback time of the target a priori video frame as the starting playback time, and a second range with a second duration and a playback time of the target a priori video frame as the ending playback time, thereby determining each video frame within the first range and the second range as each video frame to be tracked corresponding to the target a priori video frame. That is, each video frame within the range from the starting time corresponding to the first time range to the ending time corresponding to the second time range in the target video is determined as each video frame to be tracked corresponding to the target a priori video frame.

[0126] In this way, since the position frames of the same target object in different video frames may be different, and the time intervals between the determined target prior video frames are also different, therefore, by determining the video frames whose playback time is within the target time range corresponding to each target prior video frame as the video frames to be tracked corresponding to the target prior video frame, it is possible to make the determined video frames to be tracked corresponding to each target prior video frame contain repeatedly determined video frames to be tracked, that is, the same video frame to be tracked contains candidate position frames tracked to the video frame by different target prior video frames, so that the same video frame to be tracked can use the corresponding multiple target prior video frames as object tracking benchmarks, and finally achieve the purpose of expanding the reference information used in object tracking, so as to reduce the probability of drift of the position frame of the target object, thereby improving the accuracy of the determined position information of the target object.

[0127] In addition, in order to increase the possibility of tracking candidate position frames of different target prior video frames contained in the same video frame to be tracked to the video frame, the above-mentioned first duration and / or second duration is greater than the preset time interval based on which the target video is extracted. In this way, by increasing the number of candidate position frames of different target prior video frames contained in the same video frame to be tracked to the video frame, the accuracy of the position information of the target object subsequently determined by weighted processing of multiple candidate position frames can be improved.

[0128] Furthermore, the first duration and / or the second duration is / are greater than the preset time interval, which can also reduce the missed detection rate of the to-be-tracked video frame in which the target object exists.

[0129] S204: For the target frames in the obtained video frames to be tracked that are located in at least two target time ranges, object tracking is performed on the target frames for the target objects based on the target priori video frames corresponding to the at least two target time ranges, to obtain candidate position frames.

[0130] In the present application, after determining the video frames to be tracked corresponding to each target prior video frame, the electronic device can determine the video frames to be tracked that are located in at least two target time ranges as target frames from the obtained video frames to be tracked, thereby performing object tracking for the target object on the determined target frames based on the target prior video frames corresponding to the at least two target time ranges, respectively, to obtain candidate position frames.

[0131] Optionally, in one implementation, for each target a priori video frame, based on the target position frame in the target a priori video frame, a predetermined tracking algorithm is used to perform object tracking on the corresponding video frame to be tracked to obtain a candidate position frame.

[0132] Among them, the above-mentioned predetermined tracking algorithm may include a feature matching algorithm, a deep learning tracking algorithm, etc., to which the embodiments of the present application do not make specific limitations.

[0133] Optionally, since the amount of calculation required by the predetermined tracking algorithm is much smaller than that of the predetermined detection algorithm, the use of the predetermined tracking algorithm will be significantly faster than the calculation speed when the predetermined detection algorithm is used, and the obtained position frame is more stable. However, the predetermined tracking algorithm requires a priori position frame as a matching anchor point of the target object to be performed. Based on this, the predetermined detection algorithm can be used to roughly determine the time point position of the target priori video frame with the target position frame in advance, and then, the predetermined tracking algorithm is used to track and determine the time point position of all video frames including the target object in the target video based on the time point position of the above target priori video frame, thereby improving the efficiency of determining the position frame and further improving the efficiency of object tracking.

[0134] The above time point is the playback moment of the video frame in the target video.

[0135] S205: For the target frame, based on a plurality of candidate position frames of the target frame, determine a position frame tracking result for the target object of the target frame.

[0136] In the present application, the video frame to be tracked determined by the above step S203 can make the same video frame be used as the video frame to be tracked of different target a priori video frames. In this way, after object tracking for the target object is performed on the corresponding video frame to be tracked based on the target position frame in each target a priori video frame, the same video frame to be tracked can contain candidate position frames of different target a priori video frames tracked to the video frame. Therefore, there will be at least two candidate position frames in the target frame located within at least two target time ranges.

[0137] In this way, when tracking the position frame of the determined target frame, multiple target prior video frames can be referenced to track the candidate position frame of the target frame, thereby reducing the possibility of drift of the position frame of the target object in the target frame.

[0138] Optionally, in a specific implementation, Figure 3 As shown, in an object tracking method provided in an embodiment of the present application, the above step S205 may include the following steps:

[0139] Step S2051: for the target frame, weighted processing is performed on the position information of each candidate position frame in the target frame according to the weight of each candidate position frame in the target frame to obtain a position frame tracking result for the target object in the target frame.

[0140] The weight of each candidate position frame is: a weight determined based on the time difference between the target frame and the target prior video frame used to track the candidate position frame; the larger the difference, the smaller the determined weight.

[0141] In the present application, since the candidate position frame contained in the target frame determined by the above step S204 is obtained by tracking the target frame based on the target position frame itself, which corresponds to the target prior video frame of at least two target time ranges. Therefore, it can be determined that the weight of each candidate position frame in the target frame is correlated with the video frame corresponding to the candidate position frame, that is, for the target frame, the weight of each candidate position frame in the target frame is determined based on the time difference between the target frame and the target prior video frame corresponding to each candidate position frame in the target frame. Thus, after determining the weight of each candidate position frame in the target frame, the electronic device can perform weighted processing on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame in the target frame, and obtain the position frame tracking result for the target object of the target frame.

[0142] Among them, considering that the larger the time difference between the target frame and the target a priori video frame used to track the candidate position frame, the less effective information is provided for determining the position frame tracking result of the target frame, that is, the smaller the importance of the candidate position frame in the target frame. Therefore, the larger the time difference between the two frames, the smaller the weight of the determined candidate position frame, that is, the weight of each candidate position frame has a negative correlation with the video frame corresponding to the candidate position frame.

[0143] In this way, based on the time difference between the target prior video frame corresponding to different candidate frames and the target frame, the weights corresponding to different candidate position frames are determined, and then the position information of each candidate position frame is weighted according to the determined weights to improve the accuracy of the position frame tracking result for the target object of the target frame.

[0144] Optionally, in one implementation, for the target frame, a predetermined second formula is used to calculate the weight of each candidate position box in the target frame; wherein the second formula includes:

[0145]

[0146] Wherein, w is the weight of any candidate position frame in the target frame, td is the inverse of the time difference between the target frame and the target prior video frame corresponding to any candidate position frame, n represents the total number of candidate position frames in the target frame, and td i It is the reciprocal of the time difference between the target frame and the target prior video frame corresponding to the i-th candidate position box in the target frame.

[0147] In this implementation, for each candidate position box in the target frame, the greater the timing difference between the target prior video frame corresponding to the candidate position box and the target frame, the smaller the importance of the candidate position box in the target frame, and accordingly, the smaller the weight corresponding to the candidate position box.

[0148] Optionally, the weight of each candidate position box is: a weight determined based on a confidence score that the candidate position box contains the target object in the target frame; wherein the higher the confidence score, the greater the determined weight.

[0149] In this implementation, considering that the higher the confidence score of the candidate position frame containing the target object in the target frame, the higher the image similarity between the regional image corresponding to the area occupied by the candidate position frame and the image containing the target object, and correspondingly, the higher the probability that the position information corresponding to the candidate position frame does not have a drift problem relative to the actual position information of the target object, at this time, the position information about the position frame that the candidate position frame can provide is more effective information for determining the position frame tracking result of the target frame, that is, the candidate position frame is more important in the target frame. Therefore, the higher the confidence score of the candidate position frame, the greater the weight of the determined candidate position frame, that is, the weight of each candidate position frame has a positive correlation with the confidence score of the candidate position frame in the target frame.

[0150] In this way, for the target frame, the confidence score corresponding to each candidate position box in the target frame is determined, and thus, based on the determined confidence score, the weight corresponding to the candidate position box is determined.

[0151] Correspondingly, optionally, in one implementation, for the target frame, a predetermined fifth formula is used to calculate the weight of each candidate position box in the target frame; wherein the fifth formula includes:

[0152]

[0153] Wherein, w is the weight of any candidate position frame in the target frame, zd is the confidence score of any candidate position frame in the target frame, n represents the total number of candidate position frames in the target frame, and zd i is the confidence score corresponding to the i-th candidate location box in the target frame.

[0154] It should be noted that weighted processing is performed on each candidate position frame of the video frame to be tracked, which can be understood as weighted processing is performed on the position information of each candidate position frame of the video frame to be tracked.

[0155] Furthermore, exemplarily, in one implementation, the position information of any candidate position box can be represented by the coordinate information of four corner points, for example: represented by the coordinate information of the upper left corner point, the lower left corner point, the upper right corner point and the lower right corner point. At this time, the so-called weighted processing of each candidate position box can be specifically: weighted processing is performed on the coordinate information of the same corner points of each candidate position box, so as to obtain the weighted processing result of each corner point as the position box tracking result for the target object of the video frame to be tracked.

[0156] As another example, in another implementation, the position information of any candidate position box can be represented by the coordinate information of the specified position point, the width and height of the candidate position box, and the specified position point can be the center point or any corner point; at this time, the so-called weighted processing of each candidate position box can be specifically: weighted processing of the coordinate information of the specified position point of each candidate position box, and weighted processing of the width and height of each candidate position box respectively, so as to obtain the weighted processing result as the position box tracking result for the target object of the video frame to be tracked.

[0157] In this way, by performing weighted processing on each candidate position frame of the target frame according to the determined weight, the purpose of obtaining the position frame tracking result for the target object of the target frame by utilizing multiple candidate position frames is achieved. Thus, the obtained position frame tracking result is determined as the position frame of the target object in the target frame, and further, the position information of the target object in the target frame can be determined.

[0158] Optionally, in one implementation, for each candidate position frame in the target frame, the time difference between the target frame and the target a priori video frame corresponding to the candidate position frame is calculated in the following manner:

[0159] Determine the first frame number of the target frame in the target video, and the second frame number of the target a priori video frame corresponding to the candidate position frame in the target video; calculate the frame number difference between the first frame number and the second frame number as the time difference between the target frame and the target a priori video frame corresponding to the candidate position frame;

[0160] or,

[0161] Determine the first playback time of the target frame in the target video, and the second playback time of the target a priori video frame corresponding to the candidate position frame in the target video; calculate the duration difference between the first playback time and the second playback time as the timing difference between the target frame and the target a priori video frame corresponding to the candidate position frame.

[0162] Optionally, in an implementation manner, for a target frame, according to the weights of each candidate position frame in the target frame, a predetermined third formula is used to perform weighted processing on the position information of each candidate position frame of the target frame to obtain a position frame tracking result for the target object of the target frame; wherein the third formula includes:

[0163]

[0164] Among them, p is the position box tracking result of the target object in the target frame, w i is the weight of the i-th candidate position box in the target frame, t i is the position information of the i-th candidate position frame in the target frame, and n represents the total number of candidate position frames in the target frame.

[0165] In the present implementation, the target a priori video frame corresponding to each candidate position frame in the target frame is determined, and the time difference between the target frame and the target frame is determined to determine the weight corresponding to each candidate position frame, so that the position information of each candidate position frame of the target frame is weighted according to the corresponding weight, thereby tracking the candidate position frame of the target frame through different target a priori video frames contained in the same target frame, and determining the position frame tracking result for the target object of the target frame, so that when the position frame of the target object of the target frame is tracked, the position frames in multiple target a priori video frames can be referred to, so that the difference between the position information of the position frame for the target object obtained in the target frame and the actual position information of the target object is smaller, and the possibility of drift of the position frame of the target object is reduced, so as to improve the accuracy of the obtained position frame tracking result and the accuracy of the determined position information of the target object.

[0166] Optionally, in one implementation, for the target frame, the average position information of the position information corresponding to each candidate position frame of the target frame is calculated, and the position frame corresponding to the calculated average position information is used as the position frame tracking result for the target object of the video frame to be tracked.

[0167] Optionally, in one implementation, for a target frame, a position frame corresponding to position information corresponding to a maximum overlapping area between candidate position frames of the target frame is used as a position frame tracking result for a target object of the target frame.

[0168] In this way, by processing the position information of the candidate position boxes of the target frame tracked from multiple different target prior video frames, the possibility of drift between the position box of the target object in the target frame and the position of the target object is reduced, thereby achieving tracking of the target object and improving the accuracy of the position information of the determined target object.

[0169] As can be seen from the above, by applying the solution provided by the embodiment of the present application, when tracking an object, first, the target video is framed at a preset time interval to obtain a plurality of a priori video frames, and then, the plurality of a priori video frames obtained are respectively subjected to object detection for the target object to obtain each target position frame. Then, for each target a priori video frame having a target position frame in the plurality of a priori video frames, each video frame within the target time range corresponding to the target a priori video frame is determined from the target video to obtain each video frame to be tracked of the target a priori video frame. In this way, for the target frames in the obtained video frames to be tracked that are located in at least two target time ranges, the target frames can be respectively subjected to object tracking for the target object based on the target a priori video frames corresponding to each of the at least two target time ranges to obtain a candidate position frame, and thus, for the target frame, based on the plurality of candidate position frames of the target frame, the position frame tracking result for the target object of the target frame can be determined.

[0170] Based on this, by applying the scheme provided by the embodiment of the present application, after determining the target a priori video frame with the target position frame, the time range containing the playback moment of the target a priori video frame can be determined in the target video as the target time range corresponding to the target a priori video frame, and the target time ranges corresponding to adjacent target a priori video frames overlap, so that the target frame within the above-mentioned overlapping time range can be used as a video frame to be tracked of different target a priori video frames, that is, the same video frame to be tracked can contain different target a priori video frames that are tracked to the candidate position frame of the video frame. In this way, when tracking the position frame of the determined target frame, the position frames in multiple target a priori video frames can be referenced, thereby reducing the possibility that the position frame of the target object of the target frame has drift. It can be seen that through this scheme, the probability of drift of the position frame of the target object can be reduced.

[0171] Optionally, in one embodiment, Figure 4 As shown, in an object tracking method provided in an embodiment of the present application, in the above step S2051, for the target frame, according to the weights of each candidate position frame in the target frame, weighted processing is performed on the position information of each candidate position frame of the target frame to obtain the position frame tracking result for the target object of the target frame, and the following steps may also be included:

[0172] S401: for a target frame, determining various candidate position frames belonging to the same target object in the target frame, and forming a position frame group of the target frame with various candidate position frames belonging to the same target object;

[0173] Accordingly, the above step S2051 may include the following steps:

[0174] S402: For the target frame, weight the position information of each candidate position frame in the position frame group of the target frame according to the corresponding weight to obtain the position frame tracking result of the target object represented by the position frame group.

[0175] In this embodiment, considering that there may be multiple target objects in the target frame, before weighting the position information of each candidate position frame in the target frame, each candidate position frame belonging to the same target object in the target frame can be determined, so that each candidate position frame belonging to the same target object constitutes a position frame group of the target frame. Therefore, for the target frame, the position information of each candidate position frame in the position frame group of the target frame is weighted according to the corresponding weights to obtain the position frame tracking result of the target object represented by the position frame group in the target frame. The above-mentioned position frame group can also be called a position frame cluster, or cluster.

[0176] In this embodiment, by judging whether each candidate position frame in the target frame belongs to the same target object, each candidate position frame is divided into position frame groups, so that the target object represented by each position frame group obtained by the division is the same target object, thereby reducing the influence of the candidate position frames of different target objects on each other's position frame tracking results, so as to improve the accuracy of the position frame tracking result of each target object in the target frame.

[0177] Optionally, in an embodiment, when there are multiple target frames and multiple target objects, after obtaining the position frame tracking result for the target object in each target frame, an object tracking method provided by an embodiment of the present application may further include the following steps:

[0178] Step A: Cluster the location box tracking results belonging to the same target object to obtain the final location box tracking result for each target object.

[0179] In this embodiment, when there are multiple target frames and multiple target objects, considering that it is necessary to perform image processing such as erasing and occlusion on a specific one or several target objects in the future, after obtaining the position frame tracking result for the target object of the target frame, the electronic device can continue to cluster the position frame tracking results belonging to the same target object, thereby obtaining the final position frame tracking result for each target object. It should be noted that the above-mentioned clustering of the position frame tracking results belonging to the same target object means that after determining the position frame tracking result for the target object in each target frame, the target frames belonging to the same object are placed in the same video frame set, or cluster.

[0180] In this way, when image processing is performed on a specific target object subsequently, the video frames containing the specific target object in the target video can be directly obtained from the video frame set corresponding to the specific target object, thereby determining the position information of the position box of the specific target object in the target video to improve image processing efficiency.

[0181] Optionally, in one implementation, a method for determining the location box tracking results belonging to the same target object includes the following steps:

[0182] Step B1: Based on the playback time of each target frame in the target video, multiple position frame tracking results that meet the screening conditions are determined to obtain position frame tracking results belonging to the same target object.

[0183] The screening conditions include: the target frames are continuous video frames at the playback time, and the overlapping area of ​​the position area represented by any two position frame tracking results that meet the adjacent relationship is greater than a predetermined threshold; the adjacent relationship is that the target frames are adjacent video frames.

[0184] In this implementation, since the video is continuous during playback, that is, the video is usually played at a predetermined frame rate. The so-called frame rate is the frame rate at which the position image of the frame appears continuously on the display, which refers to how many frames there are per second. One frame is a still picture, and multiple consecutive frames can form an animation, such as a movie or TV series. However, when the human eye observes a fixed picture, for the video, multiple video frames may have been played, that is, the video screen displayed by multiple consecutive video frames is more likely to contain the same target object, that is, the target frame is a video frame that is continuous at the playback time, and the position frame tracking result is more likely to belong to the same target object.

[0185] In addition, considering that there are multiple target objects in a video frame, there may be two target objects with similar image position information, resulting in a closer interval between the position frame tracking results corresponding to the two target objects. Therefore, using the position information represented by the position frame tracking result to determine whether the two target objects are the same object may result in a lower accuracy rate in determining the position frame tracking results belonging to the same target object, that is, position frame tracking results belonging to different target objects are determined as position frame tracking results belonging to the same target object.

[0186] Therefore, the overlap degree of the two position frame tracking results can be determined by determining the overlap area of ​​the position area represented by any two position frame tracking results that meet the adjacent relationship, that is, the target frames of the video frames are adjacent. In other words, the greater the overlap degree, the greater the possibility that the two position frame tracking results belong to the same target object. Therefore, a predetermined threshold corresponding to the overlap area of ​​the position area represented by any two position frame tracking results that meet the adjacent relationship can be set in advance according to the above overlap degree.

[0187] In this way, the target frames being continuous video frames at the playback time and the position areas represented by any two position frame tracking results that meet the adjacent relationship and have an overlapping area greater than a predetermined threshold can be used as screening conditions for determining the position frame tracking results belonging to the same target object.

[0188] Therefore, by using the above filtering conditions, based on the playback time of each target frame in the target video, multiple position frame tracking results that meet the above filtering conditions are determined as position frame tracking results belonging to the same target object.

[0189] Optionally, in one implementation, a method for determining the location box tracking results belonging to the same target object includes the following steps:

[0190] Step B2: for each position frame group, determine a position frame group associated with the position frame group as the position frame group to be divided; determine the position frame tracking result corresponding to the position frame group and the position frame tracking result corresponding to the position frame group to be divided as position frame tracking results belonging to the same target object; divide the position frame tracking results belonging to the same target object into a result set for the target object.

[0191] The associated position frame group and the position frame group include candidate position frames obtained by tracking the same target position frame.

[0192] In this implementation, considering that there may be multiple target frames and multiple target objects in the target video, before weighting the position information of each candidate position frame in the target frame, each candidate position frame belonging to the same target object in the target frame can be determined, so that each candidate position frame belonging to the same target object constitutes a position frame group of the target frame. Thus, for each target frame, the position information of each candidate position frame in the position frame group of the target frame is weighted according to the corresponding weight, and the position frame tracking result of the target object represented by the position frame group in the target frame is obtained.

[0193] In this way, for the position frame tracking result represented by each position frame group, the position frame tracking result is obtained by weighted processing of each candidate position frame in the position frame group, and each candidate position frame is obtained by tracking the corresponding target position frame. Therefore, for each position frame tracking result, if the other position frame group includes a position frame tracked by a target position frame corresponding to any candidate position frame included in the position frame group corresponding to the position frame tracking result, that is, the two position frame groups contain candidate position frames obtained by tracking the same target position frame, then it is characterized that the two position frame groups have an associated relationship, and the objects represented by the two position frame groups belong to the same target object, then the position frame tracking results of the two position frame groups also belong to the same target object.

[0194] Therefore, for each position frame group, a position frame group associated with the position frame group is determined as the position frame group to be divided, and the position frame tracking result corresponding to the position frame group and the position frame tracking result corresponding to the determined position frame to be divided are determined as position frame tracking results belonging to the same target object. That is to say, first, for every two position frame groups, it is first determined whether the two position frame groups have an associated relationship, and if so, it can be determined that the position frame tracking results corresponding to the two position frame groups belong to the same target object.

[0195] In this way, after determining whether each two position frame groups have an associated relationship and obtaining whether the position frame tracking results corresponding to each pair of position frame groups are position frame tracking results belonging to the same target object, it is possible to further determine whether the position frame tracking results corresponding to each pair of position frame groups are position frame tracking results belonging to the same target object by comparing whether each pair of position frame groups contains candidate position frames obtained by tracking the same target position frame. In this way, the position frame tracking results belonging to the same target object are divided into a result set for the target object, so that when the target object is subsequently processed accordingly, all video frames including the target object can be directly determined from the result set for the target object.

[0196] For example, the position frame group P includes candidate position frames y1 and y2; the position frame group Q includes candidate position frames y3 and y4; and the position frame group M includes candidate position frames y5 and y6.

[0197] Among them, the candidate position frames y1 and y3 are obtained by tracking the same target position frame; the candidate position frames y4 and y6 are obtained by tracking the same target position frame.

[0198] Therefore, for the position frame group P, the position frame group associated with the position frame group can be determined as the position frame group Q, thereby determining the position frame tracking results corresponding to the position frame group P and the position frame group Q as the position frame tracking results belonging to the same target object, and dividing the two position frame groups into the result set 1 for the target object.

[0199] Then, for the position frame group Q, the position frame group associated with the position frame group can be determined to be the position frame group M, thereby determining the position frame tracking results corresponding to the position frame group Q and the position frame group M as the position frame tracking results belonging to the same target object, and then, the position frame tracking results corresponding to the position frame group M are divided into the result set 1 that includes the position frame tracking results corresponding to the position frame group Q.

[0200] That is to say, the position frame tracking results corresponding to the position frame group Q and the position frame group M are the position frame tracking results belonging to the same target object, and the position frame tracking results corresponding to the position frame group P and the position frame group Q are the position frame tracking results belonging to the same target object. Therefore, it can be determined that the position frame tracking results corresponding to the position frame group M and the position frame tracking results corresponding to the position frame group P are the position frame tracking results belonging to the same target object. Further, it is determined that the position frame tracking results corresponding to the position frame group P, the position frame group Q and the position frame group M are the position frame tracking results belonging to the same target object.

[0201] Optionally, for each position frame group, after determining the position frame group to be divided corresponding to the position frame group, and dividing the position frame tracking results corresponding to the position frame group and the position frame group to be divided into a result set for the same target object, the position frame group and all candidate position frames contained in the position frame group to be divided can be regarded as a whole position frame group. At this time, if there are other position frame groups that contain candidate position frames obtained by tracking the same target position frame as the above-mentioned whole position frame group, it can be determined that the other position frame groups and the position frame tracking results corresponding to the position frame group belong to the same target object.

[0202] For example, the position frame group P includes candidate position frames y1 and y2; the position frame group Q includes candidate position frames y3 and y4; the position frame group M includes candidate position frames y5 and y6; wherein, the candidate position frames y1 and y3 are obtained by tracking the same target position frame; and the candidate position frames y4 and y6 are obtained by tracking the same target position frame.

[0203] For the position frame group P, the position frame group associated with the position frame group is determined to be the position frame group Q, so that the position frame tracking results corresponding to the position frame group P and the position frame group Q are determined to be the position frame tracking results belonging to the same target object, and the two position frame groups are divided into the result set 1 for the target object. At this time, all the candidate position frames y1, y2, y3 and y4 included in the position frame group P and the position frame group Q are regarded as a whole position frame group.

[0204] For the overall position frame group, the position frame group M includes the candidate position frame y6 obtained by tracking the same target position frame. Therefore, it can be further determined that the position frame tracking results corresponding to the position frame group M and the overall position frame group belong to the same target object, that is, the position frame tracking results corresponding to the position frame group P, the position frame group Q and the position frame group M are the position frame tracking results belonging to the same target object.

[0205] Optionally, considering the situation that there is only one candidate position frame in the video frame to be tracked, at this time, if the target position frame tracked to the candidate position frame is: each of the above-mentioned position frame groups, or, the target position frame corresponding to the candidate position frame contained in the position frame group to be divided that has an associated relationship with the position frame group, then the position frame tracking result corresponding to the video frame to be tracked can be determined as the position frame tracking result corresponding to the position frame group as the position frame tracking result belonging to the same target object.

[0206] Optionally, a union-find algorithm is used to determine the position frame tracking results of the target objects represented by the determined position frame groups as the same position frame tracking results belonging to the same target object.

[0207] For example, there are location frame tracking result A, location frame tracking result B and location frame tracking result C. Location frame tracking result A is obtained by weighted processing of candidate location frames x1, x2 and x3 in location frame group a; location frame tracking result B is obtained by weighted processing of candidate location frames x4, x5 and x6 in location frame group b; location frame tracking result C is obtained by weighted processing of candidate location frames x7, x8 and x9 in location frame group c.

[0208] Among them, the candidate location frame x1 in the location frame group a corresponding to the location frame tracking result A and the candidate location frame x6 in the location frame group b corresponding to the location frame tracking result B are candidate location frames tracked based on the same target location frame. Therefore, it can be determined that the location frame tracking result A and the location frame tracking result B are location frame tracking results belonging to the same target object.

[0209] The position frame group c corresponding to the position frame tracking result C does not include any candidate position frame in the position frame group a corresponding to the position frame tracking result A, or any candidate position frame in the position frame group b corresponding to the position frame tracking result B is a candidate position frame tracked based on the same target position frame. Therefore, it can be determined that the position frame tracking result C and the position frame tracking results A and B are position frame tracking results belonging to different target objects.

[0210] Optionally, in one implementation, the above step S401, for a target frame, determining each candidate position frame belonging to the same target object in the target frame, may include the following steps:

[0211] Step C1: for the target frame, calculate the intersection-over-union ratio of any two candidate position frames of the target frame;

[0212] Step C2: determining the candidate position frames whose calculated intersection-over-union ratio is greater than the preset intersection-over-union ratio as the candidate position frames belonging to the same target object in the target frame.

[0213] In this implementation, the electronic device may first calculate an intersection-over-union ratio of any two candidate position frames in the target frame.

[0214] The intersection-over-union ratio of any two candidate position frames refers to the ratio of the area of ​​the overlapping region between the two candidate position frames divided by the area of ​​the union region of the two candidate position frames.

[0215] If the calculated intersection-over-union ratio is larger, it means that the possibility that the two candidate position boxes belong to the same target object is greater. Conversely, if the calculated intersection-over-union ratio is smaller, it means that the possibility that the two candidate position boxes belong to the same target object is smaller.

[0216] Therefore, a preset IoU ratio may be preset, so that by comparing the obtained IoU ratio with the preset IoU ratio, it is determined whether the two candidate position boxes belong to the same target object.

[0217] If the calculated IoU is greater than the preset IoU, it indicates that the two candidate position frames belong to the same target object. At this time, the two candidate position frames can be determined as candidate position frames belonging to the same target object in the target frame.

[0218] If the calculated IoU ratio is not greater than the preset IoU ratio, it indicates that the two candidate position boxes do not belong to the same target object.

[0219] In this way, each candidate position frame whose calculated intersection-over-union ratio is greater than the preset intersection-over-union ratio can be determined as each candidate position frame belonging to the same target object in the target frame.

[0220] In this implementation, by determining the size relationship between the intersection-and-union ratio of any two candidate position frames and a preset intersection-and-union ratio, the candidate position frames belonging to the same target object are determined among the candidate position frames belonging to different target objects, thereby clustering the candidate position frames representing the same target object. This is to reduce the influence of the candidate position frames of different target objects on each other's position frame tracking results when subsequently determining the position frame tracking result of each target object in the target frame, thereby improving the accuracy of the position frame tracking result of each target object in the target frame.

[0221] Optionally, for the target frame, the intersection-and-union ratio of any two candidate position frames in the target frame is statistically calculated using an intersection-and-union ratio matrix, thereby judging in parallel the size relationship between each intersection-and-union ratio and a preset intersection-and-union ratio, and clustering the candidate position frames belonging to the same target object, so as to improve the efficiency of determining each candidate position frame belonging to the same target object in the target frame.

[0222] Optionally, in one implementation, the above step S401, for a target frame, determining each candidate position frame belonging to the same target object in the target frame, may include the following steps:

[0223] Step D1: for a target frame, determining candidate position frames whose overlapping areas are larger than a preset area as candidate position frames belonging to the same target object in the target frame.

[0224] In the present implementation, considering that the position information of the same target object in the same video frame is fixed, therefore, in the same target frame, the difference between the position information of each candidate position box for the same target object is small, that is, the area of ​​the overlapping part between each candidate position box for the same target object is large.

[0225] Therefore, a preset area of ​​the overlapping portion between each candidate position frame may be preset, so that each candidate position frame belonging to the same target object is determined by determining the size relationship between the area of ​​the overlapping portion of the target frame and the preset area.

[0226] If the area of ​​the existing overlapping part is larger than the preset area, then each candidate position frame having an area of ​​the existing overlapping part larger than the preset area belongs to the same target object. At this time, each candidate position frame can be determined as a candidate position frame belonging to the same target object in the target frame.

[0227] If the area of ​​the existing overlapping portion is not greater than the preset area, it indicates that each candidate position frame having the area of ​​the existing overlapping portion greater than the preset area does not belong to the same target object.

[0228] In this implementation, by determining the size relationship between the area of ​​the overlapping part of the target frame and the preset area, the candidate position frames belonging to the same target object are determined among the candidate position frames belonging to different target objects, thereby achieving clustering of the candidate position frames representing the same target object, so that when subsequently determining the position frame tracking result of each target object in the target frame, the influence of the candidate position frames of different target objects on each other's position frame tracking results is reduced, thereby improving the accuracy of the position frame tracking result of each target object in the target frame.

[0229] Optionally, in one implementation, a method for calculating the weight of each candidate position box in the position box group in the target frame includes the following steps:

[0230] Step E: For the target frame, a predetermined first formula is used to calculate the weight of each candidate position frame in the position frame group of the target frame; wherein the first formula includes:

[0231]

[0232] Where W is the weight of any candidate position frame in the position frame group of the target frame, TD is the inverse of the time difference between the target frame and the target prior video frame corresponding to any candidate position frame, n represents the total number of candidate position frames in the position frame group, TD i It is the reciprocal of the time difference between the target frame and the target a priori video frame corresponding to the i-th candidate position frame in the position frame group.

[0233] In this implementation, for each position frame group in the target frame, the greater the timing difference between the target prior video frame corresponding to each candidate position frame in the position frame group and the target frame, the smaller the importance of the candidate position frame in the target frame, and accordingly, the smaller the weight corresponding to the candidate position frame.

[0234] Therefore, after determining the weight of each candidate position frame in the position frame group in the target frame, the electronic device can perform weighted processing on the position information of each candidate position frame in the position frame group in the target frame according to the weight of each candidate position frame in the position frame group in the target frame to obtain the position frame tracking result for the target object in the position frame group in the target frame.

[0235] Optionally, in an implementation manner, for the position frame group of the target frame, according to the weight of each candidate position frame in the target frame, a predetermined fourth formula is used to perform weighted processing on the position information of each candidate position frame in the position frame group in the target frame to obtain a position frame tracking result for the target object of the position frame group in the target frame; wherein the fourth formula includes:

[0236]

[0237] Among them, P is the position frame tracking result of the position frame group for the target object in the target frame, and W i is the weight of the i-th candidate position frame in the position frame group of the target frame, T i is the position information of the i-th candidate position frame in the position frame group in the target frame, and n represents the total number of candidate position frames in the position frame group.

[0238] Optionally, in an embodiment, in an object tracking method provided by an embodiment of the present application, in the above step S202, after object detection is performed on multiple prior video frames respectively for a target object to obtain each target position frame, the above step S204, for the target frames in the obtained video frames to be tracked and located in at least two target time ranges, respectively based on the target prior video frames corresponding to the at least two target time ranges, performs object tracking on the target frames for the target object, before obtaining the candidate position frame, may further include the following steps:

[0239] Step F: Using a predetermined position frame correction amount, correct each target position frame.

[0240] In this embodiment, it is considered that when the electronic device performs object detection for the target object on multiple video frames respectively and obtains each target position frame, the tracked target position frames may have position offsets. Therefore, after obtaining each target position frame, and for each target prior video frame, based on the target position frame in the target prior video frame, the corresponding video frame to be tracked is subjected to object tracking for the target object, and before obtaining the candidate position frame, the electronic device can use a predetermined position frame correction amount to correct each target position frame.

[0241] In this way, by correcting the determined target position frame, the accuracy of the determined target position frame is improved, thereby improving the accuracy of object tracking for the target object in the corresponding video frame to be tracked.

[0242] The following is an exemplary introduction to an object tracking method involved in the present application in conjunction with a specific embodiment. Figure 5 A flowchart of a specific embodiment provided for the embodiment of the present application may include the following steps in this specific implementation:

[0243] S501: Extract frames from the target video to obtain frames to be detected.

[0244] The electronic device can extract frames from the target video at a time interval of one frame per second or similar, and use the extracted video frames as frames to be detected. The frames to be detected are the multiple a priori video frames obtained by extracting frames mentioned in the above embodiment.

[0245] S502: Performing region detection for the target object on each of the obtained frames to be detected, determining each target a priori video frame containing the target object, and a target position frame for the target object in each target a priori video frame.

[0246] The electronic device performs region detection on the extracted frames to be detected, thereby determining each target a priori video frame containing the target object. Then, further, in each target a priori video frame, the approximate position of the target position frame for the target object in the target a priori video frame is determined, as well as the frame number of the target a priori video frame in the target video.

[0247] The frame number of each target a priori video frame in the target video is used to represent the playback order of the target a priori video frame in the target video and the playback time of the target a priori video frame in the target video.

[0248] Exemplarily, the following method is used to perform region detection on each extracted frame to be detected to determine whether the frame to be detected is a target priori video frame containing a target object:

[0249] Determine the size information of the original image corresponding to the frame to be detected, that is, the image size information of the frame to be detected. If the size information is not equal to the first size adapted by the convolutional neural network, scale the size of the original image corresponding to the video frame to be detected to the first size to obtain a first image; if the size information is equal to the first size adapted by the convolutional neural network, use the original image corresponding to the frame to be detected as the first image. Then, use the convolutional neural network to extract features from the obtained first image to obtain a first feature image corresponding to the frame to be detected.

[0250] In this way, for each pixel point in the obtained first feature image, multiple first anchor frames about the pixel point can be generated, so that for each first anchor frame, the confidence score of the existence of the target object in the first anchor frame can be determined.

[0251] Among them, the so-called anchor frame can be understood as: when identifying the object existing in the feature image obtained after processing by the convolutional neural network, if it is determined that there is an object belonging to the detected target object in a certain area in the feature image, the area can be identified by using a graphic frame, and then, the graphic frame used to identify the object area belonging to the detected target object in the feature image is the anchor frame.

[0252] Since there may be no target object in some areas of the feature image, or only part of the target object exists in the area framed by the first anchor frame, in order to ensure the accuracy of the position information of the target position frame determined for the target object, a first preset score can be set in advance, so that the number of anchor frames that need to be processed later can be greatly reduced. Therefore, for each pixel point in the first feature image, after determining the confidence score corresponding to each first anchor frame about the pixel point, each anchor frame with a confidence score greater than the first preset score is retained as each first target anchor frame.

[0253] In this way, the IOU (Intersection over Union) value between every two first target anchor frames in all the first target anchor frames can be calculated based on the position information between each first target anchor frame. The so-called intersection over union value refers to the ratio of the area of ​​the overlapping area of ​​two first target anchor frames divided by the area of ​​the union area of ​​the two first target anchor frames.

[0254] For example, the area of ​​the first target anchor box J1 is S J1 , the area of ​​the first target anchor box J2 is S J2 , the overlapping area of ​​the first target anchor box J1 and the first target anchor box J2 is S J1J2 , then the intersection-and-union ratio between the first target anchor box J1 and the first target anchor box J2 can be calculated as

[0255] Thus, in each group of first target anchor frames whose calculated IOU values ​​are greater than the first preset IOU value, the position information corresponding to the first target anchor frame with the highest confidence group is selected, and the initial position information of the target position box for the target object in the frame to be detected is determined, and the frame to be detected is determined as a target priori video frame containing the target object.

[0256] For example, for each frame to be detected, if the calculated IOU value between any two first target anchor frames is greater than the first preset IOU value, it can be determined that the objects framed by the two first target anchor frames belong to the same target object. In this way, the position information corresponding to the first target anchor frame with the highest confidence group among the two first target anchor frames can be determined as the initial position information of the target position frame for the target object in the frame to be detected.

[0257] Optionally, since there is an offset between the position of the preset first anchor frame and the actual position of the target object, a first relative offset can be set in advance, so that the first offset of the first anchor frame is determined while the confidence score of each first anchor frame is determined. In this way, each first target anchor frame whose first offset is not greater than the first relative offset can be retained, thereby achieving secondary filtering of the obtained first target anchor frame using the first relative offset, and then, through two filtering, each first anchor frame whose confidence score is greater than the first preset score and whose first offset is not greater than the first relative offset is determined as each first target anchor frame, and further, the initial position information of the determined target position frame for the target object in the frame to be detected is improved.

[0258] S503: Based on the determined frame number of each target prior video frame, from the target video, track and obtain each video frame located within the target time range corresponding to the frame number of the target prior video frame as the video frame to be tracked corresponding to the target prior video frame, and based on the tracking operation for the target object, determine each tracked candidate position frame for the target object, and the frame number corresponding to the video frame to be tracked containing the candidate position frame.

[0259] Exemplarily, a tracking operation is performed on each to-be-tracked video frame corresponding to the target prior video frame to determine a candidate position frame for the target object in the to-be-tracked video frame in the following manner:

[0260] Determine the size information of the original image corresponding to the video frame to be tracked, that is, the image size information of the video frame to be tracked. If the size information is not equal to the second size adapted by the convolutional neural network, the original image corresponding to the video frame to be tracked is scaled to the second size to obtain a second image; if the size information is equal to the second size adapted by the convolutional neural network, the original image corresponding to the video frame to be tracked is used as the second image. Then, the convolutional neural network is used to extract features from the obtained second image to obtain a second feature image corresponding to the tracked video frame. And for each pixel point in the above second feature image, multiple second anchor frames of different preset sizes for the pixel point are generated.

[0261] Then, based on the initial position information of the target position frame in the target a priori video frame corresponding to the video frame to be tracked, the regional image corresponding to the area where the target position frame is located is intercepted in the original image corresponding to the target a priori video frame to obtain a target image including the target object, thereby determining the size information of the target image. If the size information is not equal to the third size adapted by the convolutional neural network, the target image is scaled to the third size to obtain a third image; if the size information is equal to the third size adapted by the convolutional neural network, the target image is used as the third image. Then, the convolutional neural network is used to extract features from the obtained third image to obtain a third feature image corresponding to the target image.

[0262] In this way, the similarity score between the second anchor frame and the above-mentioned third feature image can be calculated for each second anchor frame. Therefore, after determining the similarity scores between all the second anchor frames and the above-mentioned third feature image, the second anchor frames whose similarity groups are greater than the second preset score are retained as second target anchor frames. Then, based on the position information of each determined second target anchor frame, the IOU value between every two second target anchor frames in all the obtained second anchor frames is calculated. Therefore, in each group of second target anchor frames whose calculated IOU value is greater than the second preset IOU value, the position information corresponding to the second target anchor frame with the highest similarity group is selected to determine the position information of the candidate position frame for the target object in the video frame to be tracked.

[0263] For example, for each video frame to be tracked, if the calculated IOU value between any two second target anchor frames is greater than the second preset IOU value, it can be determined that the objects framed by the two second target anchor frames belong to the same target object. In this way, the position information corresponding to the second target anchor frame with the highest similarity score in the two second target anchor frames can be determined as the position information of the candidate position frame for the target object in the video frame to be tracked.

[0264] Optionally, since there is an offset between the position of the preset second anchor frame and the actual position of the target object, the second relative offset can be set in advance. Therefore, after determining the similarity score of each second anchor frame, based on the determined position of the second anchor frame, the second offset between the position and the actual position of the target object is calculated. In this way, each second target anchor frame whose second offset is not greater than the second relative offset can be retained, thereby achieving secondary filtering of the obtained second target anchor frame using the second relative offset. Therefore, through two filtering, each second anchor frame whose similarity group is greater than the second preset score and whose second offset is not greater than the second relative offset is determined as each second target anchor frame, further improving the accuracy of the position information of the determined candidate position frame for the target object in the video frame to be tracked, and then improving the accuracy of the determined position information of the target object.

[0265] S504: For each video frame to be tracked, weighted average the coordinates of each candidate position frame in the position frame group of the video frame to be tracked to obtain a position frame tracking result for the target object in the video frame to be tracked.

[0266] Taking into account that there may be multiple target objects in a frame of video to be tracked, the electronic device can calculate the IOU value between the coordinates of any two candidate position frames in the video frame to be tracked for each video frame to be tracked after determining each video frame to be tracked, and obtain the IOU ratio matrix of the candidate position frames in the video frame to be tracked.

[0267] In this way, by traversing the above ratio matrix, two candidate position boxes whose IOU values ​​in the above ratio matrix are greater than a preset threshold are determined as the same position box group belonging to the same target object.

[0268] Then, the electronic device can determine the weight corresponding to each candidate position frame belonging to the same position frame group, thereby performing weighted average calculation on the coordinates of each candidate position frame in the same position frame group according to the corresponding weight, thereby obtaining the position frame tracking result of the target object represented by the position frame group.

[0269] Optionally, after object tracking, the determined target object may need to be further processed, such as erasing processing, etc. Therefore, when there are multiple target objects, after determining the position frame tracking result for the target object, each video frame belonging to the same target object in the continuous frames of the target video can be determined as a video frame group belonging to the same target object.

[0270] In this way, when performing corresponding processing on the designated object that needs to be further processed, the designated video frame group containing the designated object can be directly determined from the divided video frame groups, so that the designated video frame group can be processed accordingly.

[0271] The above steps S501-S504 use the deep learning model carried by the electronic device to track the object. Therefore, when the electronic device uses an object tracking method provided in an embodiment of the present application to track the object, there is no need to perform additional tuning on the carried deep learning model itself, thereby further improving the model performance of the deep learning model based on the existing model.

[0272] Another exemplary example is Figure 6 As shown, a flowchart of another specific embodiment provided by the embodiment of the present application is shown. This embodiment takes the target trademark as the target object in the embodiment of the present application, and exemplarily introduces the above steps S501-S504. The specific process is as follows:

[0273] S601: Extract all frames to be detected from the target video according to the rule of one frame per second or other equal time intervals, and use the remaining frames as frames to be tracked.

[0274] S602: scaling the original image of the frame to be detected to a fixed size, and performing a feature extraction operation on the scaled image using a convolutional neural network to generate a feature image of the original image.

[0275] S603: Generate nine anchor frames of different sizes for each pixel point on the feature image of the original image, for matching trademarks of different sizes.

[0276] For example, Figure 7 , which is a schematic diagram of generating 9 anchor frames of different sizes for one pixel point provided by an embodiment of the present application, wherein point 701 is a pixel point on the feature image.

[0277] S604: For each anchor frame, based on the score of the target trademark in each anchor frame in the feature image of the original image and the actual offset of the preset anchor frame relative to the trademark; after calculating the scores of all anchor frames, all anchor frames with scores lower than the threshold are eliminated, and the remaining anchor frames with scores higher than the threshold are determined as the area where the target trademark exists.

[0278] S605: The trademark area detected in step S604 is subjected to the NMS (non-maximum suppression) algorithm. When there are multiple anchor boxes whose IOU values ​​are greater than a threshold, the anchor box with the highest score is retained as the anchor box corresponding to the area containing the trademark, thereby determining the target position box for the target trademark.

[0279] In this way, when multiple anchor boxes hit the same trademark, the NMS algorithm can reduce the occurrence of duplicate detections.

[0280] Through the above steps S601-S605, a target a priori video frame containing a target trademark and a target position frame for the target trademark in each target a priori video frame can be determined in the target video. The above steps S601-S605 can be performed using a preset trademark detection model, for example, an anchor-base (anchor frame-based) trademark detection model, etc., which is not specifically limited in the embodiments of the present application.

[0281] S606: sequentially obtain the determined target a priori video frames F containing the target trademark according to the time sequence, and determine the set of position frames for the target trademark in the target a priori video frames F as a set S.

[0282] S607: Obtain a position frame s from the set S, and extend the current target a priori video frame F forward and backward by m seconds at the same time, and set all video frames within the extended m seconds as video frames to be tracked.

[0283] The time interval corresponding to m seconds is greater than the time detection for extracting the frame to be detected in step S601.

[0284] S608: scaling the original image of the video frame to be tracked to a fixed size, and performing a feature extraction operation on the original image of the video frame to be tracked using a convolutional neural network to obtain a tracking feature image corresponding to the video frame to be tracked.

[0285] S609: The position frame s obtained in step S607 is cut out from the corresponding original image and scaled to a fixed size; a feature extraction operation is performed on the cut out image using a convolutional neural network to obtain a trademark detection feature image.

[0286] Among them, the above-mentioned trademark detection feature image can also become a trademark area, and the embodiments of the present application do not make specific limitations on this.

[0287] S610: Generate L anchor boxes of different sizes for each pixel point on the tracking feature image generated in step S608, so as to match trademarks of different sizes.

[0288] S611: For each anchor frame, calculate the similarity between the tracking feature image in the anchor frame and the trademark detection feature image obtained in step S609; after calculating the similarity scores of all anchor frames, remove all anchor frames with scores lower than the threshold, and determine the anchor frames with scores higher than the threshold as areas where trademarks exist. At the same time, calculate the position offset of the preset anchor frame relative to the actual position of the trademark to obtain an accurate trademark position area.

[0289] S612: The trademark area tracked in step S609 is subjected to the NMS algorithm. When there are multiple anchor boxes whose IOU values ​​are greater than the threshold, the anchor box with the highest score is retained as the anchor box corresponding to the area containing the target trademark, thereby determining the candidate position box for the target trademark.

[0290] In this way, when multiple anchor boxes hit the same trademark, the NMS algorithm can reduce the occurrence of duplicate detections.

[0291] Repeat the above steps S608-S612 until all the position frames in the position frame set S for the target trademark in the current target prior video frame F have been tracked, then return to step S606, and execute the above steps S601-S612 for the next visual prior video frame until all video frames have been tracked, thereby obtaining each video frame to be tracked in the target video and a set of candidate position frames in each video frame to be tracked.

[0292] Among them, the above steps S608-S612 can be performed using a preset trademark tracking model, for example, a single trademark tracking model based on trademark detection, etc., and this embodiment of the present application does not make any specific limitation on this.

[0293] For example, Figure 8 FIG. 1 is a schematic diagram of a single trademark tracking process based on trademark detection provided by an embodiment of the present application, wherein image z is the original image corresponding to the position box s in the current target prior video frame F, and image x is the original image of the video frame to be tracked.

[0294] After scaling the image z to a fixed size α, the convolutional neural network is used to perform feature extraction on the scaled image z to obtain the trademark detection feature image z1; after scaling the image x to a fixed size α, the convolutional neural network is used to perform feature extraction on the scaled image x to obtain the tracking feature image x1. Then, by comparing the similarity y between the tracking feature image x1 and the trademark detection feature image z1, the candidate position frame for the target trademark in the video frame to be tracked is determined.

[0295] S613: traverse all the video frames to be tracked in sequence, define the currently processed video frame to be tracked as R, and define the set of all position box tracking results in R as r.

[0296] S614: Calculate the IOU values ​​between any two candidate position boxes in the position box tracking result set r for the target trademark, and obtain the IOU ratio matrix X.

[0297] S615: traverse the above IOU ratio matrix. If the current IOU value in the ratio matrix is ​​greater than a preset threshold, it can be considered that the two candidate position boxes corresponding to the position in the ratio matrix belong to the same trademark, and the two candidate position boxes are clustered in the same cluster.

[0298] S616: performing weighted average calculation on the coordinates of all candidate position boxes belonging to the same cluster in the currently processed video frame R to be tracked, and obtaining the final position box coordinates for the target trademark in the cluster.

[0299] The above steps S613 to S616 are repeated until all the video frames to be tracked are processed, and the final position frame for the target trademark and the tracking result of the position frame in each video frame to be tracked are determined.

[0300] S617: Clustering multiple final location boxes for the target trademark in consecutive frames in the target video, and clustering location boxes belonging to the same trademark in the same cluster.

[0301] Based on the above steps S601-S617, the electronic device can perform weighted average processing on the position frame of each video frame to be tracked from multiple different target a priori video frames, so that when tracking the position frame of the trademark in the video frame to be tracked, the position frames in multiple target a priori video frames can be referred to, thereby reducing the possibility of drift of the position frame for the trademark in the video frame to be tracked. It can be seen that through this solution, the probability of drift of the trademark position frame can be reduced.

[0302] Based on the above embodiments, the present application also provides an object tracking device, such as Fig. 9 FIG. 1 is a schematic diagram of a structure of an object tracking device provided in an embodiment of the present application, wherein the device comprises:

[0303] A frame extraction module 910 is used to extract frames of a target video at a preset time interval to obtain a plurality of prior video frames;

[0304] A detection module 920, configured to perform object detection on the plurality of prior video frames for the target object to obtain respective target position frames;

[0305] The to-be-tracked video frame determination module 930 is used to determine, from the target video, each video frame within a target time range corresponding to the target a priori video frame with a target position frame in the multiple a priori video frames, and obtain each to-be-tracked video frame of the target a priori video frame; wherein the target time range corresponding to the target a priori video frame includes a time range of a playback moment of the target a priori video frame, and the target time ranges corresponding to adjacent target a priori video frames overlap;

[0306] A candidate position frame determination module 940 is used to perform object tracking for a target object on a target frame located in at least two target time ranges in the obtained video frames to be tracked, based on target priori video frames corresponding to the at least two target time ranges, to obtain a candidate position frame;

[0307] The position frame merging module 950 is configured to determine, for the target frame, a position frame tracking result for the target object in the target frame based on a plurality of candidate position frames in the target frame.

[0308] As can be seen from the above, by applying the solution provided by the embodiment of the present application, when tracking an object, first, the target video is framed at a preset time interval to obtain a plurality of a priori video frames, and then, the plurality of a priori video frames obtained are respectively subjected to object detection for the target object to obtain each target position frame. Then, for each target a priori video frame having a target position frame in the plurality of a priori video frames, each video frame within the target time range corresponding to the target a priori video frame is determined from the target video to obtain each video frame to be tracked of the target a priori video frame. In this way, for the target frames in the obtained video frames to be tracked that are located in at least two target time ranges, the target frames can be respectively subjected to object tracking for the target object based on the target a priori video frames corresponding to each of the at least two target time ranges to obtain a candidate position frame, and thus, for the target frame, based on the plurality of candidate position frames of the target frame, the position frame tracking result for the target object of the target frame can be determined.

[0309] Based on this, by applying the scheme provided by the embodiment of the present application, after determining the target a priori video frame with the target position frame, the time range containing the playback moment of the target a priori video frame can be determined in the target video as the target time range corresponding to the target a priori video frame, and the target time ranges corresponding to adjacent target a priori videos overlap, so that the target frame within the above-mentioned overlapping time range can be used as a video frame to be tracked of different target a priori video frames, that is, the same video frame to be tracked can contain different target a priori video frames to track the candidate position frames of the video frame. In this way, when tracking the position frame of the determined target frame, the position frames in multiple target a priori video frames can be referenced, thereby reducing the possibility of drift of the position frame of the target object of the target frame. It can be seen that through this scheme, the probability of drift of the position frame of the target object can be reduced.

[0310] Optionally, in a specific implementation, the target time ranges corresponding to adjacent target a priori video frames overlap by no less than a specified duration, and the specified duration is the duration corresponding to the difference between the playback moments corresponding to the two target a priori video frames.

[0311] Optionally, in a specific implementation, the target time range includes a first time range and / or a second time range; the first time range is a time range with the playback time of the target a priori video frame as the starting playback time and having a first duration; the second time range is a time range with the playback time of the target a priori video frame as the ending playback time and having a second duration; the first duration and / or the second duration is greater than the preset time interval.

[0312] Optionally, in a specific implementation, the position box merging module 950 is specifically configured to:

[0313] For the target frame, weighted processing is performed on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame of the target frame to obtain a position frame tracking result for the target object of the target frame;

[0314] The weight of each candidate position frame is: a weight determined based on the time difference between the target frame and the target prior video frame used to track the candidate position frame; the larger the time difference, the smaller the determined weight.

[0315] Optionally, in a specific implementation, the device further includes:

[0316] a position frame group determination module, for performing weighted processing on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame of the target frame, and determining each candidate position frame belonging to the same target object in the target frame before obtaining the position frame tracking result for the target object of the target frame, and forming a position frame group of the target frame with each candidate position frame belonging to the same target object;

[0317] The position frame merging module 950 is specifically used for:

[0318] For the target frame, the position information of each candidate position frame in the position frame group of the target frame is weighted according to the corresponding weight to obtain the position frame tracking result of the target object represented by the position frame group.

[0319] Optionally, in a specific implementation, when there are multiple target frames and multiple target objects, the device further includes:

[0320] The target object clustering module is used to cluster the position frame tracking results belonging to the same target object after obtaining the position frame tracking results for the target object in each target frame, so as to obtain the final position frame tracking results for each target object.

[0321] Optionally, in a specific implementation, a method for determining the location box tracking results belonging to the same target object includes:

[0322] Based on the playback time of each target frame in the target video, multiple position frame tracking results that meet the screening conditions are determined to obtain position frame tracking results belonging to the same target object; wherein the screening conditions include: the target frames are video frames with continuous playback times, and the position areas represented by any two position frame tracking results that meet the adjacent relationship have an overlapping area greater than a predetermined threshold; the adjacent relationship is that the target frames are adjacent video frames;

[0323] or,

[0324] For each position frame group, a position frame group associated with the position frame group is determined as the position frame group to be divided; the position frame tracking result corresponding to the position frame group and the position frame tracking result corresponding to the position frame group to be divided are determined as position frame tracking results belonging to the same target object; the position frame tracking results belonging to the same target object are divided into a result set for the target object; wherein the position frame group associated with the position frame group and the position frame group contain candidate position frames obtained by tracking the same target position frame.

[0325] Optionally, in a specific implementation, the position frame group determination module is specifically used to:

[0326] For the target frame, calculate the intersection-and-union ratio of any two candidate position frames of the target frame; determine each candidate position frame whose calculated intersection-and-union ratio is greater than a preset intersection-and-union ratio as a candidate position frame belonging to the same target object in the target frame; or, for the target frame, determine each candidate position frame whose area of ​​overlapping parts of the target frame is greater than a preset area as a candidate position frame belonging to the same target object in the target frame.

[0327] Optionally, in a specific implementation, a method for calculating the weight of each candidate position box in the position box group in the target frame includes:

[0328] For the target frame, a predetermined first formula is used to calculate the weight of each candidate position frame in the position frame group of the target frame; wherein the first formula includes:

[0329]

[0330] Wherein, W is the weight of any candidate position frame in the position frame group of the target frame, TD is the inverse of the time difference between the target frame and the target prior video frame corresponding to any candidate position frame, n represents the total number of candidate position frames in the position frame group, TD iis the reciprocal of the time difference between the target frame and the target a priori video frame corresponding to the i-th candidate position frame in the position frame group.

[0331] The present application also provides an electronic device, such as Fig.10 As shown, it includes a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004.

[0332] Memory 1003, used for storing computer programs;

[0333] The processor 1001 is used to implement any object tracking method provided in the above-mentioned embodiments of the present application when executing the program stored in the memory 1003.

[0334] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0335] The communication interface is used for communication between the above terminal and other devices.

[0336] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0337] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0338] In another embodiment provided in the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the object tracking method described in any one of the above embodiments is implemented.

[0339] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the object tracking method described in any one of the above embodiments.

[0340] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0341] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0342] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, electronic device embodiment, computer-readable storage medium embodiment, and computer program product embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0343] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. An object tracking method, characterized in that: The method comprises: Extract frames from the target video at a preset time interval to obtain multiple prior video frames; Performing object detection on the multiple prior video frames for the target object respectively to obtain each target position frame; For each target a priori video frame having a target position frame among the multiple a priori video frames, determine from the target video each video frame within a target time range corresponding to the target a priori video frame, and obtain each to-be-tracked video frame of the target a priori video frame; wherein the target time range corresponding to the target a priori video frame is a time range including the playback time of the target a priori video frame, and the target time ranges corresponding to adjacent target a priori video frames overlap; For the target frames in the obtained video frames to be tracked and located in at least two target time ranges, object tracking for the target object is performed on the target frames based on the target priori video frames corresponding to the at least two target time ranges, to obtain candidate position frames; For the target frame, based on a plurality of candidate position frames of the target frame, a position frame tracking result for a target object of the target frame is determined.

2. The method according to claim 1, characterized in that The target time ranges corresponding to the adjacent target a priori video frames overlap by no less than a specified duration, and the specified duration is a duration corresponding to a difference between the playback moments corresponding to the two target a priori video frames.

3. The method according to claim 2, characterized in that The target time range includes a first time range and / or a second time range; the first time range is a time range with a first duration and starting at the playback time of the target a priori video frame; the second time range is a time range with a second duration and ending at the playback time of the target a priori video frame; the first duration and / or the second duration is greater than the preset time interval.

4. The method according to claim 1, characterized in that: The step of determining, for the target frame, a position frame tracking result for the target object in the target frame based on a plurality of candidate position frames in the target frame includes: For the target frame, weighted processing is performed on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame of the target frame to obtain a position frame tracking result for the target object of the target frame; The weight of each candidate position frame is: a weight determined based on the time difference between the target frame and the target prior video frame used to track the candidate position frame; the larger the time difference, the smaller the determined weight.

5. The method according to claim 4, characterized in that Before performing weighted processing on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame of the target frame to obtain the position frame tracking result for the target object of the target frame, the method further includes: For the target frame, determining each candidate position frame belonging to the same target object in the target frame, and forming a position frame group of the target frame with each candidate position frame belonging to the same target object; The step of performing weighted processing on the position information of each candidate position frame of the target frame according to the weight of each candidate position frame of the target frame to obtain a position frame tracking result for the target object of the target frame includes: For the target frame, the position information of each candidate position frame in the position frame group of the target frame is weighted according to the corresponding weight to obtain the position frame tracking result of the target object represented by the position frame group.

6. The method according to claim 5, characterized in that When there are multiple target frames and multiple target objects, after obtaining the position frame tracking result for the target object in each target frame, the method further includes: The location box tracking results belonging to the same target object are clustered to obtain the final location box tracking result for each target object.

7. The method according to claim 6, characterized in that The method of determining the location box tracking results belonging to the same target object includes: Based on the playback time of each target frame in the target video, multiple position frame tracking results that meet the screening conditions are determined to obtain position frame tracking results belonging to the same target object; wherein the screening conditions include: the target frames are video frames with continuous playback times, and the position areas represented by any two position frame tracking results that meet the adjacent relationship have an overlapping area greater than a predetermined threshold; the adjacent relationship is that the target frames are adjacent video frames; or, For each position frame group, a position frame group associated with the position frame group is determined as the position frame group to be divided; the position frame tracking result corresponding to the position frame group and the position frame tracking result corresponding to the position frame group to be divided are determined as position frame tracking results belonging to the same target object; the position frame tracking results belonging to the same target object are divided into a result set for the target object; wherein the position frame group associated with the position frame group and the position frame group contain candidate position frames obtained by tracking the same target position frame.

8. The method according to claim 5, characterized in that The step of determining, for the target frame, candidate position frames belonging to the same target object in the target frame includes: For the target frame, calculating the intersection-and-union ratio of any two candidate position frames of the target frame; determining each candidate position frame whose calculated intersection-and-union ratio is greater than a preset intersection-and-union ratio as each candidate position frame belonging to the same target object in the target frame; or, For the target frame, each candidate position frame having an overlapping portion with an area greater than a preset area is determined as each candidate position frame belonging to the same target object in the target frame.

9. The method according to claim 5, characterized in that The method for calculating the weight of each candidate position frame in the position frame group in the target frame includes: For the target frame, a predetermined first formula is used to calculate the weight of each candidate position frame in the position frame group of the target frame; wherein the first formula includes: Wherein, W is the weight of any candidate position frame in the position frame group of the target frame, TD is the inverse of the time difference between the target frame and the target prior video frame corresponding to any candidate position frame, n represents the total number of candidate position frames in the position frame group, TD i is the reciprocal of the time difference between the target frame and the target a priori video frame corresponding to the i-th candidate position frame in the position frame group.

10. An object tracking device, characterized in that: The device comprises: A frame extraction module is used to extract frames of the target video at a preset time interval to obtain multiple prior video frames; A detection module, configured to perform object detection on the plurality of prior video frames for the target object to obtain respective target position frames; The module for determining the video frame to be tracked is used to determine, from the target video, each video frame within a target time range corresponding to the target a priori video frame having a target position frame among the multiple a priori video frames, and obtain each video frame to be tracked of the target a priori video frame; wherein the target time range corresponding to the target a priori video frame is a time range including the playback time of the target a priori video frame, and the target time ranges corresponding to adjacent target a priori video frames overlap; A candidate position frame determination module is used to perform object tracking for a target object on a target frame located in at least two target time ranges in the obtained video frames to be tracked, based on target prior video frames corresponding to the at least two target time ranges, to obtain a candidate position frame; The position frame merging module is used to determine, for the target frame, a position frame tracking result for the target object in the target frame based on a plurality of candidate position frames in the target frame.

11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-9 when executing a program stored in a memory.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.