Table tennis serving detection and compliance judgment method, device and equipment and medium
By using a monocular camera and a YOLOv5 model for table tennis serve detection and compliance assessment, this technology solves the problems of large human error and high hardware cost in existing technologies, and achieves efficient and accurate serve detection and compliance assessment without additional hardware dependence.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 恒鸿达(福建)体育科技有限公司
- Filing Date
- 2025-12-12
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies for detecting table tennis serves suffer from problems such as large subjective errors in manual judgment, high labor costs, complex deployment and high maintenance costs of physical sensors, and high false negative rates in trajectory capture using general vision solutions. These technologies cannot meet the demand for automated scoring that requires no additional hardware and is accurate in real time.
The system uses a monocular camera to capture video streams of the serving scene, and uses human-computer interaction to calibrate key points on the table and net. The YOLOv5 target detection model is used to identify table tennis balls, rackets, and human targets. A special temporal modeling network for serving is constructed to extract motion features and integrate the landing area, net crossing status, and body position for compliance judgment.
It achieves accurate ball detection with no hardware dependency and low deployment cost, with a trajectory capture success rate of up to 95%, a judgment accuracy of ≥93%, supports 50FPS real-time detection, and is suitable for a variety of scenarios.
Smart Images

Figure CN121962641A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, device, and medium for detecting and determining compliance in table tennis serve. Background Technology
[0002] The serve in table tennis is the core starting point of both matches and training, and its compliance (including the landing area, net clearance, and proper technique) directly determines the validity of a score. In scenarios such as middle school entrance exams, amateur leagues, and daily training, traditional serve judgment relies on human referees or specialized physical equipment, which suffers from high labor costs, significant subjective errors, complex deployment, and high maintenance costs. With the development of AI-powered sports intelligence, there is an urgent need for a purely visual detection solution that requires no additional hardware, is accurate in real-time, and conforms to international / domestic serve rules, meeting the practical needs of automated scoring, fair competition, and efficient training evaluation.
[0003] Existing technologies include: 1. Human referee judgment, which involves visually observing indicators such as the ball's landing point, net clearance height, and striking motion, and then providing a compliance conclusion based on the rules; 2. Physical sensor solutions, which involve installing pressure sensors, infrared sensors, and laser sensors on the table surface, racket, or net to determine the ball's contact with the table and its clearance through contact detection; 3. General visual tracking solutions, which use algorithms such as IOU matching and Kalman filtering to track the trajectory of the table tennis ball, but have not been specifically optimized for the short trajectory and high-speed motion characteristics of the serve.
[0004] Disadvantages: 1. Manual solution: Large subjective bias (such as visual judgment error of landing point boundary and net height), high labor cost (multiple referees are required for multiple tests), no traceability of judgment basis, unsuitable for large-scale standardized testing scenarios; 2. Physical sensor solution: Complex deployment (requires modification of table / racket), high maintenance cost (sensors are easily affected by dust and vibration), damages the original structure of equipment, difficult to promote to ordinary training or temporary competition venues; 3. General vision solution: Not adapted to the short trajectory characteristics of the serve (the entire serve is only 1-3 seconds), high trajectory capture miss rate (especially in high-speed serve scenarios), lack of service-specific rule adaptation (such as service area constraints, net height threshold, and action compliance judgment), can only output trajectory, and cannot directly determine the validity of the serve. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a method, device, equipment and medium for detecting and judging the compliance of table tennis serves, which has no hardware dependence, low deployment cost and accurate judgment.
[0006] In a first aspect, the present invention provides a method for detecting and determining the compliance of a table tennis serve, comprising the following steps: S1. Mark the nine designated vertices of the serving area on the table to form four rectangular regions, including the upper left region, upper right region, lower left region, and lower right region; mark the two ends of the net to form a straight line for the net; S2. The YOLOv5 target detection model is used to detect the input serving scene image in real time, identify three types of targets: human body, racket and ping-pong ball, and output the position coordinates, category and confidence of each target; the bounding boxes of the detected targets are differentially magnified and redundant targets outside the table area are filtered based on the coordinate range of the table calibration. S3. Construct a time-series data input layer, including the ping-pong ball center coordinate sequence, motion state time-series features, scene-related time-series data, and filtered time-series states; extract velocity time-series features, direction time-series features, and event-related time-series features; Based on inflection point detection, three key timing nodes are located: the serve initiation node, the landing point on the player's side of the table, and the landing point on the opponent's side of the table. S4. Based on the key timing nodes and timing features, judge the compliance of the serve from three dimensions: landing area, net crossing status, and body position, and output the serve analysis results.
[0007] Secondly, the present invention provides a table tennis serve detection and compliance determination device, comprising: The court marking module marks the nine set vertices of the serving area of the table, forming four rectangular areas, including the upper left, upper right, lower left, and lower right areas; it also marks the two ends of the net to form a straight line for the net. The multi-target detection module uses the YOLOv5 target detection model to perform real-time detection on the input serve scene image, identifying three types of targets: human body, racket, and ping-pong ball, and outputting the position coordinates, category, and confidence score of each target; it performs differential magnification processing on the bounding boxes of the detected targets, and filters redundant targets outside the table area based on the coordinate range calibrated by the table; The temporal modeling module constructs a temporal data input layer, including the ping-pong ball center coordinate sequence, motion state temporal features, scene-related temporal data, and filtered temporal states; it extracts velocity temporal features, direction temporal features, and event-related temporal features. Based on inflection point detection, three key timing nodes are located: the serve initiation node, the landing point on the player's side of the table, and the landing point on the opponent's side of the table. The compliance judgment module, based on the key timing nodes and timing characteristics, judges the compliance of the serve from three dimensions: landing area, net crossing status, and body position, and outputs the serve analysis results.
[0008] Thirdly, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in the first aspect.
[0009] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0010] One or more technical solutions provided by this invention have at least the following technical effects or advantages: 1. No hardware dependency and low deployment cost: Only a monocular camera and a computing terminal are required. No modification to the table or racket is needed. The deployment efficiency is 80% higher than that of physical sensor solutions, and it is suitable for various venue scenarios. 2. Strong stability in short trajectory tracking: By using a serve-specific temporal modeling network, the motion characteristics of high-speed short trajectories are captured, with a trajectory capture success rate of ≥95% and a false negative rate reduced by 15% compared to general vision solutions; 3. Comprehensive and accurate compliance judgment: Covering dimensions such as landing point, crossing the net, and action, with an accuracy rate of ≥93%, avoiding human subjective error and meeting standardized testing requirements; 4. Excellent real-time performance: It adopts a lightweight detection and temporal modeling network, with a single frame processing time of ≤30ms, supports 50FPS real-time detection, and is suitable for high-speed serve scenarios; 5. High scalability: By adjusting the calibration area, speed threshold, and action judgment rules, it can be adapted to different scenarios such as middle school physical education exams, professional training, and amateur competitions. It can also be extended to serve detection for other ball sports such as badminton and tennis.
[0011] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0012] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0013] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the device in Embodiment 2 of the present invention. Detailed Implementation
[0014] The overall concept of the technical solution in this application is as follows: This invention addresses the core characteristics of table tennis serves—short trajectory, high-speed movement, and strong rule constraints—by proposing an integrated solution encompassing visual acquisition, multi-target detection, serve-specific temporal modeling, and multi-dimensional compliance judgment. 1. It acquires video streams of the serve scene using a monocular camera, and completes the calibration of key points on the table and net through human-computer interaction. 2. It employs a lightweight target detection algorithm to simultaneously acquire the positional information of the table tennis ball, racket, and player, filtering out background interference. 3. It designs a serve-specific temporal modeling network, extracting motion features such as velocity, acceleration, angle, and trajectory curvature based on the detection box coordinate sequence to capture the serve motion patterns under short trajectories and solve the tracking stability problem of high-speed short trajectories. 4. It integrates serve rule requirements to construct a compliance judgment model encompassing dimensions such as "landing area, net crossing status, and hitting position." 5. It outputs serve compliance results and violation types, achieving end-to-end pure visual serve detection without any additional hardware.
[0015] 1. Site marking 1.1 Calibrating Key Areas Using the human-computer interaction interface of the computing terminal, key points (pixel coordinates) are calibrated, and a scene configuration file is generated. Table tennis table: The nine vertices of the serving area are calibrated as follows: A (top left), B (top center), C (top right), D (center left), E (center center), F (center right), G (bottom left), H (bottom center), and I (bottom right), forming four rectangular areas: top left (0), top right (1), bottom left (2), and bottom right (3), which serve as the basis for judging the compliance of the serve landing point. Net area: The endpoints J (left endpoint) and K (right endpoint) of the net are calibrated, forming a straight line JK for net crossing detection.
[0016] 2. Real-time detection of multiple targets Real-time multi-target detection is the core data input step for serve trajectory analysis. This solution uses the YOLOv5 target detection model to achieve synchronous recognition of three core targets: "person-racket-ping-pong ball". It optimizes the detection results by combining scene characteristics to ensure the accuracy and real-time performance of target capture in high-speed serve scenarios, and provides high-quality target coordinate data for subsequent time series modeling.
[0017] 2.1 Detection Model Deployment and Result Analysis The detection model adopts the lightweight YOLOv5 architecture, and after being fine-tuned with a special dataset, it is deployed on a computing terminal. The model input is a 1920×1080 resolution serving scene image, and the output is a feature tensor containing the target location, category, and confidence level.
[0018] 2.2 Target Classification and Bounding Box Optimization To address the different motion characteristics and detection requirements of the three target types, separate filtering logics were constructed. Through coordinate calculation, bounding box calibration, and scene-based magnification, target bounding box data adapted for subsequent tracking was generated. The calibration bounding box was magnified by 1.1 times to form the final target bounding box used for tracking. The racket was magnified by 1.2 times to balance tracking accuracy and range. The ping-pong ball retained its original detection box size for trajectory calculation, while a 1.5 times magnified bounding box was used for tracking association.
[0019] 2.3 Redundant Target Filtering To address the issue of false detection of multiple targets (such as irrelevant people in the background or ghosting of the racket), filtering rules are constructed based on the coordinate range of the table tennis table to retain only valid targets within the table tennis table area.
[0020] 3. Serving-specific time series modeling The serve-specific temporal modeling transforms the discrete frame data of the entire serve process into key links in a structured temporal event chain. Its core objective is to accurately extract key technical parameters such as serve speed, direction, and spin trends through temporal correlation and feature modeling, providing a quantitative basis for serve quality assessment. Its modeling logic closely relies on trajectory tracking, feature extraction, and inflection point detection modules, forming a complete chain of "data input - temporal feature engineering - key node localization - modeling output."
[0021] 3.1 Time-series data input layer: Multi-source data association and synchronization Target temporal trajectory: The coordinate sequence of the center of the ping-pong ball, combined with the coordinate data smoothed by the sliding window, is sorted by frame number to form the basic temporal trajectory, and the sampling frequency is consistent with the video frame rate.
[0022] Motion state timing characteristics: First / second derivatives, motion angles, and inter-frame distance synchronized by frame reflect the dynamic changes in speed and direction during the serve.
[0023] Scene-related time-series data: table area division results, racket boundary time sequence, and human position time-series data provide scene benchmarks for the compliance of the serving area and the association of hitting actions.
[0024] Filtered temporal state: The predicted coordinates and corrected state after Kalman filtering are used to fill in the missing frames during the high-speed flight phase of the serve, ensuring the continuity of temporal data.
[0025] 3.2 Service Timing Feature Engineering: Temporal Representation of Dynamic Features In response to the "short time and high dynamic" characteristics of serves, three types of core temporal features are constructed to achieve feature fusion of "motion state - event association - scene adaptation".
[0026] Speed temporal characteristics: Based on the inter-frame distance and combined with the video frame rate, the instantaneous speed temporal sequence is calculated. The core processing includes: instantaneous speed calculation, which reflects the change in the ball's flight speed after the serve; speed trend characteristics, which distinguishes between the "serve acceleration segment" (large variance, increasing mean) and the "uniform flight segment" (small variance, stable mean) based on the sliding mean and variance of the speed of the most recent 3 frames.
[0027] Directional temporal features: Based on the motion angle and average direction, directional temporal features are constructed to meet the needs of serving direction judgment. Directional stability index: The variance of the angle is calculated for 5 consecutive frames. The variance is large in the serving initiation stage (direction adjustment) and small after the ball is hit (direction stability). Directional trend vector: By fitting the linear trend of the serving direction through the temporal change of the average direction, if the y-direction component is continuously negative and the absolute value increases, it represents a "backspin" trend in the serve.
[0028] Event-related temporal features: The discrete event of "racket contact - ball departure" is transformed into a temporal feature, based on the association logic of `ping` and `bat_box`. Hit timing markers: When `ping` changes from 0 to non-zero, it is marked as the "hit start timing point"; when the ball moves from inside to outside `bat_box`, it is marked as the "hit end timing point". The interval between these two points is the "hit contact duration". Inflection point association features: Inflection point indices are mapped to timing stamps, forming a temporal event chain of "serve start point (t1) - home table landing point (t2) - opponent's table landing point (t3)".
[0029] 2.3 Key Timing Node Location for Serving: Event Anchoring Based on Inflection Points Based on inflection point detection logic, three core serving nodes are located in the time-series trajectory, forming time-series anchor points for the entire serving process. The serving start node (t1) corresponds to the first inflection point, and its core time-series characteristics are "racket contact event → departure event + velocity peak appearance + second-order differential mutation"; the landing point on the player's side of the table (t2) corresponds to the second inflection point, and its time-series characteristics are "angle mutation (>12°) + y-coordinate begins to decrease + velocity increases sharply from 0"; the landing point on the opponent's side of the table (t3) corresponds to the third inflection point, and its time-series characteristics are "speed decreases sharply + angle variance mutation + position enters the opponent's table area". If the node is located in the opponent's table area and has not gone out of bounds, the serve score is determined.
[0030] 4. Multidimensional compliance assessment Multidimensional compliance assessment is a core component of table tennis serve quality evaluation. Based on the court marking information such as the table and net, it integrates data such as trajectory, motion state, and event nodes output by time-series modeling. A closed-loop assessment system is constructed from three core dimensions: "effectiveness of landing point", "standardization of net crossing", and "compliance of body position". All assessment logic is based on real-time status data to ensure the accuracy and timeliness of the assessment results.
[0031] 4.1 Compliance assessment of landing area First, the table area of the landing point is calculated using a method. The table is pre-divided into four areas: upper left (0), upper right (1), lower left (2), and lower right (3). The lower left and lower right areas are the effective scoring areas of the opponent's side of the serving side. Second, the continuity of the landing point trajectory is verified—the temporal trajectory from the hitting point to the landing point needs to continuously extend towards the opponent's table area. Finally, combined with the inter-frame distance, it is confirmed that the speed of the three frames before the landing point shows a decreasing trend (which meets the landing deceleration characteristic). If the landing point is located in the lower left (2) or lower right (3) area and meets the trajectory continuity and speed characteristics, it is judged as "landing point compliant".
[0032] 4.2 Compliance judgment of network access status The compliance assessment of the net crossing status focuses on "whether it brushes the net," achieving precise judgment through trajectory time sequence analysis and geometric distance calculation. The core reuse system utilizes its point-to-line distance calculation capability and net crossing frame recognition logic. Net crossing frame recognition involves traversing the trajectory sequence to find the frame where the y-coordinate first falls below the net's straight line JK (the instant the ping-pong ball crosses the net). Net crossing height calculation: Based on the point-to-line distance formula, the vertical distance from the ball's center to the net's straight line JK is calculated. For compliance judgment, this is converted to a physical distance (based on the calibrated ping-pong ball diameter). If the physical distance is ≥5mm (1 / 8 of the standard ping-pong ball diameter, avoiding net brushing violations), it is judged as "net crossing compliant"; otherwise, it is judged as "net brushing violation."
[0033] 4.3 Judgment of compliance of the body midline during the serve The critical timing interval for the serve is from the start of the stroke to the end of the stroke. The body position within this interval directly affects the compliance of the serve. Within this critical timing interval, the positional relationship between the body's center x-coordinate and the center line of the table is continuously monitored. If the body's center x-coordinate is on the "serving side" in all frames, it is considered "compliant body position." If the body's center x-coordinate exceeds the center line redundancy range in any frame, and the duration is ≥2 frames (excluding jitter detection), it is considered "body crossing the line violation."
[0034] Example 1 like Figure 1 As shown, this embodiment provides a method for detecting and determining compliance of table tennis serves, including the following steps: S1. Mark the nine designated vertices of the serving area on the table to form four rectangular regions, including the upper left region, upper right region, lower left region, and lower right region; mark the two ends of the net to form a straight line for the net; S2. The YOLOv5 target detection model is used to detect the input serving scene image in real time, identify three types of targets: human body, racket and ping-pong ball, and output the position coordinates, category and confidence of each target; the bounding boxes of the detected targets are differentially magnified and redundant targets outside the table area are filtered based on the coordinate range of the table calibration. S3. Construct a time-series data input layer, including the ping-pong ball center coordinate sequence, motion state time-series features, scene-related time-series data, and filtered time-series states; extract velocity time-series features, direction time-series features, and event-related time-series features; Based on inflection point detection, three key timing nodes are located: the serve initiation node, the landing point on the player's side of the table, and the landing point on the opponent's side of the table. S4. Based on the key timing nodes and timing features, judge the compliance of the serve from three dimensions: landing area, net crossing status, and body position, and output the serve analysis results.
[0035] In this embodiment, preferably, in step S1: The nine vertices include top-left vertex A, top-middle vertex B, top-right vertex C, left-middle vertex D, middle-middle vertex E, right-middle vertex F, bottom-left vertex G, bottom-middle vertex H, and bottom-right vertex I; The straight line of the net is formed by connecting the left endpoint J and the right endpoint K; Generate a scene configuration file containing the pixel coordinates of the calibration points; The differential amplification process in step S2 specifically includes: The detection box for human targets is enlarged by 1.1 times; The detection frame of the racket target is enlarged by 1.2 times; The original detection bounding box of the ping-pong ball target is retained for trajectory calculation, while a 1.5x magnified bounding box is generated for tracking and association.
[0036] In this embodiment, preferably, the motion state timing features in step S3 include: first-order and second-order differentials synchronized by frame, motion angle, and inter-frame distance; The speed temporal features include: instantaneous speed calculated based on inter-frame distance and video frame rate; and speed trend features calculated based on the sliding mean and variance of the speeds of the most recent 3 frames, used to distinguish between the serve acceleration phase and the uniform flight phase. The directional temporal features include: a directional stability index calculated based on the angular variance of five consecutive frames; and a directional trend vector fitted by the temporal variation of the average direction. The event-related timing features include: a ball-hitting timing marker, which marks the start of the ball-hitting timing point when the contact state between the ping-pong ball and the racket changes from no contact to contact, and marks the end of the ball-hitting timing point when the ping-pong ball leaves the racket's boundary frame; and an inflection point association feature, which maps inflection point indices to timing stamps to form a timing event chain of the serve start point, the landing point on the player's side of the table, and the landing point on the opponent's side of the table. The location of the key timing nodes is specifically as follows: The serve initiation node corresponds to the first inflection point, characterized by the transition from racket contact event to racket departure event, the appearance of peak velocity, and abrupt change in the second derivative. The landing point of this side of the table corresponds to the second inflection point, characterized by an angle change greater than 12 degrees, the y-coordinate starting to decrease, and the velocity increasing sharply from 0. The landing point on the opponent's table corresponds to the third inflection point, characterized by a sudden decrease in speed, a sudden change in angle variance, and the position entering the opponent's table area.
[0037] In this embodiment, preferably, the compliance determination of the landing area in step S4 includes: Determine whether the landing point is located in the lower left or lower right region; Verify whether the time trajectory from the point of impact to the point of landing continuously extends towards the opponent's court area; Confirm whether the velocity in the three frames before the landing point shows a decreasing trend; When all of the above conditions are met, the landing point is deemed compliant. The compliance determination of the network access status in step S4 includes: Traverse the trajectory sequence and identify the frame where the y-coordinate first falls below the straight line of the net. The vertical distance from the center of the ping-pong ball to the net in the frame has been calculated; The vertical distance is converted into a physical distance. If the physical distance is greater than or equal to 5 mm, it is considered compliant to cross the net; otherwise, it is considered a violation to wipe the net. The body position compliance determination in step S4 includes: Determine the critical timing interval from the start of the shot to the end of the shot; Monitor the positional relationship between the x-coordinate of the human body center and the center line of the ball table during key time intervals; The body position is considered compliant when the x-coordinate of the human body center is located on the side of the server in all frames. When the x-coordinate of the human body's center in any frame exceeds the midline and the duration is greater than or equal to 2 frames, it is determined to be a violation of the body crossing the line.
[0038] Based on the same inventive concept, this application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2.
[0039] Example 2 like Figure 2 As shown, this embodiment provides a table tennis serve detection and compliance determination device, including: The court marking module marks the nine set vertices of the serving area of the table, forming four rectangular areas, including the upper left, upper right, lower left, and lower right areas; it also marks the two ends of the net to form a straight line for the net. The multi-target detection module uses the YOLOv5 target detection model to perform real-time detection on the input serve scene image, identifying three types of targets: human body, racket, and ping-pong ball, and outputting the position coordinates, category, and confidence score of each target; it performs differential magnification processing on the bounding boxes of the detected targets, and filters redundant targets outside the table area based on the coordinate range calibrated by the table; The temporal modeling module constructs a temporal data input layer, including the ping-pong ball center coordinate sequence, motion state temporal features, scene-related temporal data, and filtered temporal states; it extracts velocity temporal features, direction temporal features, and event-related temporal features. Based on inflection point detection, three key timing nodes are located: the serve initiation node, the landing point on the player's side of the table, and the landing point on the opponent's side of the table. The compliance judgment module, based on the key timing nodes and timing characteristics, judges the compliance of the serve from three dimensions: landing area, net crossing status, and body position, and outputs the serve analysis results.
[0040] In this embodiment, preferably, the site calibration module includes: The nine vertices include top-left vertex A, top-middle vertex B, top-right vertex C, left-middle vertex D, middle-middle vertex E, right-middle vertex F, bottom-left vertex G, bottom-middle vertex H, and bottom-right vertex I; The straight line of the net is formed by connecting the left endpoint J and the right endpoint K; Generate a scene configuration file containing the pixel coordinates of the calibration points; The differential amplification processing in the multi-target detection module specifically includes: The detection box for human targets is enlarged by 1.1 times; The detection frame of the racket target is enlarged by 1.2 times; The original detection bounding box of the ping-pong ball target is retained for trajectory calculation, while a 1.5x magnified bounding box is generated for tracking and association.
[0041] In this embodiment, preferably, the motion state temporal features in the temporal modeling module include: first-order and second-order derivatives synchronized by frame, motion angle, and inter-frame distance; The speed temporal features include: instantaneous speed calculated based on inter-frame distance and video frame rate; and speed trend features calculated based on the sliding mean and variance of the speeds of the most recent 3 frames, used to distinguish between the serve acceleration phase and the uniform flight phase. The directional temporal features include: a directional stability index calculated based on the angular variance of five consecutive frames; and a directional trend vector fitted by the temporal variation of the average direction. The event-related timing features include: a ball-hitting timing marker, which marks the start of the ball-hitting timing point when the contact state between the ping-pong ball and the racket changes from no contact to contact, and marks the end of the ball-hitting timing point when the ping-pong ball leaves the racket's boundary frame; and an inflection point association feature, which maps inflection point indices to timing stamps to form a timing event chain of the serve start point, the landing point on the player's side of the table, and the landing point on the opponent's side of the table. The location of the key timing nodes is specifically as follows: The serve initiation node corresponds to the first inflection point, characterized by the transition from racket contact event to racket departure event, the appearance of peak velocity, and abrupt change in the second derivative. The landing point of this side of the table corresponds to the second inflection point, characterized by an angle change greater than 12 degrees, the y-coordinate starting to decrease, and the velocity increasing sharply from 0. The landing point on the opponent's table corresponds to the third inflection point, characterized by a sudden decrease in speed, a sudden change in angle variance, and the position entering the opponent's table area.
[0042] In this embodiment, preferably, the compliance judgment of the landing area in the compliance judgment module includes: Determine whether the landing point is located in the lower left or lower right region; Verify whether the time trajectory from the point of impact to the point of landing continuously extends towards the opponent's court area; Confirm whether the velocity in the three frames before the landing point shows a decreasing trend; When all of the above conditions are met, the landing point is deemed compliant. The compliance judgment module includes the following: Traverse the trajectory sequence and identify the frame where the y-coordinate first falls below the straight line of the net. The vertical distance from the center of the ping-pong ball to the net in the frame has been calculated; The vertical distance is converted into a physical distance. If the physical distance is greater than or equal to 5 mm, it is considered compliant to cross the net; otherwise, it is considered a violation to wipe the net. The compliance assessment module includes the following: Determine the critical timing interval from the start of the shot to the end of the shot; Monitor the positional relationship between the x-coordinate of the human body center and the center line of the ball table during key time intervals; The body position is considered compliant when the x-coordinate of the human body center is located on the side of the server in all frames. When the x-coordinate of the human body's center in any frame exceeds the midline and the duration is greater than or equal to 2 frames, it is determined to be a violation of the body crossing the line.
[0043] Since the apparatus described in Embodiment 2 of the present invention is an apparatus used to implement the method of Embodiment 1 of the present invention, those skilled in the art can understand the specific structure and variations of the apparatus based on the method described in Embodiment 1 of the present invention, and therefore will not be described again here. All apparatuses used in the method of Embodiment 1 of the present invention fall within the scope of protection of the present invention.
[0044] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to Embodiment 1, as detailed in Embodiment 3.
[0045] Example 3 This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can implement any of the implementation methods in Embodiment 1.
[0046] Since the electronic device described in this embodiment is the device used to implement the method in Embodiment 1 of this application, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in Embodiment 1 of this application. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection of this application.
[0047] Based on the same inventive concept, this application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4.
[0048] Example 4 This embodiment provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it can implement any of the implementation methods in Embodiment 1.
[0049] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0050] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0051] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0052] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0053] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for detecting and determining compliance of table tennis serves, characterized in that, Includes the following steps: S1. Mark the nine designated vertices of the serving area on the table to form four rectangular regions, including the upper left region, upper right region, lower left region, and lower right region; mark the two ends of the net to form a straight line for the net; S2. The YOLOv5 target detection model is used to detect the input serving scene image in real time, identify three types of targets: human body, racket and ping-pong ball, and output the position coordinates, category and confidence of each target; the bounding boxes of the detected targets are differentially magnified and redundant targets outside the table area are filtered based on the coordinate range of the table calibration. S3. Construct a time-series data input layer, including the table tennis ball center coordinate sequence, motion state time-series features, scene-related time-series data, and filtered time-series state; Extract temporal features of velocity, direction, and event association; Based on inflection point detection, three key timing nodes are located: the serve initiation node, the landing point on the player's side of the table, and the landing point on the opponent's side of the table. S4. Based on the key timing nodes and timing features, judge the compliance of the serve from three dimensions: landing area, net crossing status, and body position, and output the serve analysis results.
2. The method for detecting and determining compliance of table tennis serves according to claim 1, characterized in that, In step S1: The nine vertices include top-left vertex A, top-middle vertex B, top-right vertex C, left-middle vertex D, middle-middle vertex E, right-middle vertex F, bottom-left vertex G, bottom-middle vertex H, and bottom-right vertex I; The straight line of the net is formed by connecting the left endpoint J and the right endpoint K; Generate a scene configuration file containing the pixel coordinates of the calibration points; The differential amplification process in step S2 specifically includes: The detection box for human targets is enlarged by 1.1 times; The detection frame of the racket target is enlarged by 1.2 times; The original detection bounding box of the ping-pong ball target is retained for trajectory calculation, while a 1.5x magnified bounding box is generated for tracking and association.
3. The method for detecting and determining compliance of table tennis serves according to claim 1, characterized in that, The motion state timing features in step S3 include: first-order and second-order derivatives synchronized by frame, motion angle, and inter-frame distance; The speed temporal features include: instantaneous speed calculated based on inter-frame distance and video frame rate; and speed trend features calculated based on the sliding mean and variance of the speeds of the most recent 3 frames, used to distinguish between the serve acceleration phase and the uniform flight phase. The directional temporal features include: a directional stability index calculated based on the angular variance of five consecutive frames; and a directional trend vector fitted by the temporal variation of the average direction. The event-related timing features include: a ball-hitting timing marker, which marks the start of the ball-hitting timing point when the contact state between the ping-pong ball and the racket changes from no contact to contact, and marks the end of the ball-hitting timing point when the ping-pong ball leaves the racket's boundary frame; and an inflection point association feature, which maps inflection point indices to timing stamps to form a timing event chain of the serve start point, the landing point on the player's side of the table, and the landing point on the opponent's side of the table. The location of the key timing nodes is specifically as follows: The serve initiation node corresponds to the first inflection point, characterized by the transition from racket contact event to racket departure event, the appearance of peak velocity, and abrupt change in the second derivative. The landing point of this side of the table corresponds to the second inflection point, characterized by an angle change greater than 12 degrees, the y-coordinate starting to decrease, and the velocity increasing sharply from 0. The landing point on the opponent's table corresponds to the third inflection point, characterized by a sudden decrease in speed, a sudden change in angle variance, and the position entering the opponent's table area.
4. The method for detecting and determining compliance of table tennis serves according to claim 1, characterized in that, The compliance determination of the landing area in step S4 includes: Determine whether the landing point is located in the lower left or lower right region; Verify whether the time trajectory from the point of impact to the point of landing continuously extends towards the opponent's court area; Confirm whether the velocity in the three frames before the landing point shows a decreasing trend; When all of the above conditions are met, the landing point is deemed compliant. The compliance determination of the network access status in step S4 includes: Traverse the trajectory sequence and identify the frame where the y-coordinate first falls below the straight line of the net. The vertical distance from the center of the ping-pong ball to the net in the frame has been calculated; The vertical distance is converted into a physical distance. If the physical distance is greater than or equal to 5 mm, it is considered compliant to cross the net; otherwise, it is considered a violation to wipe the net. The body position compliance determination in step S4 includes: Determine the critical timing interval from the start of the shot to the end of the shot; Monitor the positional relationship between the x-coordinate of the human body center and the center line of the ball table during key time intervals; The body position is considered compliant when the x-coordinate of the human body center is located on the side of the server in all frames. When the x-coordinate of the human body's center in any frame exceeds the midline and the duration is greater than or equal to 2 frames, it is determined to be a violation of the body crossing the line.
5. A device for detecting and determining compliance of table tennis serves, characterized in that: include: The court marking module marks the nine set vertices of the serving area of the table, forming four rectangular areas, including the upper left, upper right, lower left, and lower right areas; it also marks the two ends of the net to form a straight line for the net. The multi-target detection module uses the YOLOv5 target detection model to perform real-time detection on the input serve scene image, identifying three types of targets: human body, racket, and ping-pong ball, and outputting the position coordinates, category, and confidence score of each target; it performs differential magnification processing on the bounding boxes of the detected targets, and filters redundant targets outside the table area based on the coordinate range calibrated by the table; The temporal modeling module constructs a temporal data input layer, including the ping-pong ball center coordinate sequence, motion state temporal features, scene-related temporal data, and filtered temporal states; Extract temporal features of velocity, direction, and event association; Based on inflection point detection, three key timing nodes are located: the serve initiation node, the landing point on the player's side of the table, and the landing point on the opponent's side of the table. The compliance judgment module, based on the key timing nodes and timing characteristics, judges the compliance of the serve from three dimensions: landing area, net crossing status, and body position, and outputs the serve analysis results.
6. The table tennis serve detection and compliance judgment device according to claim 5, characterized in that: In the site calibration module: The nine vertices include top-left vertex A, top-middle vertex B, top-right vertex C, left-middle vertex D, middle-middle vertex E, right-middle vertex F, bottom-left vertex G, bottom-middle vertex H, and bottom-right vertex I; The straight line of the net is formed by connecting the left endpoint J and the right endpoint K; Generate a scene configuration file containing the pixel coordinates of the calibration points; The differential amplification processing in the multi-target detection module specifically includes: The detection box for human targets is enlarged by 1.1 times; The detection frame of the racket target is enlarged by 1.2 times; The original detection bounding box of the ping-pong ball target is retained for trajectory calculation, while a 1.5x magnified bounding box is generated for tracking and association.
7. The table tennis serve detection and compliance judgment device according to claim 5, characterized in that: The motion state temporal features in the temporal modeling module include: first-order and second-order derivatives synchronized by frame, motion angle, and inter-frame distance; The speed temporal features include: instantaneous speed calculated based on inter-frame distance and video frame rate; and speed trend features calculated based on the sliding mean and variance of the speeds of the most recent 3 frames, used to distinguish between the serve acceleration phase and the uniform flight phase. The directional temporal features include: a directional stability index calculated based on the angular variance of five consecutive frames; and a directional trend vector fitted by the temporal variation of the average direction. The event-related timing features include: a ball-hitting timing marker, which marks the start of the ball-hitting timing point when the contact state between the ping-pong ball and the racket changes from no contact to contact, and marks the end of the ball-hitting timing point when the ping-pong ball leaves the racket's boundary frame; and an inflection point association feature, which maps inflection point indices to timing stamps to form a timing event chain of the serve start point, the landing point on the player's side of the table, and the landing point on the opponent's side of the table. The location of the key timing nodes is specifically as follows: The serve initiation node corresponds to the first inflection point, characterized by the transition from racket contact event to racket departure event, the appearance of peak velocity, and abrupt change in the second derivative. The landing point of this side of the table corresponds to the second inflection point, characterized by an angle change greater than 12 degrees, the y-coordinate starting to decrease, and the velocity increasing sharply from 0. The landing point on the opponent's table corresponds to the third inflection point, characterized by a sudden decrease in speed, a sudden change in angle variance, and the position entering the opponent's table area.
8. The table tennis serve detection and compliance judgment device according to claim 5, characterized in that: The compliance assessment of the landing area in the compliance assessment module includes: Determine whether the landing point is located in the lower left or lower right region; Verify whether the time trajectory from the point of impact to the point of landing continuously extends towards the opponent's court area; Confirm whether the velocity in the three frames before the landing point shows a decreasing trend; When all of the above conditions are met, the landing point is deemed compliant. The compliance judgment module includes the following: Traverse the trajectory sequence and identify the frame where the y-coordinate first falls below the straight line of the net. The vertical distance from the center of the ping-pong ball to the net in the frame has been calculated; The vertical distance is converted into a physical distance. If the physical distance is greater than or equal to 5 mm, it is considered compliant to cross the net; otherwise, it is considered a violation to wipe the net. The compliance assessment module includes the following: Determine the critical timing interval from the start of the shot to the end of the shot; Monitor the positional relationship between the x-coordinate of the human body center and the center line of the ball table during key time intervals; The body position is considered compliant when the x-coordinate of the human body center is located on the side of the server in all frames. When the x-coordinate of the human body's center in any frame exceeds the midline and the duration is greater than or equal to 2 frames, it is determined to be a violation of the body crossing the line.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 4.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 4.