Tracking algorithm testing method, device, electronic device and storage medium
By dividing video clips in video samples and calculating the ratio of matching frames to actual frames, determining the test results of the tracking algorithm, the time-consuming and unreliable problems in the prior art are solved, and a more accurate tracking algorithm test is achieved.
Patent Information
- Application Number
- CN202110756686.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-05
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2041-07-05
AI Technical Summary
The existing tracking algorithms are time-consuming and the test results are unreliable. Especially in cross-camera pedestrian tracking, due to factors such as camera resolution, lighting conditions, pedestrian occlusion, and other factors, it is impossible to accurately predict the location of pedestrians.
By dividing video samples into equal-time video clips, it is determined that the matching video clip is a clip containing the matching frame and tracking actual frame ratio is greater than the threshold, calculate the accuracy and recall rate, and determine the test results based on the relationship between the number of video clips to avoid frame-by-frame comparison.
It reduces test time, improves the accuracy of test results, is suitable for practical application scenarios, and effectively evaluates the accuracy and effectiveness of tracking algorithms.
Smart Images

Figure CN115588029B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a tracking algorithm testing method, device, electronic equipment and storage medium. Background Art
[0002] Cross-camera pedestrian tracking technology has important application value in smart city security management. It uses computer vision technology to determine whether there is a specified target pedestrian in an image or video sequence, and conducts target search and trajectory positioning, effectively solving public safety and other problems.
[0003] In existing technology, when testing tracking algorithms, it's impossible to accurately predict and track pedestrians in every frame due to factors such as camera resolution, recording distance, lighting conditions, pedestrian occlusion, and clothing color changes. While algorithms can identify and predict the frames where pedestrians appear in key video clips, existing technology relies on frame-by-frame comparisons and testing based on the percentage of correctly predicted frames. This method is time-consuming and produces unreliable results. Summary of the Invention
[0004] The present invention provides a tracking algorithm testing method, device, electronic device and storage medium, which are used to solve the technical problems in the prior art that tracking algorithm testing is time-consuming and the test results are unreliable.
[0005] In a first aspect, the present invention provides a tracking algorithm testing method, comprising:
[0006] Tracking and predicting a predicted target in a video sample using a tracking algorithm to obtain a tracking prediction frame, wherein the tracking prediction frame is a position where the predicted target is predicted to appear in the video sample by the tracking algorithm;
[0007] Determining a matching video segment in the video sample, wherein the matching video segment is a video segment in which a ratio of the number of matching frames to the number of actual tracking frames is greater than a first threshold, the matching frame is a frame where the actual tracking frame and the predicted tracking frame overlap, and the actual tracking frame is a position where the predicted target actually appears in the video sample;
[0008] determining a test result of the tracking algorithm based on a first number of video segments containing the tracked predicted frames, a second number of video segments containing the tracked actual frames, and a third number of the matching video segments;
[0009] The video segments are obtained by dividing the video samples into segments of equal length.
[0010] Optionally, in one embodiment, determining the test result of the tracking algorithm based on a first number of video segments containing the tracking prediction frames, a second number of video segments containing the tracking actual frames, and a third number of the matching video segments includes:
[0011] Determine, based on the first number, the second number, and the third number, a precision rate Precision and a recall rate Recall when the tracking algorithm performs tracking prediction on the prediction target;
[0012] A test result of the tracking algorithm is determined based on a precision Precision corresponding to at least one of the prediction targets and a recall Recall corresponding to at least one of the prediction targets.
[0013] Optionally, in one embodiment, determining a matching video segment in the video sample includes:
[0014] Determine matching frames;
[0015] In the video segments containing the matching frames, a matching video segment in which a ratio of the number of the matching frames contained therein to the number of tracked actual frames is greater than a first threshold is determined.
[0016] Optionally, in one embodiment, determining the matching frame includes:
[0017] Determine the tracking prediction frame whose frame information matches the frame information of the tracking actual frame as the matching frame;
[0018] The frame information includes: camera number, frame number, predicted target identification number, and the position of the identification rectangle of the predicted target.
[0019] Optionally, in one embodiment, determining that the tracking prediction frame whose frame information matches the frame information of the tracking actual frame is the matching frame includes:
[0020] If it is determined that the camera number of the tracking prediction frame is the same as the camera number of the tracking actual frame, and it is determined that the frame number of the tracking prediction frame is the same as the frame number of the tracking actual frame, and it is determined that the predicted target identification number of the tracking prediction frame is the same as the predicted target identification number of the tracking actual frame, and it is determined that the recognition rectangular box corresponding to the tracking prediction frame matches the recognition rectangular box corresponding to the tracking actual frame, then the tracking actual frame is determined to be the matching frame.
[0021] Optionally, in one embodiment, the determining that the recognition rectangular frame corresponding to the tracking prediction frame matches the recognition rectangular frame corresponding to the tracking actual frame includes:
[0022] If it is determined that the intersection-over-union (IOU) of the recognition rectangular box corresponding to the tracking prediction frame and the recognition rectangular box corresponding to the tracking actual frame is greater than a second threshold, it is determined that the recognition rectangular box corresponding to the tracking prediction frame matches the recognition rectangular box corresponding to the tracking actual frame.
[0023] Optionally, in one embodiment, the method further includes:
[0024] Manually label the video samples to determine the actual tracking frame.
[0025] In a second aspect, the present invention provides a tracking algorithm testing device, comprising:
[0026] An acquisition module is used to track and predict the predicted target in the video sample by using a tracking algorithm to obtain a tracking prediction frame, wherein the tracking prediction frame is a position where the predicted target is predicted to appear in the video sample by the tracking algorithm;
[0027] a first determining module, configured to determine a matching video segment in a video sample, wherein the matching video segment is a video segment in which a ratio of the number of matching frames to the number of actual tracking frames is greater than a first threshold, the matching frame is a frame where the actual tracking frame and the predicted tracking frame overlap, and the actual tracking frame is a position where the predicted target actually appears in the video sample;
[0028] a second determining module, configured to determine a test result of the tracking algorithm based on a first number of video segments containing the tracking prediction frames, a second number of video segments containing the tracking actual frames, and a third number of the matching video segments;
[0029] The video segments are obtained by dividing the video samples into segments of equal length.
[0030] In a third aspect, the present invention provides an electronic device comprising a memory and a memory storing a computer program, wherein the processor implements the steps of the tracking algorithm testing method described in the first aspect when executing the program.
[0031] In a fourth aspect, the present invention provides a processor-readable storage medium, wherein the processor-readable storage medium stores a computer program, and the computer program is used to enable the processor to execute the steps of the tracking algorithm testing method described in the first aspect.
[0032] The tracking algorithm testing method, device, electronic device and storage medium provided by the present invention determine a video clip containing a tracking prediction frame obtained by the tracking algorithm, and a video clip containing an actual tracking frame, and compare the two, further determine a matching video clip determined after comparing the actual tracking frame and the tracking prediction frame, and determine the test result of the tracking algorithm based on the quantitative relationship between these three types of video clips, avoiding frame-by-frame comparison, reducing time consumption, and having accurate test results. It can effectively evaluate the accuracy and effectiveness of tracking algorithm detection and is more suitable for actual application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0034] Figure 1 This is one of the flow charts of the tracking algorithm testing method provided by the present invention;
[0035] Figure 2 1 is a schematic diagram of the process of dividing video clips provided by the present invention;
[0036] Figure 3 This is the second flow chart of the tracking algorithm testing method provided by the present invention;
[0037] Figure 4 It is a structural diagram of the tracking algorithm testing device provided by the present invention;
[0038] Figure 5 The following is a schematic diagram of the physical structure of an electronic device. DETAILED DESCRIPTION
[0039] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0040] The following combination Figures 1-4 The tracking algorithm testing method and device of the present invention are described.
[0041] Cross-camera pedestrian tracking technology involves algorithms such as target detection, target re-identification, and target tracking. The model is trained through pre-labeled target pedestrian video data, and then the retrieved target is input into the algorithm model to identify and locate the target, thereby meeting the requirements of cross-camera pedestrian tracking.
[0042] Cross-camera pedestrian tracking primarily consists of a pedestrian detection module, a pedestrian target tracking module, and a pedestrian re-identification module. The pedestrian detection module typically employs a lightweight network (RBFNet) for multi-scale and multi-scale feature fusion. The pedestrian target tracking module typically employs the SORT tracking algorithm. The SORT algorithm uses the detection results of the aforementioned pedestrian detection algorithm as a key component, propagating the target state to future frames, associating the current detection with the existing target, and managing the lifecycle of the tracked target. The pedestrian re-identification module typically employs the ReID algorithm, calculating the feature distance between the pedestrian library image and the detection target image to determine whether they are the same pedestrian.
[0043] The tasks of cross-camera pedestrian tracking are as follows: (1) A pedestrian library is given, that is, the information of the target pedestrian to be identified is specified; (2) The algorithm model is required to find the pedestrians in the pedestrian library in videos of different scenes, locate the pedestrians and track them; (3) If the pedestrian disappears in the current scene, the algorithm model is required to search and continue tracking in the videos of the remaining scenes; (4) If the pedestrian target appears in multiple videos, or appears multiple times in a single video, the algorithm model is required to iteratively search and continue tracking; (5) Predict the tracking results of the pedestrians in the pedestrian library (camera number, frame number, pedestrian ID number, rectangular box position information).
[0044] The process of cross-camera pedestrian tracking is as follows: (1) Use the pedestrian detection network to detect all pedestrians in the video frame and obtain the pedestrian detection frame; (2) Re-identify the detected pedestrians and extract the target pedestrian in the video; (3) Use the pedestrian tracking algorithm to track the target pedestrian. If the pedestrian tracking is lost (trackID is lost), use the pedestrian re-identification algorithm (ReID) to re-locate the target; (4) Calculate the distance between the center coordinates of the target pedestrian detection frame in the three frames before and after. If it is greater than the set threshold, it is considered a tracking error and the ReID target positioning is re-performed; (5) If the tracking is successful, use the SORT algorithm to continue tracking.
[0045] The current testing schemes for the tracking algorithm are listed below:
[0046] The percentage of video frames in which the distance between the center point of the target location (bounding box) estimated by the tracking algorithm and the center point of the manually annotated target (ground-truth) is less than a given threshold. Different thresholds yield different percentages, and the algorithm's performance is measured using a percentage curve. This test method is significantly affected by the threshold and cannot accurately reflect changes in target size and scale. It is also not suitable for testing cross-camera tracking algorithms.
[0047] First, define the overlap score (OS). The bounding box obtained by the tracking algorithm (denoted as a) and the box given by the ground-truth (denoted as b) have an overlap rate of: OS = |a∩b| / |a∪b|, where |〃| represents the number of pixels in the area. When the OS of a frame is greater than the set threshold, the frame is considered successful. The percentage of successful frames in all frames is the success rate. Initialize the first frame with the position of the target in the ground-truth, and then run the tracking algorithm to obtain the average accuracy and success rate. This test method may be sensitive to the initial position given in the first frame, and may have a greater impact at different positions or at the beginning of the frame.
[0048] In actual cross-border tracking scenarios, due to factors such as camera resolution, recording distance, lighting conditions, pedestrian occlusion, and clothing color changes, it's impossible for algorithms to accurately predict and track pedestrians in every frame. If the algorithm can identify and predict the video frames where pedestrians appear in key video clips, it can successfully determine the pedestrian's trajectory. Existing technologies mostly rely on frame-by-frame comparisons, testing the percentage of correctly predicted frames. This method is time-consuming and unreliable.
[0049] Figure 1 This is one of the flow charts of the tracking algorithm testing method provided by the present invention, such as Figure 1 As shown, the method includes the following steps:
[0050] Step 100: Tracking and predicting a predicted target in a video sample using a tracking algorithm to obtain a tracking prediction frame, wherein the tracking prediction frame is a position where the predicted target is predicted to appear in the video sample by the tracking algorithm;
[0051] Optionally, the video sample may be divided into video segments according to fixed interval frames on the time axis.
[0052] Optionally, for each of all N cameras, T can be set on the time axis. n (n=1, ..., N) video clips, each video clip has a certain range (eg, a length of 50 frames) on the time axis.
[0053] Optionally, the prediction target may be one or more predetermined pedestrians;
[0054] Optionally, a test set of video samples can be prepared first. The test set can include video samples and labels of predicted targets (ground-truth), as shown in Table 1. Pedestrian videos from N surveillance cameras across different scenes are generated as video samples. These videos can include indoor and outdoor recordings, and can include various factors such as body occlusion, head occlusion, backpacks, front (back, side) faces of people, different colors and styles of clothing, and different blur levels.
[0055] Table 1: Example table of labels for predicted targets
[0056]
[0057]
[0058] Optionally, the video samples and pedestrian library information can be input into the cross-camera pedestrian tracking algorithm model (i.e., the tracking algorithm to be tested), and the tracking results (camera number, frame number, predicted target identification number, and identification rectangular box position of the predicted target) of the predicted target identified and tracked by the model can be saved. The tracking results include the number of the frame in which the predicted target appears in the video sample, and the tracking prediction frame can be obtained.
[0059] Step 110: determining a matching video segment in the video sample, wherein the matching video segment is a video segment in which the ratio of the number of matching frames to the number of actual tracking frames is greater than a first threshold, the matching frame is a frame where the actual tracking frame and the predicted tracking frame overlap, and the actual tracking frame is a position where the predicted target actually appears in the video sample;
[0060] Optionally, if the predicted frame trajectory falls within a certain video segment, it is considered that the predicted frame trajectory contains the corresponding video segment, and this video segment is the video segment containing the predicted frame.
[0061] Optionally, a video segment containing the tracking prediction frame may be determined based on the tracking prediction frame;
[0062] Optionally, a video segment containing the tracked actual frame may be determined based on the tracked actual frame;
[0063] Optionally, a matching video segment in the video sample may be obtained by comparing the video segment containing the tracked prediction frame with the video segment containing the tracked actual frame;
[0064] Optionally, for each video segment containing a tracking prediction frame, frames in which the tracking prediction frame and the actual tracking frame overlap are determined, and a ratio of these overlapping frames to the actual tracking frames in the video segment is determined. If the ratio is greater than a first threshold, the video segment is determined to be a matching video segment.
[0065] Optionally, if the motion trajectory of a pedestrian passes through a camera within this timeline, it is considered that the actual frame trajectory of the pedestrian contains a corresponding video clip, and this video clip is a video clip containing an actual frame.
[0066] Optionally, all matching video segments in the video sample may be determined in this way.
[0067] Step 120, determining a test result of the tracking algorithm based on a first number of video segments containing the tracked prediction frames, a second number of video segments containing the tracked actual frames, and a third number of the matched video segments;
[0068] The video segments are obtained by dividing the video samples into segments of equal length.
[0069] Optionally, a first number of video segments containing tracking prediction frames may be determined;
[0070] Optionally, a second number of video segments containing tracked actual frames may be determined;
[0071] Optionally, a third number of all matching video segments may be determined;
[0072] Optionally, a test result of the tracking algorithm may be determined based on the first quantity, the second quantity, and the third quantity.
[0073] The tracking algorithm testing method provided by the present invention determines a video clip containing a tracking prediction frame obtained by the tracking algorithm, and a video clip containing an actual tracking frame, and compares the two, further determines a matching video clip determined after comparing the actual tracking frame and the tracking prediction frame, and determines the test result of the tracking algorithm based on the quantitative relationship between the three types of video clips, avoiding frame-by-frame comparison, reducing time consumption, and having accurate test results. It can effectively evaluate the accuracy and effectiveness of tracking algorithm detection and is more suitable for actual application scenarios.
[0074] Optionally, determining the test result of the tracking algorithm based on a first number of video segments containing the tracked prediction frames, a second number of video segments containing the tracked actual frames, and a third number of the matching video segments includes:
[0075] Determine, based on the first number, the second number, and the third number, a precision rate Precision and a recall rate Recall when the tracking algorithm performs tracking prediction on the prediction target;
[0076] A test result of the tracking algorithm is determined based on a precision Precision corresponding to at least one of the prediction targets and a recall Recall corresponding to at least one of the prediction targets.
[0077] Optionally, the Recall and Precision values of each pedestrian prediction result may be calculated based on a first number of video clips containing the tracking prediction frames, a second number of video clips containing the tracking actual frames, and a third number of the matching video clips.
[0078] Then, a test result of the tracking algorithm may be determined based on the precision Precision corresponding to at least one of the prediction targets and the recall Recall corresponding to at least one of the prediction targets.
[0079] Figure 2 FIG. 1 is a flow chart of dividing video clips provided by the present invention, such as Figure 2 As shown in the figure, the third number of matching video clips is 5, the actual tracking frame contains 7 matching video clips, and the number of matched matching video clips is 2. Therefore, the evaluation results on this track are: Recall = 2 / 7, Precision = 2 / 5. The specific calculation formula is as follows:
[0080] For the i-th pedestrian target, the evaluation index is:
[0081]
[0082] Where N is the total number of cameras, is the number of matching video segments contained in the actual frame tracked by the tracking GroundTruth trajectory of the i-th specified tracking object in camera n. is the number of matching video segments contained in the predicted track of the i-th specified tracking object in the camera n. is the number of matching video segments that contain 50% frame matches for the i-th specified tracked object in camera n.
[0083] Optionally, the Recall value and Precision value of all pedestrian library prediction results are calculated.
[0084]
[0085] Optionally, when calculating the Fscore value of the cross-camera pedestrian tracking algorithm, the Recall and Precision of all pedestrian libraries can be weighted averaged to obtain the Fscore value.
[0086]
[0087] Optionally, when testing multiple algorithms, the algorithm accuracy tests may be sorted according to the principle that the larger the Fscore value, the higher the model accuracy.
[0088] Optionally, determining a matching video segment in the video sample includes:
[0089] Determine matching frames;
[0090] In the video segments containing the matching frames, a matching video segment in which a ratio of the number of the matching frames contained therein to the number of tracked actual frames is greater than a first threshold is determined.
[0091] Optionally, frame matching may refer to that for a certain specified tracked object, within a range of a video clip corresponding to a certain actual frame, when the number of correctly predicted frames accounts for a first threshold of the number of actual frames, this situation may be considered as frame matching;
[0092] For example, the first threshold may be 0.5;
[0093] For example, 50% frame matching may mean that for a certain specified tracked object, within the range of a video clip corresponding to a certain actual frame, when the number of correctly predicted frames accounts for half of the actual number of frames, this situation can be considered as 50% frame matching.
[0094] Optionally, for a specified tracking object, within a range of a video clip containing actual frames, when the predicted tracking trajectory and the Ground Truth tracking trajectory match in more than 50% of the frames, the tracking object is deemed to have matched the video clip during algorithm tracking, and this video clip is called a matching video clip.
[0095] Optionally, determining the matching frame includes:
[0096] Determine the tracking prediction frame whose frame information matches the frame information of the tracking actual frame as the matching frame;
[0097] The frame information includes: camera number, frame number, predicted target identification number, and the position of the identification rectangle of the predicted target.
[0098] Optionally, when determining the matching frame, the predicted frame and the actual frame may be considered to match based on the matching of frame information of the tracked predicted frame and the tracked actual frame.
[0099] Optionally, determining that the tracking prediction frame whose frame information matches the frame information of the tracking actual frame is the matching frame includes:
[0100] If it is determined that the camera number of the tracking prediction frame is the same as the camera number of the tracking actual frame, and it is determined that the frame number of the tracking prediction frame is the same as the frame number of the tracking actual frame, and it is determined that the predicted target identification number of the tracking prediction frame is the same as the predicted target identification number of the tracking actual frame, and it is determined that the recognition rectangular box corresponding to the tracking prediction frame matches the recognition rectangular box corresponding to the tracking actual frame, then the tracking actual frame is determined to be the matching frame.
[0101] Optionally, when determining that the frame information of the tracking prediction frame matches the frame information of the tracking actual frame, it can be determined that the camera number of the tracking prediction frame is the same as the camera number of the tracking actual frame, and the frame number of the tracking prediction frame is the same as the frame number of the tracking actual frame, and the predicted target identification number of the tracking prediction frame is the same as the predicted target identification number of the tracking actual frame, and it is determined that the recognition rectangular box corresponding to the tracking prediction frame matches the recognition rectangular box corresponding to the tracking actual frame, then the tracking actual frame is determined to be the matching frame.
[0102] Optionally, the determining that the recognition rectangular frame corresponding to the tracking prediction frame matches the recognition rectangular frame corresponding to the tracking actual frame includes:
[0103] If it is determined that the intersection-over-union (IOU) of the recognition rectangular box corresponding to the tracking prediction frame and the recognition rectangular box corresponding to the tracking actual frame is greater than a second threshold, it is determined that the recognition rectangular box corresponding to the tracking prediction frame matches the recognition rectangular box corresponding to the tracking actual frame.
[0104] Optionally, when determining that the recognition rectangular box corresponding to the tracking prediction frame matches the recognition rectangular box corresponding to the tracking actual frame, it can be determined that the intersection-over-union (IOU) of the recognition rectangular box corresponding to the tracking prediction frame and the recognition rectangular box corresponding to the tracking actual frame is greater than a second threshold, then it is determined that the recognition rectangular box corresponding to the tracking prediction frame matches the recognition rectangular box corresponding to the tracking actual frame.
[0105] Optionally, the method further includes:
[0106] Manually label the video samples to determine the actual tracking frame.
[0107] Optionally, when determining the actual frame to be tracked, the frame information as shown in Table 1 may be determined by manual labeling.
[0108] Figure 3 This is the second flow chart of the tracking algorithm testing method provided by the present invention, such as Figure 3As shown in FIG, the present invention proposes an overall test process for the cross-camera pedestrian tracking algorithm, which includes the following steps:
[0109] 1. Prepare a diverse test set;
[0110] 2. Input the pedestrian database information into the cross-camera pedestrian tracking algorithm model and save the pedestrian identification and tracking results of the model;
[0111] 3. Divide the video into segments at fixed intervals along the time axis, calculate the Recall and Precision values of all pedestrian libraries, and finally take the weighted average to obtain the Fscore value;
[0112] 4. Algorithm testing is sorted based on the principle that the larger the Fscore value, the higher the model accuracy.
[0113] The present invention proposes concepts such as frame matching, detection position matching, video clip matching, tracking the video clip of the actual frame containing the predicted frame, 50% frame matching, matching video clips, etc., and calculates the Fscore value of the pedestrian library to test the quality of the algorithm.
[0114] The present invention combines pedestrian detection, pedestrian re-identification, pedestrian tracking and other modules for comprehensive evaluation, which can effectively evaluate the accuracy of pedestrian detection, the accuracy of pedestrian re-identification and the effectiveness of tracking. It solves the problem of the algorithm being sensitive to initial frame information and the problem of unreliable threshold percentage testing. This method is more suitable for practical application scenarios and can effectively test the accuracy of the algorithm.
[0115] The present invention calculates the recall rate (Recall) and precision rate (Precision) of all specified tracked pedestrians on the video timeline video clips, takes the weighted average of the Recall and Precision to obtain the Fscore value, and tests the quality of the algorithm based on the high or low Fscore value.
[0116] The present invention combines pedestrian detection, pedestrian re-identification, pedestrian tracking and other modules for comprehensive evaluation, which can effectively evaluate the accuracy of pedestrian detection, the accuracy of pedestrian re-identification and the effectiveness of tracking. It solves the problem of the algorithm being sensitive to initial frame information and the problem of unreliable threshold percentage testing. This method is more suitable for practical application scenarios and can effectively test the accuracy of the algorithm.
[0117] The tracking algorithm testing method provided by the present invention determines a video clip containing a tracking prediction frame obtained by the tracking algorithm, and a video clip containing an actual tracking frame, and compares the two, further determines a matching video clip determined after comparing the actual tracking frame and the tracking prediction frame, and determines the test result of the tracking algorithm based on the quantitative relationship between the three types of video clips, avoiding frame-by-frame comparison, reducing time consumption, and having accurate test results. It can effectively evaluate the accuracy and effectiveness of tracking algorithm detection and is more suitable for actual application scenarios.
[0118] The tracking algorithm testing device provided by the present invention is described below. The tracking algorithm testing device described below and the tracking algorithm testing method described above can be referenced to each other.
[0119] Figure 4 This is a schematic diagram of the structure of the tracking algorithm testing device provided by the present invention. Figure 4 As shown, the apparatus includes: an acquisition module 410, a first determination module 420, and a second determination module 430; wherein:
[0120] The acquisition module 410 is configured to track and predict a predicted target in a video sample using a tracking algorithm, and acquire a tracking prediction frame, wherein the tracking prediction frame is a position where the predicted target is predicted to appear in the video sample by the tracking algorithm;
[0121] The first determination module 420 is configured to determine a matching video segment in the video sample, wherein the matching video segment is a video segment in which the ratio of the number of matching frames to the number of actual tracking frames is greater than a first threshold, the matching frame is a frame where the actual tracking frame and the predicted tracking frame overlap, and the actual tracking frame is a position where the predicted target actually appears in the video sample;
[0122] The second determining module 430 is configured to determine a test result of the tracking algorithm based on a first number of video segments containing the tracking prediction frames, a second number of video segments containing the tracking actual frames, and a third number of the matching video segments;
[0123] The video segments are obtained by dividing the video samples into segments of equal length.
[0124] Optionally, the tracking algorithm testing device can implement tracking prediction of the predicted target in the video sample through the tracking algorithm through the acquisition module 410, and obtain the tracking prediction frame, wherein the tracking prediction frame is the position where the predicted target is predicted to appear in the video sample by the tracking algorithm; then determine the matching video segment in the video sample through the first determination module 420, wherein the matching video segment is a video segment in which the ratio of the number of matching frames contained and the number of actual tracking frames is greater than a first threshold, the matching frame is a frame in which the actual tracking frame and the tracking prediction frame overlap, and the actual tracking frame is the position where the predicted target actually appears in the video sample; then determine the test result of the tracking algorithm through the second determination module 430 based on the first number of video segments containing the tracking prediction frame, the second number of video segments containing the actual tracking frame, and the third number of matching video segments.
[0125] The tracking algorithm testing device provided by the present invention determines a video clip containing a tracking prediction frame obtained by the tracking algorithm, and a video clip containing an actual tracking frame, and compares the two, further determines a matching video clip determined after comparing the actual tracking frame and the tracking prediction frame, and determines the test result of the tracking algorithm based on the quantitative relationship between the three types of video clips, avoiding frame-by-frame comparison, reducing time consumption, and the test results are accurate. It can effectively evaluate the accuracy and effectiveness of the tracking algorithm detection, and is more suitable for actual application scenarios.
[0126] Figure 5 An example of a physical structure diagram of an electronic device is shown below. Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 may call a computer program in the memory 530 to execute the steps of the tracking algorithm testing method, for example, including:
[0127] Tracking and predicting a predicted target in a video sample using a tracking algorithm to obtain a tracking prediction frame, wherein the tracking prediction frame is a position where the predicted target is predicted to appear in the video sample by the tracking algorithm;
[0128] Determining a matching video segment in the video sample, wherein the matching video segment is a video segment in which a ratio of the number of matching frames to the number of actual tracking frames is greater than a first threshold, the matching frame is a frame where the actual tracking frame and the predicted tracking frame overlap, and the actual tracking frame is a position where the predicted target actually appears in the video sample;
[0129] determining a test result of the tracking algorithm based on a first number of video segments containing the tracked predicted frames, a second number of video segments containing the tracked actual frames, and a third number of the matching video segments;
[0130] The video segments are obtained by dividing the video samples into segments of equal length.
[0131] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0132] On the other hand, the present invention further provides a computer program product, comprising a computer program stored on a non-transitory computer-readable storage medium, wherein the computer program comprises program instructions. When the program instructions are executed by a computer, the computer is capable of performing the steps of the tracking algorithm test provided by the above methods, for example, including:
[0133] Tracking and predicting a predicted target in a video sample using a tracking algorithm to obtain a tracking prediction frame, wherein the tracking prediction frame is a position where the predicted target is predicted to appear in the video sample by the tracking algorithm;
[0134] Determining a matching video segment in the video sample, wherein the matching video segment is a video segment in which a ratio of the number of matching frames to the number of actual tracking frames is greater than a first threshold, the matching frame is a frame where the actual tracking frame and the predicted tracking frame overlap, and the actual tracking frame is a position where the predicted target actually appears in the video sample;
[0135] determining a test result of the tracking algorithm based on a first number of video segments containing the tracked predicted frames, a second number of video segments containing the tracked actual frames, and a third number of the matching video segments;
[0136] The video segments are obtained by dividing the video samples into segments of equal length.
[0137] On the other hand, an embodiment of the present application further provides a processor-readable storage medium, wherein the processor-readable storage medium stores a computer program, wherein the computer program is configured to cause the processor to execute the steps of the methods provided in the above embodiments, for example, including:
[0138] Tracking and predicting a predicted target in a video sample using a tracking algorithm to obtain a tracking prediction frame, wherein the tracking prediction frame is a position where the predicted target is predicted to appear in the video sample by the tracking algorithm;
[0139] Determining a matching video segment in the video sample, wherein the matching video segment is a video segment in which a ratio of the number of matching frames to the number of actual tracking frames is greater than a first threshold, the matching frame is a frame where the actual tracking frame and the predicted tracking frame overlap, and the actual tracking frame is a position where the predicted target actually appears in the video sample;
[0140] determining a test result of the tracking algorithm based on a first number of video segments containing the tracked predicted frames, a second number of video segments containing the tracked actual frames, and a third number of the matching video segments;
[0141] The video segments are obtained by dividing the video samples into segments of equal length.
[0142] The processor-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO)), optical storage (such as CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (such as ROMs, EPROMs, EEPROMs, non-volatile memories (NANDFLASH), solid-state drives (SSDs)), etc.
[0143] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0144] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A tracking algorithm testing method, characterized in that: include: Tracking and predicting a predicted target in a video sample using a tracking algorithm to obtain a tracking prediction frame, wherein the tracking prediction frame is a position where the predicted target is predicted to appear in the video sample by the tracking algorithm; Determining a matching video segment in the video sample, wherein the matching video segment is a video segment in which a ratio of the number of matching frames to the number of actual tracking frames is greater than a first threshold, the matching frame is a frame where the actual tracking frame and the predicted tracking frame overlap, and the actual tracking frame is a position where the predicted target actually appears in the video sample; determining a test result of the tracking algorithm based on a first number of video segments containing the tracked predicted frames, a second number of video segments containing the tracked actual frames, and a third number of the matching video segments; The video segments are obtained by dividing the video samples into segments of equal length.
2. The tracking algorithm testing method according to claim 1, characterized in that: Determining a test result of the tracking algorithm based on a first number of video segments containing the tracked prediction frame, a second number of video segments containing the tracked actual frame, and a third number of the matching video segments includes: Determine, based on the first number, the second number, and the third number, a precision rate Precision and a recall rate Recall when the tracking algorithm performs tracking prediction on the prediction target; A test result of the tracking algorithm is determined based on a precision Precision corresponding to at least one of the prediction targets and a recall Recall corresponding to at least one of the prediction targets.
3. The tracking algorithm testing method according to claim 1, characterized in that: The determining of the matching video segments in the video sample includes: Determine matching frames; In the video segments containing the matching frames, a matching video segment in which a ratio of the number of the matching frames contained therein to the number of tracked actual frames is greater than a first threshold is determined.
4. The tracking algorithm testing method according to claim 3, characterized in that: The determining of the matching frame includes: Determine the tracking prediction frame whose frame information matches the frame information of the tracking actual frame as the matching frame; The frame information includes: camera number, frame number, predicted target identification number, and the position of the identification rectangle of the predicted target.
5. The tracking algorithm testing method according to claim 4, characterized in that: The determining that the tracking prediction frame whose frame information matches the frame information of the tracking actual frame is the matching frame includes: If it is determined that the camera number of the tracking prediction frame is the same as the camera number of the tracking actual frame, and it is determined that the frame number of the tracking prediction frame is the same as the frame number of the tracking actual frame, and it is determined that the predicted target identification number of the tracking prediction frame is the same as the predicted target identification number of the tracking actual frame, and it is determined that the recognition rectangular box corresponding to the tracking prediction frame matches the recognition rectangular box corresponding to the tracking actual frame, then the tracking actual frame is determined to be the matching frame.
6. The tracking algorithm testing method according to claim 5, characterized in that: The determining that the recognition rectangular frame corresponding to the tracking prediction frame matches the recognition rectangular frame corresponding to the tracking actual frame includes: If it is determined that the intersection-over-union (IOU) of the recognition rectangular box corresponding to the tracking prediction frame and the recognition rectangular box corresponding to the tracking actual frame is greater than a second threshold, it is determined that the recognition rectangular box corresponding to the tracking prediction frame matches the recognition rectangular box corresponding to the tracking actual frame.
7. The tracking algorithm testing method according to claim 5, characterized in that: The method further comprises: Manually label the video samples to determine the actual tracking frame.
8. A tracking algorithm testing device, characterized in that: include: An acquisition module is used to track and predict the predicted target in the video sample by using a tracking algorithm to obtain a tracking prediction frame, wherein the tracking prediction frame is a position where the predicted target is predicted to appear in the video sample by the tracking algorithm; a first determining module, configured to determine a matching video segment in a video sample, wherein the matching video segment is a video segment in which a ratio of the number of matching frames to the number of actual tracking frames is greater than a first threshold, the matching frame is a frame where the actual tracking frame and the predicted tracking frame overlap, and the actual tracking frame is a position where the predicted target actually appears in the video sample; a second determining module, configured to determine a test result of the tracking algorithm based on a first number of video segments containing the tracking prediction frames, a second number of video segments containing the tracking actual frames, and a third number of the matching video segments; The video segments are obtained by dividing the video samples into segments of equal length.
9. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the steps of the tracking algorithm testing method according to any one of claims 1 to 7 are implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the tracking algorithm testing method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method, apparatus, equipment and medium for evaluating object detection and tracking algorithms
CN109145752A
Visual tracking algorithm accuracy evaluation method and system
CN112465871A