A basketball tracking cloud platform algorithm debugging log recording synchronous playback and visual diagnosis method
Patent Information
- Application Number
- CN202611081871.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-21
- Publication Date
- 2026-09-29
AI Technical Summary
本发明的目的在于解决篮球跟踪云台算法调试中问题难复现、视频与内部状态不同步以及日志解释成本高的问题,提供一种关键状态可记录、时间轴可同步、回放过程可视化且能够自动诊断的调试方法
①通过关键状态结构化记录,实现对篮球跟踪云台每一帧决策过程的完整复现;
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the fields of intelligent control system debugging, video analysis and playback, motion algorithm verification, and automatic basketball shooting technology, specifically to a method for synchronous playback and visual diagnosis of debugging logs for basketball tracking gimbal algorithms. Background Technology
[0002] Basketball tracking PTZ algorithms often involve multiple coupled modules, including candidate basketball selection, unified world coordinate mapping, state estimation, short-term occlusion protection, hard braking, lock and unlock state machines, and angular velocity control. When algorithm problems arise, developers often face difficulties such as the inability to reproduce the problem on-site, the inability to understand the processing of each frame solely from text logs, the inaccurate alignment between the video and the algorithm's internal state, and the need for repeated manual comparisons for parameter tuning.
[0003] Existing debugging methods typically rely on developers adding temporary logs, manually recording screens, and manually describing problems. There is a lack of a systematic approach that can fully record the key states of the gimbal in every frame, reconstruct the algorithm decision-making process synchronously with video playback, and automatically prompt the cause of anomalies. This results in high costs for algorithm problem localization and regression verification. Summary of the Invention
[0004] 3.1 Purpose of the Invention The purpose of this invention is to solve the problems of difficulty in reproducing issues, asynchrony between video and internal state, and high log interpretation costs in the debugging of basketball tracking gimbal algorithms. It provides a debugging method that can record key states, synchronize the timeline, visualize the playback process, and automatically diagnose problems.
[0005] 3.2 Complete Technical Solution The method of the present invention includes five main steps: key debugging status acquisition, structured debugging log storage, unified timeline synchronization, player overlay playback, and automatic anomaly diagnosis, as detailed below.
[0006] 3.2.1 Key Debugging Status Acquisition ① During each frame of the basketball tracking PTZ, collect candidate basketball information, valid basketball information, basket reference information, player frame information, state machine state, and control output information; ② Additional event-level logs are recorded when events such as state transition, hard stop, change in formal unlock count, suspension of quick unlock candidate, and update of basket reference occur; ③ Add a frame number, display timestamp, algorithm timestamp, and event sequence number to each debugging record.
[0007] 3.2.2 Structured Debug Log Storage ① Write key debugging states into the debug log in a structured format, which can be JSON, hierarchical log packages, or binary structured objects; ② Use compression, sampling, or hierarchical storage methods for high-frequency fields, and maintain complete records for low-frequency but critical event fields; ③ Retain complete source logs in development or diagnostic mode, retain lightweight logs during normal recording, and perform archiving after recording is complete.
[0008] 3.2.3 Unified Timeline Synchronization ① During the playback phase, the original video, debugging logs, and optional gimbal attitude and control command records are read simultaneously; ② Establish a unified timeline using frame numbers, display timestamps, algorithm timestamps, and event sequences to ensure that video frames correspond to debugging states frame by frame; ③ When the video frame rate and the algorithm execution frequency are not completely consistent, the corresponding relationship is established by using nearest neighbor matching, interpolation or event alignment.
[0009] 3.2.4 Player Overlay Playback ① Display candidate basketball hoops, valid basketball hoops, basket rim or basket rim reference center, basketball trajectory and world coordinate information overlaid on the player screen; ② Display the current state machine state, target angular velocity, actual angular velocity, command source, formal unlock count, fast unlock candidate flag, and hard braking related fields overlay; ③ The logical areas such as the locked area, the formal unlock area, and the quick unlock candidate area are rendered onto the player screen in a visual manner; ④ Supports quick jump to the problem frame based on status, event, exception label, and time segment.
[0010] 3.2.5 Automatic anomaly diagnosis ① Based on predefined rules, issues such as incorrect basketball selection, excessive tracking, failure to brake when necessary, locking without unlocking, unlocking too early, and abnormal basket reference are automatically marked; ② Display the exception flag along with the current frame context, command source, and trigger field to help developers determine the cause of the exception; ③ Use abnormal results as input for regression verification, and automatically compare the running behavior before and after the algorithm is modified.
[0011] 3.3 Beneficial Effects Compared with the prior art, the present invention has the following beneficial effects: ① By recording key states in a structured manner, the decision-making process of each frame of the basketball tracking gimbal can be completely reproduced; ② By synchronizing with a unified timeline, video, algorithm status, and PTZ control commands are accurately aligned, reducing the cost of manual comparison; ③ By overlaying playback through the player, candidate basketballs, effective basketballs, state machine states, and command sources are directly rendered onto the video, improving the interpretability of the algorithm's decision-making process; ④ Through automatic anomaly diagnosis, it is possible to locate incorrect basketball selection, over-tracking, and lock logic anomalies, thus shortening the debugging cycle; ⑤ Improve the stability and engineering efficiency of the basketball tracking gimbal algorithm iteration by logging and regression comparison. Attached Figure Description
[0012] Figure 1 This is an overall architecture diagram for debugging recording and synchronous playback, used to illustrate the relationship between algorithm execution, debugging log storage, and player playback; Figure 2 This is a diagram of frame-level structured debug log fields, used to display fields such as candidate basketballs, valid basketballs, state machine states, and command sources; Figure 3 To unify the timeline synchronization flowchart, it is used to show the alignment relationship between frame number, display timestamp, and algorithm timestamp; Figure 4 An overlay of the playback interface diagram is used to demonstrate the rendering methods of the trajectory, status labels, unlock area, and diagnostic prompts. Figure 5 This is a flowchart for automatic anomaly diagnosis and regression comparison, used to illustrate the logic of anomaly identification and regression comparison. Detailed Implementation
[0013] The method of the present invention will be further explained below in conjunction with the actual debugging process of the basketball tracking gimbal.
[0014] Example 1: Localization of the problem of mislocking in locked state In this embodiment, the developers discovered that the gimbal sometimes resumed tracking the ball prematurely while in a locked state. During the recording phase, the system retains frame-level and event-level debug logs, which record the candidate basketball positions, the official unlock count, the quick unlock candidate flag, the command source, and the current state machine state. During the playback phase, the locked area, the official unlock area, and the quick unlock candidate area are overlaid on the video. It was found that in a certain frame, the basketball only briefly entered the quick unlock candidate area and did not continuously hit the official unlock area, but subsequent event logs showed that the quick unlock was incorrectly confirmed. Based on this, the developers narrowed down the scope of their investigation.
[0015] Example 2: Localization of the problem of failure to brake when required in a short-term occlusion scenario In this embodiment, after a basketball is passed laterally and caught by a player, it is necessary to determine why a hard stop was not triggered in a particular instance. The system displays the previous valid basketball snapshot, the overlapping state of the players, the maximum speed within the most recent window, the world coordinate displacement, and the number of direction reversals by replaying and overlaying the data. It also marks "should have stopped but didn't" in the automatic anomaly diagnosis. Based on this, the developers discovered that there were insufficient valid basketball samples within the most recent window, and then optimized the sampling records and judgment thresholds.
[0016] Application scenarios The method of this invention can be applied to scenarios such as basketball tracking gimbal algorithm development, training field debugging, on-site problem review of competitions, regression verification platform, equipment after-sales problem localization, and multi-version algorithm comparison and evaluation.
[0017] Summary of technical effects This invention integrates debugging log recording, time synchronization, video playback, diagnostic prompts, and regression verification into the same debugging system, enabling the internal decision-making process of the complex state machine and control algorithm of the basketball tracking gimbal to be recorded, synchronized, and reproduced, thereby improving the efficiency of problem localization, the reproducibility of the debugging process, and the consistency of multi-version regression verification.
[0018] Example of key debug field categories The candidate basketball field can include candidate location, confidence level, and rejection reason, which are used to record why a candidate was not selected and are applicable to the candidate basketball screening process.
[0019] The effective basketball field can include world coordinates, velocity, and predicted position, which are used to reproduce the target tracking, state estimation, and control process.
[0020] The state machine fields can include the current state, unlock count, and candidate flags, which are used to record the triggering conditions for state transitions and are suitable for the analysis of locking and unlocking logic.
[0021] The control fields can include target angular velocity, actual angular velocity, and command source, which are used to record the basis for generating the gimbal control output.
[0022] The abnormal fields can include hard braking indicators, abnormal labels, and diagnostic prompts to help locate the cause of the abnormality and support automatic diagnosis and regression verification.
[0023] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the present invention. Equivalent substitutions or improvements made by those skilled in the art without departing from the concept of the present invention should all fall within the scope of protection of the present invention.
Claims
1. A method for synchronous playback and visual diagnosis of debugging log recording of basketball tracking gimbal algorithm, characterized in that, Includes the following steps: (1) During the execution of the basketball tracking PTZ, key debugging status is collected frame by frame or event by event; (2) The key debugging states include at least candidate basketball information, valid basketball information, basket reference information, state machine state, control output information and time synchronization information; (3) Write the key debugging status into the structured debugging log based on at least one of the frame number, display timestamp, algorithm timestamp and event sequence number; (4) During the playback phase, read the video data and the structured debugging log, and establish the correspondence between video frames and key debugging states based on a unified timeline; (5) Overlay the key debugging status, trajectory information and diagnostic information corresponding to the current frame in the playback interface to reproduce the decision-making process of the basketball tracking gimbal at the corresponding moment; (6) Based on predefined diagnostic rules or comparison rules, automatically generate diagnostic conclusions or parameter adjustment prompts for abnormal scenarios.
2. The method according to claim 1, characterized in that, The key debugging states in step (1) adopt a mixed acquisition mode of frame-level recording and event-level recording. Frame-level recording is used to save continuous states, while event-level recording is used to save key events such as state switching, hard braking, unlock confirmation, and changes in the basket reference.
3. The method according to claim 1, characterized in that, The candidate basketball information in step (2) includes at least the candidate basketball position, candidate confidence level, candidate scoring basis and candidate rejection reason; the effective basketball information includes at least the current effective basketball position, world coordinates, speed, predicted position and the previous effective basketball snapshot.
4. The method according to claim 1, characterized in that, The state machine state and control output information in step (2) include at least the normal tracking state, pre-locked state, locked state, target angular velocity, actual angular velocity, command source, formal unlock count, fast unlock candidate flag, and hard brake trigger result.
5. The method according to claim 1, characterized in that, The structured debug logs in step (3) are stored in the form of JSON, binary structured objects or hierarchical log packages, and different sampling frequencies or compression strategies are used for high-frequency fields and low-frequency fields.
6. The method according to claim 1, characterized in that, In step (4), a unified timeline is established using frame number, display timestamp, algorithm timestamp and log event sequence number, so that video frames, debugging logs and gimbal sensor information are synchronized and aligned during playback.
7. The method according to claim 1, characterized in that, The replay interface in step (5) should at least overlay the candidate basketball hoop, the valid basketball hoop, the basket hoop or basket reference center, the basketball world coordinate trajectory, the locked area, the unlocked area, the status label, the command source or the angular velocity curve.
8. The method according to claim 1, characterized in that, The abnormal scenarios in step (6) include at least the following: misselection of basketball, excessive tracking, failure to brake when required, locking but not unlocking, unlocking too early, and basket reference abnormality. It also supports jump positioning according to state machine state, event label, time segment, or abnormality type.
9. The method according to claim 1, characterized in that, Lightweight logs are retained by default during the mobile recording phase, while complete source logs are retained in development or diagnostic modes. After archiving, the debug logs are associated with video recordings, training records, or gimbal device records.