Object tracking method, device, electronic device and storage medium

By combining the target detection and tracking algorithm, combined with the image intersection ratio and the motion direction change angle, the problem of large amount of calculation for object tracking in video images in the existing technology is solved, and an efficient and low-cost object tracking method is realized, which is suitable for real-time Video image processing.

CN115170618BActive Publication Date: 2024-10-11CHINA TELECOM CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210746580.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-28
Publication Date
2024-10-11
Estimated Expiration
2042-06-28

AI Technical Summary

Technical Problem

In the existing technology, target detection is performed on each frame in the video image based on the target detection algorithm, which results in a large amount of calculation, consumes a lot of computing resources and time, and makes it difficult to efficiently track the specified object in the video image.

Method used

The target detection algorithm is used to detect the video frames to be processed in the video image to determine the image area of ​​the specified object. When the tracking fails for several consecutive frames, the target detection algorithm is re-executed, and the tracking is judged based on the image intersection ratio and the motion direction change angle. fails, and updates the preset frame number to improve tracking success rate.

Benefits of technology

It reduces the consumption of computing resources and time, improves the efficiency and success rate of object tracking, avoids long-term tracking failures, and is suitable for real-time video image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115170618B_ABST
    Figure CN115170618B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure provide an object tracking method, device, electronic device and storage medium, and relate to the field of image processing technology. The method includes: performing target detection on the current video frame to be processed in the video image; when the first video frame containing the specified object is detected, determining the target image area in the current first video frame; performing target tracking on each second video frame located after the current first video frame in the video image to obtain the initial image area; if it is determined that the tracking of the current continuous preset number of second video frames fails, the video frame located after the current continuous preset number of second video frames in the video image is used as the current video frame to be processed, and returning to perform target detection until the position of the specified object in each video frame in the video image is determined. By applying the embodiments of the present disclosure, the tracking of the specified object can be achieved while reducing the consumption of computing resources and time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the rapid development of image processing technology, it is possible to track a designated object in a video image based on the image processing technology, that is, to determine the image area occupied by the designated object in the video image.

[0003] In the related art, a target detection algorithm can be used to track a specified object. For example, for each frame of a video image, a target detection algorithm can be used to perform target detection on the video frame to determine the image area occupied by the specified object in the video frame.

[0004] However, based on the above processing, it is necessary to perform target detection on each video frame based on a target detection algorithm, and the target detection algorithm has a large amount of calculation and consumes more computing resources and time. Summary of the invention

[0005] The purpose of the embodiments of the present disclosure is to provide an object tracking method, device, electronic device and storage medium to reduce the consumed computing resources and time. The specific technical solution is as follows:

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

[0007] Performing target detection on the current video frame to be processed in the video image based on the target detection algorithm;

[0008] When a first video frame containing a designated object is detected, determining an image area occupied by the designated object in the current first video frame as a target image area in the current first video frame;

[0009] For each second video frame located after the current first video frame in the video image, target tracking is performed on the second video frame based on the target image area in the current first video frame and the target tracking algorithm to obtain an initial image area occupied by the designated object in the second video frame;

[0010] If it is determined that tracking of the current number of consecutive preset second video frames has failed based on the initial image area occupied by the designated object in the current second video frame, the video frame in the video image that is located after the current number of consecutive preset second video frames is used as the current video frame to be processed, and the process returns to executing the step of performing target detection on the current video frame to be processed in the video image based on the target detection algorithm until the position of the designated object in each video frame of the video image is determined.

[0011] In some embodiments, after performing target tracking on each second video frame located after the current first video frame in the video image based on the target image area in the current first video frame and the target tracking algorithm to obtain the initial image area occupied by the designated object in the second video frame, the method further includes:

[0012] For each current second video frame, based on the image intersection-over-union ratio and / or the motion direction change angle, determining whether tracking of the second video frame fails;

[0013] The image intersection-and-union ratio represents the intersection-and-union ratio between the initial image area occupied by the specified object in the second video frame and the target image area occupied by the specified object in the video frame determined last time;

[0014] The motion direction change angle represents the angle between the first vector and the second vector; the first vector represents the vector between the center points of the target image area occupied by the designated object in the video frame determined the first two times; the second vector represents the vector between the center point of the initial image area occupied by the designated object in the second video frame and the center point of the target image area occupied by the designated object in the video frame determined the last time.

[0015] In some embodiments, after determining, for each current second video frame, based on the image intersection-over-union ratio and / or the motion direction change angle, whether tracking of the second video frame fails, the method further includes:

[0016] For each current second video frame, if it is determined that the tracking of the second video frame is successful, the initial image area occupied by the designated object in the second video frame is determined as the target image area occupied by the designated object in the second video frame.

[0017] In some embodiments, it is characterized in that the target tracking algorithm is multiple;

[0018] The method of performing target tracking on each second video frame located after the current first video frame in the video image based on the target image area and the target tracking algorithm in the current first video frame to obtain the initial image area occupied by the designated object in the second video frame includes:

[0019] For each second video frame located after the current first video frame in the video image, target tracking is performed on the second video frame based on the target image area in the current first video frame and each target tracking algorithm to obtain the image area occupied by the designated object in the second video frame;

[0020] Based on the image areas corresponding to the target tracking algorithms, an initial image area occupied by the designated object in the second video frame is determined.

[0021] In some embodiments, after performing target tracking on each second video frame located after the current first video frame in the video image based on the target image area in the current first video frame and the target tracking algorithm to obtain the initial image area occupied by the designated object in the second video frame, the method further includes:

[0022] If, based on the initial image area occupied by the designated object in the current second video frame, it is determined that tracking of the current first consecutive number of second video frames has failed, and tracking of the third video frame after the current first consecutive number of second video frames has succeeded, then based on the first number, the current preset number of frames is updated; wherein the first number is smaller than the current preset number of frames.

[0023] In some embodiments, if it is determined that the current first number of consecutive second video frames has failed to be tracked based on the target image area occupied by the designated object in the current second video frame, and the third video frame after the current first number of consecutive second video frames has been tracked successfully, then based on the first number, the current preset number of frames is updated, including:

[0024] If, based on the initial image area occupied by the designated object in the current second video frame, it is determined that tracking of the current first number of consecutive second video frames has failed, and tracking of a third video frame after the current first number of consecutive second video frames has succeeded, determining a target image area occupied by the designated object in the third video frame;

[0025] Calculating the image similarity between the target image area occupied by the third video frame and the target image area occupied by the designated object in the video frame determined last time;

[0026] Based on the first number and the image similarity, the current preset number of frames is updated.

[0027] In some embodiments, the designated object is a tail of a steel coil.

[0028] According to a second aspect of the embodiments of the present disclosure, there is provided an object tracking device, the device comprising:

[0029] The target detection module is used to perform target detection on the current video frame to be processed in the video image based on the target detection algorithm;

[0030] A first target image area determination module is used to, when a first video frame containing a specified object is detected, determine an image area occupied by the specified object in the current first video frame as a target image area in the current first video frame;

[0031] an initial image region obtaining module, for each second video frame located after the current first video frame in the video image, based on the target image region in the current first video frame and the target tracking algorithm, performing target tracking on the second video frame to obtain the initial image region occupied by the designated object in the second video frame;

[0032] A processing module is used for, if it is determined that tracking of the current continuous preset number of second video frames has failed based on the initial image area occupied by the designated object in the current second video frame, then taking the video frame in the video image that is located after the current continuous preset number of second video frames as the current video frame to be processed, and returning to execute the step of performing target detection on the current video frame to be processed in the video image based on the target detection algorithm until the position of the designated object in each video frame in the video image is determined.

[0033] In some embodiments, the apparatus further comprises:

[0034] A tracking result judgment module is used for performing target tracking on each second video frame located after the current first video frame in the video image based on the target image area in the current first video frame and the target tracking algorithm, and after obtaining the initial image area occupied by the designated object in the second video frame, for each current second video frame, determining whether tracking of the second video frame fails based on the image intersection-over-union ratio and / or the angle of change in the motion direction;

[0035] The image intersection-and-union ratio represents the intersection-and-union ratio between the initial image area occupied by the specified object in the second video frame and the target image area occupied by the specified object in the video frame determined last time;

[0036] The motion direction change angle represents the angle between the first vector and the second vector; the first vector represents the vector between the center points of the target image area occupied by the designated object in the video frame determined the first two times; the second vector represents the vector between the center point of the initial image area occupied by the designated object in the second video frame and the center point of the target image area occupied by the designated object in the video frame determined the last time.

[0037] In some embodiments, the apparatus further comprises:

[0038] The second target image area determination module is used to determine, for each current second video frame, whether tracking of the second video frame has failed based on the image intersection-and-joint ratio and / or the angle of change in the motion direction. If it is determined that tracking of the second video frame has been successful, then for each current second video frame, the initial image area occupied by the designated object in the second video frame is determined as the target image area occupied by the designated object in the second video frame.

[0039] In some embodiments, the target tracking algorithm is multiple;

[0040] The initial image area obtaining module comprises:

[0041] The candidate image region obtaining submodule is used to perform target tracking on each second video frame located after the current first video frame in the video image based on the target image region in the current first video frame and each target tracking algorithm, so as to obtain the image region occupied by the designated object in the second video frame;

[0042] The initial image area determination submodule is used to determine the initial image area occupied by the designated object in the second video frame based on the image areas corresponding to each target tracking algorithm.

[0043] In some embodiments, the apparatus further comprises:

[0044] A preset frame number updating module is used for performing target tracking on each second video frame located after the current first video frame in the video image based on the target image area and the target tracking algorithm in the current first video frame to obtain the initial image area occupied by the designated object in the second video frame. If, based on the initial image area occupied by the designated object in the current second video frame, it is determined that the tracking of the current first number of consecutive second video frames has failed, and the tracking of the third video frame after the current first number of consecutive second video frames has succeeded, then the current preset frame number is updated based on the first number; wherein the first number is less than the current preset frame number.

[0045] In some embodiments, the preset frame number updating module includes:

[0046] A third target image area determination submodule is used to determine the target image area occupied by the specified object in the third video frame if it is determined that the tracking of the current first number of consecutive second video frames fails and the tracking of the third video frame after the current first number of consecutive second video frames succeeds based on the initial image area occupied by the specified object in the third video frame;

[0047] A similarity calculation submodule, used to calculate the image similarity between the target image area occupied by the third video frame and the target image area occupied by the designated object in the video frame determined last time;

[0048] The preset frame number updating submodule is used to update the current preset frame number based on the first number and the image similarity.

[0049] In some embodiments, the designated object is a tail of a steel coil.

[0050] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, 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 via the communication bus;

[0051] Memory, used to store computer programs;

[0052] The processor is used to implement any of the above-mentioned object tracking method steps when executing the program stored in the memory.

[0053] According to a fourth aspect of an embodiment of the present disclosure, 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 of the above-mentioned object tracking method steps is implemented.

[0054] According to a fifth aspect of the embodiments of the present disclosure, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the object tracking methods described above.

[0055] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0056] The disclosed embodiment provides an object tracking method, which can perform target detection on a current video frame to be processed in a video image based on a target detection algorithm; when a first video frame containing a specified object is detected, determine the image area occupied by the specified object in the current first video frame as the target image area in the current first video frame; for each second video frame located after the current first video frame in the video image, perform target tracking on the second video frame based on the target image area in the current first video frame and the target tracking algorithm, and obtain the initial image area occupied by the specified object in the second video frame; if it is determined that tracking of the current continuous preset number of second video frames fails based on the initial image area occupied by the specified object in the current second video frame, then use the video frame located after the current continuous preset number of second video frames in the video image as the current video frame to be processed, and return to the step of performing target detection on the current video frame to be processed in the video image based on the target detection algorithm until the position of the specified object in each video frame in the video image is determined.

[0057] Based on the above processing, the image area occupied by the specified object in the video frame can be detected based on the target detection algorithm, and then the target tracking algorithm can be used to track the image area. In other words, it is not necessary to perform target detection for each video frame based on the target detection algorithm, and because the calculation amount of the target tracking algorithm is less than that of the target detection algorithm, the consumed computing resources and time can be reduced.

[0058] Of course, it is not necessary to achieve all the advantages described above at the same time to implement any product or method of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and a person skilled in the art can also obtain other embodiments based on these drawings.

[0060] Figure 1 A schematic diagram of the principle of tracking an object in the related art;

[0061] Figure 2 A flow chart of an object tracking method provided by an embodiment of the present disclosure;

[0062] Figure 3 A schematic diagram of the principle of tracking an object provided by an embodiment of the present disclosure;

[0063] Figure 4 A second flow chart of the object tracking method provided by the embodiment of the present disclosure;

[0064] Figure 5 A third flow chart of the object tracking method provided by the embodiment of the present disclosure;

[0065] Figure 6 An example diagram of a motion direction change angle provided by an embodiment of the present disclosure;

[0066] Figure 7 A fourth flow chart of the object tracking method provided by the embodiment of the present disclosure;

[0067] Figure 8 A fifth flow chart of the object tracking method provided by the embodiment of the present disclosure;

[0068] Fig. 9 A sixth flow chart of the object tracking method provided by the embodiment of the present disclosure;

[0069] Fig.10 An example diagram of an object tracking process provided by an embodiment of the present disclosure;

[0070] Fig.11 An example diagram of an object tracking process provided by an embodiment of the present disclosure;

[0071] Fig.12 A structural diagram of an object tracking device provided by an embodiment of the present disclosure;

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

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

[0074] In the related art, a target detection algorithm can be used to track a specified object. For example, for each frame of a video image, a target detection algorithm can be used to perform target detection on the video frame to determine the image area occupied by the specified object in the video frame.

[0075] For example, you can perform object detection on video frames based on the detection network, see Figure 1 , Figure 1 It is a schematic diagram of the principle of tracking an object in the related art. Figure 1 In the above, an image can be input to the detection network, and then an output result can be obtained, that is, the image area occupied by the specified object can be determined.

[0076] However, based on the above processing, it is necessary to perform target detection on each video frame based on a target detection algorithm, and the target detection algorithm has a large amount of calculation and consumes more computing resources and time.

[0077] In order to solve the above problems, the embodiments of the present disclosure provide an object tracking method, device, electronic device and storage medium, which are described in detail below:

[0078] The embodiment of the present disclosure provides an object tracking method, which can be applied to an electronic device. The electronic device can acquire a video image, and track a specified object in the video image based on the method provided by the embodiment of the present disclosure to determine the image area occupied by the specified object in the video image. The specified object can be set by the user according to needs. For example, the specified object can be a component in the field of intelligent industrial manufacturing, or it can also be a defective part on an industrial product.

[0079] In some embodiments, the designated object is a tail of a steel coil.

[0080] In one implementation, in the scenario of producing steel coils, in order to evaluate the quality of the tail of the produced steel coil through video images, it is necessary to track the tail of the steel coil in the video image of the steel coil production. Specifically, the video image of the same steel coil production position can be collected in real time by an image collector. After the production of a steel coil is completed at the production position, the steel coil is taken away manually, and a new steel coil is produced at the production position. In fact, the tail of the steel coil is identified and tracked in the time period when each steel coil is produced but not taken away. Since the video image of the steel coil production is collected in real time without interruption, different specified objects will appear in the video image collected by the image collector in different time periods, and the multiple specified objects belong to different video frames. Accordingly, the electronic device can obtain a video image containing the steel coil production process, and then, based on the method provided in the embodiment of the present disclosure, the tail of the steel coil in the video image is tracked, and the image area occupied by multiple specified objects in different video frames can be determined.

[0081] See also Figure 2 , Figure 2 A flow chart of an object tracking method provided by an embodiment of the present disclosure, the method may include the following steps:

[0082] S201: Performing target detection on a current video frame to be processed in a video image based on a target detection algorithm.

[0083] S202: When a first video frame containing a designated object is detected, an image region occupied by the designated object in the current first video frame is determined as a target image region in the current first video frame.

[0084] S203: For each second video frame located after the current first video frame in the video image, target tracking is performed on the second video frame based on the target image area in the current first video frame and the target tracking algorithm to obtain an initial image area occupied by the specified object in the second video frame.

[0085] S204: If it is determined that tracking of the current number of consecutive preset second video frames has failed based on the initial image area occupied by the specified object in the current second video frame, the video frame in the video image that is located after the current number of consecutive preset second video frames is used as the current video frame to be processed, and the process returns to step S201 until the position of the specified object in each video frame in the video image is determined.

[0086] Based on the above processing, the image area occupied by the specified object in the video frame can be detected based on the target detection algorithm, and then the target tracking algorithm can be used to track the image area. In other words, it is not necessary to perform target detection for each video frame based on the target detection algorithm, and because the calculation amount of the target tracking algorithm is less than that of the target detection algorithm, the consumed computing resources and time can be reduced.

[0087] In addition, when it is determined based on the target tracking algorithm that tracking of a preset number of video frames has failed, target detection can be re-performed based on the target detection algorithm to avoid long-term tracking failures, thereby improving the success rate of tracking.

[0088] In the above process, the target detection algorithm and the target tracking algorithm can be flexibly turned on / off to achieve the tracking of the specified object while reducing the consumption of computing resources and time.

[0089] In addition, if the video image is processed only based on the target tracking algorithm, when the specified object is blocked, tracking will fail. However, the embodiment of the present disclosure combines the target detection algorithm and the target tracking algorithm. When tracking fails based on the target tracking algorithm, target detection can be performed again based on the target detection algorithm. As a result, the specified object can be tracked again, thereby improving the success rate of tracking.

[0090] With respect to steps S201 and S202, in one implementation, an image collector for collecting video images may be provided, and the image collector may collect video images for object tracking. The above-mentioned image collector may be integrated in an electronic device. Alternatively, the image collector may also be another device independent of the electronic device, and accordingly, the electronic device may perform data communication with the image collector to obtain the collected images.

[0091] In one implementation, the target detection algorithm can be implemented based on a detection network. For example, the detection network can be an R-CNN (Region-Convolutional Neural Network) or an SSD (Single Shot multibox Detector) network.

[0092] In one implementation, the electronic device may perform target detection on each video frame in sequence according to the order of the video frames in the video image.

[0093] There are video frames containing the specified object and video frames not containing the specified object in the video image. After acquiring the video image, in the order of the video frames, when it is detected that the specified object exists in a certain video frame (i.e., the current first video frame), the electronic device can determine the target image area occupied by the specified object in the current first video frame.

[0094] Based on the target detection algorithm, at least one image area in the first video frame can be determined, and each image area has a corresponding confidence level, which indicates the probability that a specified object exists in the image area. Accordingly, the electronic device can use the image area with a confidence level greater than a preset threshold as the target image area of ​​the specified object in the video frame. In turn, the accuracy of the detected target image area can be improved to improve the tracking accuracy.

[0095] For example, the image area occupied by the specified object may be the image area corresponding to the minimum bounding rectangle of the specified object. That is, the electronic device may determine the minimum bounding rectangle frame containing the specified object in the video frame, which may be called the target frame. Figure 3 , Figure 3 A schematic diagram of the principle of tracking an object provided in an embodiment of the present disclosure. Figure 3 In , the video frame can be input into the detection network, and then the target box can be obtained.

[0096] With respect to step S203, when it is detected that there is a target image area in the first video frame, target tracking can be performed on the subsequent video frame (i.e., the second video frame) based on the image area and the target tracking algorithm. At this time, it is not necessary to perform target detection on the second video frame based on the target detection algorithm. In other words, at this time, the target detection algorithm can be turned off and the target tracking algorithm can be turned on.

[0097] In some embodiments, the target tracking algorithm may be a MIL tracker (Multiple Instance Learning tracker) algorithm. Based on the MIL tracker algorithm, the current first video frame may be divided to obtain a plurality of image blocks (Patch), and the image blocks corresponding to the target image area are used as positive image blocks, and the remaining image blocks are used as negative image blocks. Then, the image features of each image block may be calculated, and based on the calculated image features, a classifier may be constructed according to the Bayesian rule, the classifier including the determined positive image blocks and negative image blocks.

[0098] Furthermore, for each second video frame, the second video frame can be divided in the same manner as when the current first video frame is divided, to obtain a plurality of image blocks to be classified. Then, the image features of each image block to be classified can be calculated. Furthermore, based on the constructed classifier and the image features, the classification result of the image block to be classified is determined, that is, the similarity between the image features of each image block to be classified and the image features of the current positive image block is calculated, and the similarity between the image features of each image block to be classified and the image features of the current negative image block is calculated, and based on the similarity, the classification result is obtained; the classification result indicates whether the image block to be classified is a positive image block or a negative image block, and the image area occupied by the specified object in the second video frame can also be determined. Furthermore, according to the classification results of each image block to be classified, the classifier is updated, that is, the positive image blocks and negative image blocks contained in the classifier are updated. Wherein, the above-mentioned image features can be represented by Haar-like features.

[0099] Alternatively, the target tracking algorithm may be a KCF tracker (Kernelized Correlation Filterstracker) algorithm. Based on the KCF tracker algorithm, the current first video frame may be sampled and a plurality of amplified samples may be obtained by using a circulant matrix. Then, the image features of the plurality of amplified samples may be calculated, and based on the image features and the image area occupied by the specified object in each expanded sample, a classifier may be constructed according to a ridge regression algorithm in a kernel space.

[0100] Furthermore, for each second video frame, the classification result of each pixel position in the second video frame can be determined based on the classifier and the image features of the second video frame. The classification result indicates whether the pixel position is the pixel position corresponding to the specified object, and the image area occupied by the specified object in the second video frame can be determined. Furthermore, the classifier is updated according to the classification results of each pixel position. Among them, the above-mentioned image features can include at least one of the following: color features, HOG (Histogram of Oriented Gradient) features and convolution features.

[0101] Alternatively, the target tracking algorithm may be a CSRT (Correlation Filter-based Tracking) algorithm.

[0102] In the disclosed embodiment, target tracking is performed on the second video frame based on the target tracking algorithm, and the image area occupied by the specified object is obtained as the initial image area. However, the target tracking algorithm may fail to track the second video frame, and if the tracking fails, it is impossible to track other subsequent second video frames based on the initial image area in the second video frame; on the contrary, if the tracking is successful, it is possible to track other subsequent second video frames based on the initial image area in the second video frame, and at this time, the initial image area can be used as the target image area.

[0103] That is to say, in one implementation, if there is only one target tracking algorithm, the image area determined based on the target tracking algorithm is the initial image area.

[0104] In one implementation, if there are multiple target tracking algorithms, see Figure 4 ,exist Figure 2 On the basis of, step S203 may include the following steps:

[0105] S2031: For each second video frame located after the current first video frame in the video image, target tracking is performed on the second video frame based on the target image area in the current first video frame and each target tracking algorithm to obtain the image area occupied by the specified object in the second video frame.

[0106] S2032: Determine an initial image area occupied by the designated object in the second video frame based on the image areas corresponding to each target tracking algorithm.

[0107] When multiple target tracking algorithms are used, for each second video frame, an image area (which may be called a candidate image area) can be obtained based on each target tracking algorithm. At this time, for each second video frame, there are multiple candidate image areas obtained based on the target tracking algorithm.

[0108] If the obtained candidate image regions are the same, at this time, any one candidate image region may be selected from the multiple candidate image regions as the initial image region occupied by the designated object in the second video frame.

[0109] If the candidate image regions obtained are different, then the average value of the positions of the candidate image regions can be calculated, and the initial image region can be determined based on the average value. For example, the average value of the positions of the upper left corner vertices of the candidate image regions, the average value of the positions of the upper right corner vertices of the candidate image regions, the average value of the positions of the lower left corner vertices of the candidate image regions, and the average value of the positions of the lower right corner vertices of the candidate image regions can be calculated, and then the image region with the vertices at the positions corresponding to the four average values ​​is determined as the initial image region.

[0110] In one implementation, after obtaining a plurality of candidate image regions, it is also possible to determine whether the image intersection-and-union ratio is greater than a first preset threshold value based on the image intersection-and-union ratio of each candidate image region. When the image intersection-and-union ratio is greater than the first preset threshold value, the initial image region can be obtained based on each candidate image region. When the image intersection-and-union ratio is not greater than the first preset threshold value, it can be determined that the tracking of the second video frame has failed, and at this time, it is not necessary to determine the initial image region. For example, the first preset threshold value can be 0.8.

[0111] The method provided by the embodiment of the present disclosure adopts one or more target tracking algorithms, which can improve flexibility. In addition, based on multiple target tracking algorithms, the accuracy of object tracking can also be improved.

[0112] For step S204, the initial value of the preset number of frames can be set by the user according to the needs. For example, the initial value of the preset number of frames can be 30. If the tracking of the second video frame fails for the preset number of frames in a row, it indicates that the original specified object does not exist in the subsequent video frames. For example, the original specified object moves outside the monitoring range of the above-mentioned image collector. At this time, target detection can be performed on the subsequent video frames based on the target detection algorithm, and there is no need to process based on the target tracking algorithm. In other words, at this time, the target tracking algorithm can be turned off and the target detection algorithm can be reopened.

[0113] In one implementation, in a scenario of producing steel coils, an image collector can be used to collect images at the same steel coil production location. After the production of a steel coil is completed at the production location, the user can take the steel coil away and produce a new steel coil at the production location. However, after the previous steel coil is taken away and before the new steel coil generates a tail, the tail of the steel coil does not exist in the video image collected by the image collector, which will cause the second video frame tracking failure for a preset number of consecutive frames.

[0114] Therefore, after the second video frame tracking fails for a preset number of consecutive frames, target detection can be performed again based on the target detection algorithm, so that the tail of the new steel coil can be detected and tracked, thereby achieving continuous tracking of multiple specified objects.

[0115] In one implementation, see Figure 5 , Figure 5 A third flow chart of the object tracking method provided in the embodiment of the present disclosure, in Figure 2 On the basis of, after step S203, the following steps are also included:

[0116] S205: For each current second video frame, based on the image intersection-over-union ratio and / or the motion direction change angle, determine whether tracking of the second video frame fails.

[0117] The image IoU ratio represents the IoU ratio between the initial image area occupied by the designated object in the second video frame and the target image area occupied by the designated object in the video frame determined last time.

[0118] The angle of change in motion direction represents the angle between the first vector and the second vector; the first vector represents the vector between the center points of the target image area occupied by the specified object in the video frame determined the first two times; the second vector represents the vector between the center point of the initial image area occupied by the specified object in the second video frame and the center point of the target image area occupied by the specified object in the video frame determined the previous time.

[0119] In one implementation, it can be determined whether the tracking of the second video frame fails based on the image intersection-over-union ratio. For example, when the image intersection-over-union ratio is less than a second preset threshold, it can be determined that the tracking of the second video frame fails; when the image intersection-over-union ratio is not less than the second preset threshold, it can be determined that the tracking of the second video frame succeeds. The second preset threshold can be set by the user according to needs, for example, the second preset threshold can be 0.5.

[0120] In one implementation, it can be determined whether the tracking of the second video frame has failed based on the change angle of the motion direction. If the first vector and the second vector are in the same direction, for example, the directions of the first vector and the second vector are both from the center point of the image area in the latter video frame to the center point of the image area in the previous video frame, or the directions of the first vector and the second vector are both from the center point of the image area in the previous video frame to the center point of the image area in the latter video frame. When the change angle of the motion direction is not less than the first preset angle, it can be determined that the tracking of the second video frame has failed; when the change angle of the motion direction is less than the first preset angle, it can be determined that the tracking of the second video frame has succeeded. The first preset angle can be set by the user according to needs. For example, the first preset angle can be 30°.

[0121] If the first vector and the second vector are not in the same direction, for example, one of the first vector and the second vector has a direction from the center point of the image area in the next video frame to the center point of the image area in the previous video frame, and the other vector has a direction from the center point of the image area in the previous video frame to the center point of the image area in the next video frame, then when the change angle of the motion direction is not greater than the second preset angle, it can be determined that the tracking of the second video frame has failed; when the change angle of the motion direction is greater than the second preset angle, it can be determined that the tracking of the second video frame has succeeded. The second preset angle can be set by the user according to needs, for example, the second preset angle can be 150°.

[0122] See also Figure 6 , Figure 6 An example diagram of a motion direction change angle provided by an embodiment of the present disclosure, Figure 6 In the figure, the three rectangular boxes represent the image areas in the three video frames respectively, the vector d2 represents the first vector, and the vector d1 represents the second vector. It can be seen that the first vector and the second vector are in the same direction, and the direction is from the center point of the image area in the latter video frame to the center point of the image area in the previous video frame.

[0123] In one implementation, it can be determined whether the tracking of the second video frame fails based on the image intersection-and-union ratio and the angle of change in the motion direction. When the image intersection-and-union ratio is less than a third preset threshold, the first vector and the second vector are in the same direction, and the angle of change in the motion direction is not less than a third preset angle, it is determined that the tracking of the second video frame fails. When the image intersection-and-union ratio is less than a third preset threshold, the first vector and the second vector are in the same direction, and the angle of change in the motion direction is less than a third preset angle, it is determined that the tracking of the second video frame fails.

[0124] When the image intersection-and-union ratio is less than the third preset threshold, the first vector and the second vector are not in the same direction, and the change angle of the motion direction is not greater than the fourth preset angle, it is determined that the tracking of the second video frame has failed. When the image intersection-and-union ratio is less than the third preset threshold, the first vector and the second vector are not in the same direction, and the change angle of the motion direction is greater than the fourth preset angle, it is determined that the tracking of the second video frame has failed.

[0125] When the image intersection-and-union ratio is greater than the third preset threshold, the first vector and the second vector are in the same direction, and the change angle of the motion direction is not less than the third preset angle, it is determined that the tracking of the second video frame has failed. When the image intersection-and-union ratio is greater than the third preset threshold, the first vector and the second vector are in the same direction, and the change angle of the motion direction is less than the third preset angle, it is determined that the tracking of the second video frame has succeeded.

[0126] When the image intersection-and-union ratio is greater than the third preset threshold, the first vector and the second vector are not in the same direction, and the change angle of the motion direction is not greater than the fourth preset angle, it is determined that the tracking of the second video frame has failed. When the image intersection-and-union ratio is greater than the third preset threshold, the first vector and the second vector are not in the same direction, and the change angle of the motion direction is greater than the fourth preset angle, it is determined that the tracking of the second video frame has succeeded.

[0127] Based on the above method, it is possible to effectively determine whether tracking is successful, and further, when tracking fails, the target detection algorithm can be timely started to perform target detection, thereby avoiding long-term tracking failure and improving the effectiveness of object tracking.

[0128] In one implementation, see Figure 7 , Figure 7 A fourth flow chart of the object tracking method provided by the embodiment of the present disclosure, in Figure 5 On the basis of, after step S205, the following steps are also included:

[0129] S206: For each current second video frame, if it is determined that the tracking of the second video frame is successful, the initial image area occupied by the designated object in the second video frame is determined as the target image area occupied by the designated object in the second video frame.

[0130] For each current second video frame, if it is determined that the tracking of the second video frame is successful, the subsequent second video frames can be tracked based on the initial image area in the second video frame. Therefore, the initial image area occupied by the specified object in the second video frame can be determined as the target image area occupied by the specified object in the second video frame.

[0131] Based on the above processing, when the second video frame is tracked successfully, the initial image area occupied by the designated object in the second video frame is used for subsequent tracking processing, thereby improving the accuracy of subsequent tracking.

[0132] In one implementation, see Figure 8 , Figure 8 A fifth flow chart of the object tracking method provided in the embodiment of the present disclosure, in Figure 2 On the basis of, after step S203, the following steps are also included:

[0133] S207: If, based on the target image area occupied by the specified object in the current second video frame, it is determined that tracking of the current first number of consecutive second video frames has failed, and tracking of the third video frame after the current first number of consecutive second video frames has succeeded, then based on the first number, the current preset frame number is updated.

[0134] The first number is smaller than the current preset frame number.

[0135] In the embodiment of the present disclosure, if the current first number of consecutive second video frames fails to be tracked, and the third video frame after the current first number of consecutive second video frames is successfully tracked, it can be indicated that the update condition of the preset number of frames is met. It can be understood that in the process of object tracking of video images, there may be multiple moments that meet the above update condition, and at each moment that meets the above update condition, the current preset number of frames can be updated based on the first number at that moment.

[0136] In one implementation, the average value of the first number when the update condition is met this time and the initial value of the preset frame number may be calculated, and the average value may be rounded to obtain the updated preset frame number.

[0137] In one implementation, the current preset number of frames may be updated in combination with the first numbers when the update condition was previously satisfied, the first number when the update condition was satisfied this time, and the initial value of the preset number of frames. For example, the average of the first numbers when the update condition was previously satisfied, the first number when the update condition was satisfied this time, and the initial value of the preset number of frames may be calculated, and the average may be rounded to obtain the updated preset number of frames.

[0138] In one implementation, when it is determined that tracking of the current continuous preset number of second video frames fails, the process returns to step S201, that is, when target detection is performed again based on the target detection algorithm, the current preset number of frames may be determined as an initial value.

[0139] In one implementation, see Fig. 9 , Fig. 9 A sixth flow chart of the object tracking method provided in the embodiment of the present disclosure, in Figure 8 On the basis of, step S207, comprises the following steps:

[0140] S2071: If, based on the target image area occupied by the specified object in the current second video frame, it is determined that tracking of the current first consecutive number of second video frames has failed, and tracking of the third video frame after the current first consecutive number of second video frames has succeeded, determine the target image area occupied by the specified object in the third video frame.

[0141] S2072: Calculate the image similarity between the target image area occupied in the third video frame and the target image area occupied by the designated object in the video frame determined last time.

[0142] S2073: Based on the first number and the image similarity, update the current preset number of frames.

[0143] In one implementation, the average of the first number when the update condition is met this time and the initial value of the preset frame number can be calculated, and the average is divided by the image similarity to obtain an updated average value, and the updated average value is rounded to obtain the updated preset frame number.

[0144] In one implementation, the current preset number of frames may be updated in combination with the first numbers when the update condition was previously satisfied, the first number when the update condition was satisfied this time, the initial value of the preset number of frames, and the image similarity. For example, the average of the first numbers when the update condition was previously satisfied, the first number when the update condition was satisfied this time, and the initial value of the preset number of frames may be calculated, and the average may be divided by the image similarity, and the calculation result may be rounded to obtain the updated preset number of frames.

[0145] For example, the initial value of the preset number of frames is 30. Based on the target tracking algorithm, the first second video frame and the second second video frame after the first video frame are successfully tracked, and the third to ninth second video frames are all failed to be tracked. When the tenth second video frame is successfully tracked, at this time, the tracking of 7 consecutive second video frames fails, then the first number is 7, and the first number is less than the current preset number of frames (i.e., 30). Therefore, the preset number of frames can be updated based on the first number (i.e., 7). The image similarity between the target image area in the eighth second video frame and the target image area occupied by the specified object in the video frame (i.e., the second second video frame) determined last time is 0.95. At this time, the average value of 30 and 7 can be taken, and the average value is divided by 0.95, and the calculation result is rounded to 19. That is, the updated preset number of frames is 19. Furthermore, the electronic device can perform target tracking on the second video frame after the tenth second video frame based on the target tracking algorithm.

[0146] If the target tracking algorithm successfully tracks the eleventh second video frame and the twelfth second video frame, and fails to track the thirteenth to twenty-second second video frames, when the twenty-third second video frame is successfully tracked, at this time, 10 consecutive second video frames fail to track, then the first number is 10, and the first number is less than the current preset number of frames (i.e., 19). Therefore, the preset number of frames can be updated based on the first number (i.e., 10). The image similarity between the target image area in the twenty-second second video frame and the target image area occupied by the specified object in the video frame (i.e., the twelfth second video frame) determined last time is 0.92. At this time, the average value of 30, 7, and 10 can be taken, and the average value is divided by 0.92, and the calculation result is rounded to 17. That is, the updated preset number of frames is 17. Furthermore, the electronic device can perform target tracking on the second video frame after the twenty-third second video frame based on the target tracking algorithm.

[0147] If the target tracking algorithm fails to track the 24th to 41st second video frames, then 18 consecutive second video frames have failed to track, and the first number is 18, which is greater than the current preset number of frames (i.e., 17). At this time, the electronic device can perform target detection on the next video frame of the 41st second video frame based on the target detection algorithm, and update the preset number of frames to the initial value.

[0148] Based on the above processing, the preset number of frames can be updated according to the number of video frames that failed to track and the image similarity of the determined image area. Based on the number of video frames that failed to track continuously, the preset number of frames can be reduced so that the preset number of frames tends to the target value, and when the number of video frames that failed to track continuously is the target value, it indicates that the original designated object has moved outside the monitoring range of the above image collector. Therefore, by updating the preset number of frames based on the number of video frames that failed to track continuously, it can be determined in time that the original designated object has moved outside the monitoring range of the above image collector, and then, the next new designated object within the monitoring range can be detected in time, thereby improving the timeliness of object tracking. The greater the image similarity, the smaller the number of video frames that failed to track continuously; the smaller the image similarity, the larger the number of video frames that failed to track continuously. Therefore, the preset number of frames can also be adjusted based on the image similarity so that it tends to the target value, thereby improving the timeliness of object tracking.

[0149] In some embodiments, see Fig.10 , Fig.10 An example diagram of an object tracking process provided for an embodiment of the present disclosure. In this embodiment, the designated object represents the tail of a steel coil. Step S1001, obtaining a video frame, that is, obtaining each video frame in a video image; step S1002, tail detection, that is, performing target detection on the video frame based on a target detection algorithm; step S1003, obtaining a target frame, that is, determining a target frame containing a designated object in the video frame; step S1004, confidence selection, that is, comparing the confidences of each determined target frame; step S1005, obtaining a tail target frame, that is, determining the target frame with the highest confidence as the tail target frame, that is, the target frame corresponding to the target image area in the first video frame in the embodiment of the present disclosure.

[0150] Then, step S1006, tail tracking, that is, target tracking is performed on the second video frame after the first video frame based on the target tracking algorithm; step S1007, it is determined whether the target is lost. If the target is not lost, it means that the tracking of the second video frame is successful. Accordingly, step S1008 is executed to obtain the latest target frame, which is the target frame corresponding to the target image area occupied by the specified object in the second video frame; if the target is lost, it means that the tracking of the second video frame for a continuous preset number of frames fails, and then it returns to the tail detection, that is, the target detection algorithm is restarted to perform target detection.

[0151] In some embodiments, see Fig.11 , Fig.11 This is an example diagram of an object tracking process provided by an embodiment of the present disclosure. Step S1101: Obtain Fig.10 Step S1102, one or two tracking algorithms may be used to perform target tracking, that is, target tracking is performed on the second video frame based on the target tracking algorithm to obtain an initial image area occupied by the specified object in the second video frame.

[0152] Step S1103, using area filtering method and / or direction filtering method to determine the tracking result. Step S1104, judging whether the tracking of the second video frame is successful based on the tracking result. The tracking result determined by the area filtering method represents the image intersection ratio between the initial image area and the target image area determined last time; the tracking result determined by the direction filtering method represents the angle of change of the motion direction obtained based on the center point of the initial image area and the target image area determined twice before. If the tracking of the second video frame is successful, the subsequent second video frame can be tracked; if the tracking of the second video frame fails, the frame number of the second video frame where the tracking fails can be recorded.

[0153] Step S1105, determine whether it is greater than the preset frame number, that is, determine whether the frame number of the second video frame in which continuous tracking fails is greater than the preset frame number. If the frame number of the second video frame in which continuous tracking fails is not greater than the preset frame number, the electronic device can execute step S1106, that is, the preset frame number and the target frame can be updated; if the continuous frame number is greater than the preset frame number, execute step S1107, that is, the electronic device can determine that the target is lost, and accordingly, the electronic device can perform target detection on the next video frame based on the target detection algorithm, and update the preset frame number to the initial value.

[0154] Based on the same inventive concept as the above-mentioned object tracking method, the present disclosure also provides an object tracking device, see Fig.12 , Fig.12 A structural diagram of an object tracking device provided in an embodiment of the present disclosure, the device comprising:

[0155] The target detection module 1201 is used to perform target detection on the current video frame to be processed in the video image based on the target detection algorithm;

[0156] A first target image region determining module 1202 is used to determine, when a first video frame containing a specified object is detected, an image region occupied by the specified object in the current first video frame as a target image region in the current first video frame;

[0157] The initial image region obtaining module 1203 is used to perform target tracking on each second video frame located after the current first video frame in the video image based on the target image region in the current first video frame and the target tracking algorithm, so as to obtain the initial image region occupied by the specified object in the second video frame;

[0158] The processing module 1204 is used for, if it is determined that the tracking of the current continuous preset number of second video frames has failed based on the initial image area occupied by the designated object in the current second video frame, then taking the video frame in the video image that is located after the current continuous preset number of second video frames as the current video frame to be processed, and returning to execute the step of performing target detection on the current video frame to be processed in the video image based on the target detection algorithm until the position of the designated object in each video frame in the video image is determined.

[0159] In some embodiments, the apparatus further comprises:

[0160] A tracking result judgment module is used to perform target tracking on each second video frame located after the current first video frame in the video image based on the target image area in the current first video frame and the target tracking algorithm, and after obtaining the initial image area occupied by the specified object in the second video frame, determine whether the tracking of the second video frame fails based on the image intersection-over-union ratio and / or the angle of change in the motion direction for each current second video frame;

[0161] The image intersection-and-union ratio represents the intersection-and-union ratio between the initial image area occupied by the specified object in the second video frame and the target image area occupied by the specified object in the video frame determined last time;

[0162] The angle of change in motion direction represents the angle between the first vector and the second vector; the first vector represents the vector between the center points of the target image area occupied by the specified object in the video frame determined the first two times; the second vector represents the vector between the center point of the initial image area occupied by the specified object in the second video frame and the center point of the target image area occupied by the specified object in the video frame determined the previous time.

[0163] In some embodiments, the apparatus further comprises:

[0164] The second target image area determination module is used to determine, for each current second video frame, whether tracking of the second video frame has failed based on the image intersection-over-union ratio and / or the angle of change in the motion direction. If it is determined that tracking of the second video frame has been successful, for each current second video frame, the initial image area occupied by the designated object in the second video frame is determined as the target image area occupied by the designated object in the second video frame.

[0165] In some embodiments, the target tracking algorithm is multiple;

[0166] The initial image region obtaining module 1203 includes:

[0167] The candidate image region obtaining submodule is used to perform target tracking on each second video frame located after the current first video frame in the video image based on the target image region in the current first video frame and each target tracking algorithm, so as to obtain the image region occupied by the specified object in the second video frame;

[0168] The initial image area determination submodule is used to determine the initial image area occupied by the designated object in the second video frame based on the image areas corresponding to each target tracking algorithm.

[0169] In some embodiments, the apparatus further comprises:

[0170] A preset frame number updating module is used to perform target tracking on each second video frame located after a current first video frame in a video image based on a target image area and a target tracking algorithm in the current first video frame, and after obtaining an initial image area occupied by a designated object in the second video frame, if, based on the initial image area occupied by the designated object in the current second video frame, it is determined that tracking of the current first number of consecutive second video frames has failed, and tracking of a third video frame after the current first number of consecutive second video frames has succeeded, then update the current preset frame number based on the first number; wherein the first number is less than the current preset frame number.

[0171] In some embodiments, the preset frame number updating module includes:

[0172] A third target image area determination submodule is used to determine the target image area occupied by the specified object in the third video frame if it is determined that the tracking of the current first number of consecutive second video frames fails and the tracking of the third video frame after the current first number of consecutive second video frames succeeds based on the initial image area occupied by the specified object in the current second video frame;

[0173] A similarity calculation submodule, used to calculate the image similarity between the target image area occupied by the third video frame and the target image area occupied by the designated object in the video frame determined last time;

[0174] The preset frame number updating submodule is used to update the current preset frame number based on the first number and the image similarity.

[0175] In some embodiments, the designated object is a tail of a steel coil.

[0176] The present disclosure also provides an electronic device, such as Fig.13 As shown, it includes a processor 1301, a communication interface 1302, a memory 1303 and a communication bus 1304, wherein the processor 1301, the communication interface 1302, and the memory 1303 communicate with each other through the communication bus 1304.

[0177] Memory 1303, used for storing computer programs;

[0178] The processor 1301 is configured to implement the steps of any object tracking method in the above embodiments when executing the program stored in the memory 1303 .

[0179] The communication bus mentioned in the above electronic device 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.

[0180] The communication interface is used for communication between the above electronic device and other devices.

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

[0182] 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.

[0183] In another embodiment provided by the present disclosure, a computer-readable storage medium is further provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any of the above-mentioned object tracking methods are implemented.

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

[0185] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by 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 disclosure is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can 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 can 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 can 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 can 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 hard disk Solid State Disk (SSD)), etc.

[0186] 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.

[0187] 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, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

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

Claims

1. An object tracking method, characterized in that: The method comprises: Performing target detection on the current video frame to be processed in the video image based on the target detection algorithm; When a first video frame containing a designated object is detected, determining an image area occupied by the designated object in the current first video frame as a target image area in the current first video frame; For each second video frame located after the current first video frame in the video image, target tracking is performed on the second video frame based on the target image area in the current first video frame and the target tracking algorithm to obtain an initial image area occupied by the designated object in the second video frame; For each current second video frame, determining whether tracking of the second video frame fails based on the motion direction change angle; The motion direction change angle represents the angle between the first vector and the second vector; the first vector represents the vector between the center points of the target image area occupied by the designated object in the video frame determined twice previously; the second vector represents the vector between the center point of the initial image area occupied by the designated object in the second video frame and the center point of the target image area occupied by the designated object in the video frame determined once previously; If, based on the initial image area occupied by the designated object in the current second video frame, it is determined that tracking of the current consecutive preset number of second video frames has failed, the video frame in the video image that is located after the current consecutive preset number of second video frames is used as the current video frame to be processed, and the process returns to executing the step of performing target detection on the current video frame to be processed in the video image based on the target detection algorithm until the position of the designated object in each video frame in the video image is determined.

2. The method according to claim 1, characterized in that The determining, for each current second video frame, based on the motion direction change angle, whether tracking of the second video frame fails includes: If the first vector and the second vector are in the same direction, and the angle of change in the motion direction is not less than a first preset angle, it is determined that tracking of the second video frame has failed; If the first vector and the second vector are in different directions, then when the motion direction change angle is not greater than a second preset angle, it is determined that tracking of the second video frame has failed.

3. The method according to claim 1 or 2, characterized in that After performing target tracking on each second video frame located after the current first video frame in the video image based on the target image area in the current first video frame and the target tracking algorithm to obtain the initial image area occupied by the designated object in the second video frame, determining whether tracking of the second video frame fails based on the motion direction change angle for each current second video frame includes: For each current second video frame, determining whether tracking of the second video frame fails based on the image intersection-over-union ratio and the motion direction change angle; The image IoU ratio represents the IoU ratio between the initial image area occupied by the designated object in the second video frame and the target image area occupied by the designated object in the video frame determined previously.

4. The method according to claim 3, characterized in that The determining, for each current second video frame, based on the image intersection-over-union ratio and the motion direction change angle, whether tracking of the second video frame fails includes: When the image intersection-over-union ratio is less than a third preset threshold, the first vector and the second vector are in the same direction, and the motion direction change angle is not less than a third preset angle, determining that tracking of the second video frame has failed; When the image intersection-over-union ratio is less than the third preset threshold, the first vector and the second vector are in different directions, and the angle of change in the motion direction is not greater than a fourth preset angle, it is determined that tracking of the second video frame has failed; When the image intersection-over-union ratio is greater than the third preset threshold, the first vector and the second vector are in the same direction, and the motion direction change angle is not less than the third preset angle, determining that tracking of the second video frame has failed; When the image intersection-over-union ratio is greater than the third preset threshold, the first vector and the second vector are in different directions, and the motion direction change angle is not greater than the fourth preset angle, it is determined that tracking of the second video frame has failed.

5. The method according to claim 3, characterized in that After determining, for each current second video frame, based on the image intersection-over-union ratio and the motion direction change angle, whether tracking of the second video frame fails, the method further includes: For each current second video frame, if it is determined that the tracking of the second video frame is successful, the initial image area occupied by the designated object in the second video frame is determined as the target image area occupied by the designated object in the second video frame.

6. The method according to claim 1, characterized in that There are multiple target tracking algorithms; The method further includes performing target tracking on each second video frame located after the current first video frame in the video image based on the target image area in the current first video frame and a target tracking algorithm to obtain an initial image area occupied by the designated object in the second video frame, including: For each second video frame located after the current first video frame in the video image, target tracking is performed on the second video frame based on the target image area in the current first video frame and each target tracking algorithm to obtain an image area occupied by the designated object in the second video frame; Based on the image areas corresponding to the target tracking algorithms, an initial image area occupied by the designated object in the second video frame is determined.

7. The method according to claim 1, characterized in that After performing target tracking on each second video frame located after the current first video frame in the video image based on the target image area in the current first video frame and the target tracking algorithm to obtain the initial image area occupied by the designated object in the second video frame, the method further includes: If, based on the initial image area occupied by the specified object in the current second video frame, it is determined that tracking of the current first consecutive number of second video frames has failed, and tracking of the third video frame after the current first consecutive number of second video frames has been successful, then based on the first number, the current preset number of frames is updated; wherein, the first number is smaller than the current preset number of frames.

8. The method according to claim 7, characterized in that If it is determined that tracking of the current first number of consecutive second video frames fails based on the target image area occupied by the designated object in the current second video frame, and tracking of the third video frame following the current first number of consecutive second video frames succeeds, then updating the current preset number of frames based on the first number, including: If, based on the initial image area occupied by the designated object in the current second video frame, it is determined that tracking of the current first number of consecutive second video frames has failed, and tracking of a third video frame following the current first number of consecutive second video frames has succeeded, determining a target image area occupied by the designated object in the third video frame; Calculating the image similarity between the target image area occupied by the third video frame and the target image area occupied by the designated object in the video frame determined previously; Based on the first number and the image similarity, the current preset number of frames is updated.

9. The method according to claim 8, characterized in that The updating of the current preset number of frames based on the first number and the image similarity includes: Calculating an average value of the first number when the update condition is met this time and an initial value of the preset number of frames, dividing the average value by the image similarity to obtain an updated average value, and rounding the updated average value to obtain an updated preset number of frames; or The average of the first numbers when the update conditions were previously met, the first number when the update conditions were met this time, and the initial value of the preset number of frames is calculated, and the average is divided by the image similarity, and the calculation result is rounded to obtain the updated preset number of frames.

10. The method according to claim 1, characterized in that The designated object is the tail of the steel coil.

11. An object tracking device, characterized in that: The device comprises: a target detection module for performing target detection on a current video frame to be processed in the video image based on a target detection algorithm; a first target image region determination module for, when a first video frame containing a specified object is detected, determining an image region occupied by the specified object in the current first video frame as the target image region in the current first video frame; an initial image region obtaining module, configured to perform target tracking on each second video frame located after the current first video frame in the video image based on the target image region in the current first video frame and a target tracking algorithm, to obtain an initial image region occupied by the designated object in the second video frame; A tracking result determination module is configured to determine, for each current second video frame, whether tracking of the second video frame has failed based on a motion direction change angle; wherein the motion direction change angle represents the angle between a first vector and a second vector; the first vector represents a vector between center points of target image regions occupied by the designated object in the video frame determined twice previously; and the second vector represents a vector between a center point of an initial image region occupied by the designated object in the second video frame and a center point of a target image region occupied by the designated object in the video frame determined once previously. A processing module is used to, if it is determined that tracking of the current continuous preset number of second video frames has failed based on the initial image area occupied by the designated object in the current second video frame, use the video frame in the video image that is located after the current continuous preset number of second video frames as the current video frame to be processed, and return to execute the step of performing target detection on the current video frame to be processed in the video image based on the target detection algorithm until the position of the designated object in each video frame in the video image is determined.

12. The device according to claim 11, characterized in that The tracking result judgment module is used to perform target tracking on each second video frame located after the current first video frame in the video image based on the target image area and the target tracking algorithm in the current first video frame, and after obtaining the initial image area occupied by the specified object in the second video frame, if the first vector and the second vector are in the same direction, when the angle of change in the motion direction is not less than a first preset angle, determine that tracking of the second video frame has failed; if the first vector and the second vector are not in the same direction, when the angle of change in the motion direction is not greater than a second preset angle, determine that tracking of the second video frame has failed.

13. The device according to claim 11 or 12, characterized in that The tracking result judgment module is configured to, for each second video frame located after the current first video frame in the video image, perform target tracking on the second video frame based on the target image area in the current first video frame and the target tracking algorithm, obtain the initial image area occupied by the designated object in the second video frame, and then, for each current second video frame, determine whether tracking of the second video frame has failed based on the image intersection-over-union ratio and the motion direction change angle; The image IoU ratio represents the IoU ratio between the initial image area occupied by the designated object in the second video frame and the target image area occupied by the designated object in the video frame determined previously.

14. The device according to claim 13, characterized in that The tracking result judgment module is configured to determine that tracking of the second video frame has failed when the image intersection-over-union ratio is less than a third preset threshold, the first vector and the second vector are in the same direction, and the angle of change in the motion direction is not less than a third preset angle; When the image intersection-over-union ratio is less than the third preset threshold, the first vector and the second vector are in different directions, and the angle of change in the motion direction is not greater than a fourth preset angle, it is determined that tracking of the second video frame has failed; When the image intersection-over-union ratio is greater than the third preset threshold, the first vector and the second vector are in the same direction, and the motion direction change angle is not less than the third preset angle, determining that tracking of the second video frame has failed; When the image intersection-over-union ratio is greater than the third preset threshold, the first vector and the second vector are in different directions, and the motion direction change angle is not greater than the fourth preset angle, it is determined that tracking of the second video frame has failed.

15. The device according to claim 13, characterized in that The device further comprises: The second target image area determination module is used to determine, for each current second video frame, whether tracking of the second video frame has failed based on the image intersection-over-union ratio and / or the motion direction change angle. If it is determined that tracking of the second video frame has been successful, the initial image area occupied by the specified object in the second video frame is determined as the target image area occupied by the specified object in the second video frame.

16. The device according to claim 11, characterized in that There are multiple target tracking algorithms; the initial image area acquisition module includes: a candidate image region obtaining submodule, configured to, for each second video frame located after the current first video frame in the video image, perform target tracking on the second video frame based on the target image region in the current first video frame and each target tracking algorithm, to obtain an image region occupied by the designated object in the second video frame; The initial image area determination submodule is configured to determine the initial image area occupied by the designated object in the second video frame based on the image areas corresponding to the target tracking algorithms.

17. The device according to claim 11, characterized in that The device further comprises: A preset frame number updating module is used to perform target tracking on each second video frame located after the current first video frame in the video image based on the target image area and the target tracking algorithm in the current first video frame, and after obtaining the initial image area occupied by the designated object in the second video frame, if it is determined that tracking of the current first consecutive number of second video frames has failed based on the initial image area occupied by the designated object in the current second video frame, and tracking of the third video frame after the current first consecutive number of second video frames has succeeded, then update the current preset frame number based on the first number; wherein the first number is less than the current preset frame number.

18. The device according to claim 17, characterized in that The preset frame number updating module includes: a third target image area determination submodule configured to determine a target image area occupied by the designated object in the current second video frame if, based on the initial image area occupied by the designated object in the current second video frame, it is determined that tracking of the current first consecutive number of second video frames has failed, and tracking of a third video frame following the current first consecutive number of second video frames has succeeded, determine the target image area occupied by the designated object in the third video frame; a similarity calculation submodule, configured to calculate an image similarity between a target image region occupied by the third video frame and a target image region occupied by the designated object in the video frame determined previously; The preset frame number updating submodule is used to update the current preset frame number based on the first number and the image similarity.

19. The device according to claim 18, characterized in that The preset frame number updating submodule is used to calculate the average value of the first number when the update condition is met this time and the initial value of the preset frame number, divide the average value by the image similarity to obtain an updated average value, and round the updated average value to obtain the updated preset frame number; or The average of the first numbers when the update conditions were previously met, the first number when the update conditions were met this time, and the initial value of the preset number of frames is calculated, and the average is divided by the image similarity, and the calculation result is rounded to obtain the updated preset number of frames.

20. The device according to claim 11, characterized in that The designated object is the tail of the steel coil.

21. 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 via the communication bus; Memory for storing computer programs; A processor, configured to implement the method steps described in any one of claims 1 to 10 when executing a program stored in a memory.

22. 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 steps of any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • Real-time multi-class and multi-target tracking method of video

    CN106127807A

  • Target detection tracking method and device, electronic equipment and storage medium

    CN112651996A

  • Target tracking method and device

    WO2018121286A1