Ball beating counting method and device, electronic equipment and storage medium

By using computer vision and intelligent analysis algorithms, and employing camera equipment to identify and track basketballs and human targets, the problem of low efficiency and poor accuracy in basketball dribbling counting has been solved. This has enabled automatic, real-time, and high-precision dribbling counting, while reducing hardware costs.

CN121838261APending Publication Date: 2026-04-10绍兴市北大信息技术科创中心
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
绍兴市北大信息技术科创中心
Filing Date
2025-12-24
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In existing technologies, counting the number of basketball dribbles relies on manual counting, which is inefficient and prone to errors. Using wearable devices, on the other hand, presents problems such as inconvenience and high cost. Furthermore, existing audio signal methods cannot distinguish between valid dribbles and non-training touches, resulting in inaccurate counting.

Method used

By employing computer vision and intelligent analysis algorithms, the system acquires dribbling video streams through camera equipment, identifies and tracks human and basketball targets, counts the dribbling by utilizing changes in the basketball's vertical coordinate, and combines filtering and differential calculation to achieve automatic, real-time, and high-precision dribbling counting.

Benefits of technology

It enables automatic, real-time, high-precision, and non-contact counting of basketball bounces, reducing hardware deployment costs and supporting multiple people counting simultaneously, thus improving counting efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121838261A_ABST
    Figure CN121838261A_ABST
Patent Text Reader

Abstract

The invention discloses a ball beating counting method and device, electronic equipment and a storage medium. Comprising the following steps: for each target video frame in an obtained ball shooting video stream, performing region positioning on a human body target in the target video frame and positioning human body key points to obtain all human body regions in the target video frame and human body key point positions in each human body region; performing area positioning on the basketball target in the target video frame to obtain all basketball areas in the target video frame; tracking the basketball areas in each target video frame, endowing the basketball areas belonging to the same basketball target in all the target video frames with the same identification information, and endowing the basketball areas belonging to different basketball targets with different identification information; and for each human body target, matching a basketball target for the human body target, and obtaining a ball beating counting result of the human body target based on the longitudinal coordinate change of the set point of the matched basketball target. According to the invention, automatic ball beating counting is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application generally relates to the technical field of computer vision. More particularly, the present application relates to a method and device for counting the number of times a ball is hit, an electronic device and a storage medium. BACKGROUND

[0002] Basketball is a popular sport, and is not only the core content of school sports teaching and various levels of competitions, but also an important way to improve students' physical fitness and motor coordination. As one of the basic techniques of basketball training, hitting the ball has the characteristics of high training frequency and strong motion repeatability. The number of times the ball is hit is often used to measure the training intensity, ball control proficiency and technical stability, so it is particularly important to count the number of times the ball is hit.

[0003] Currently, the counting of the number of times the ball is hit mainly relies on manual counting or counting with the help of wearable devices (such as smart bracelets, arm bands, etc.). However, manual counting is low in efficiency and is prone to missing or miscounting. Counting with the help of wearable devices has the defects of inconvenience, high cost and the need for additional maintenance and management.

[0004] Therefore, there is an urgent need to provide a method and device for counting the number of times a ball is hit, an electronic device and a storage medium, to automatically, real-time, high-precision and non-contact count the number of times a basketball is hit, with low deployment cost. SUMMARY

[0005] In order to at least solve one or more of the above-mentioned technical problems, the present application provides a method and device for counting the number of times a ball is hit, an electronic device and a storage medium in various aspects.

[0006] In a first aspect, the present application provides a method for counting the number of times a ball is hit, comprising: acquiring a ball hitting video stream, the ball hitting video stream comprising a plurality of consecutive target video frames; for each target video frame, performing region positioning on a human target in the target video frame and positioning a human key point to obtain all human regions in the target video frame and the position of the human key point in each human region; and performing region positioning on a basketball target in the target video frame to obtain all basketball regions in the target video frame; tracking the basketball regions in each target video frame, and assigning the same identification information to the basketball regions belonging to the same basketball target in all target video frames, and assigning different identification information to the basketball regions belonging to different basketball targets; for each human target, matching a basketball target for the human target, and obtaining a ball hitting count result of the human target based on the change of the longitudinal coordinate of the set point of the matched basketball target.

[0007] In some embodiments, the region positioning of the human target and the positioning of the human key points in the target video frame to obtain all human regions in the target video frame and the human key point positions in each human region, comprises: positioning the human target and the human key points in the target video frame through a trained human key point detection model to obtain all human regions in the target video frame and the human key point positions in each human region; and / or the region positioning of the basketball target in the target video frame to obtain all basketball regions in the target video frame, comprises: positioning the basketball target in the target video frame through a trained basketball detection module to obtain all basketball regions in the target video frame.

[0008] In some embodiments, the human key point detection model is a yolov8-pose model; and / or the basketball detection model is a yolov8 model.

[0009] In some embodiments, the change of the longitudinal coordinate of the set point of the matched basketball target to obtain the shot count result of the human target, comprises: differentiating the longitudinal coordinates of the set points in the continuous multiple target video frames to obtain a difference sequence including multiple difference values, each difference value corresponding to a movement state of a basketball target, the movement state of the basketball target including: falling, rebounding and rising; when an effective shot is detected in the difference sequence, a shot count is performed, and an effective shot refers to the process of the basketball target from falling to rebounding and then rising.

[0010] In some embodiments, before the differentiation of the longitudinal coordinates of the set points in the continuous multiple target video frames, the method further comprises: The longitudinal coordinates of the set points in the continuous multiple target video frames are filtered by the following formula:

[0011] wherein, represents the filtering result of the current longitudinal coordinate; represents the current longitudinal coordinate value; represents the filtering result of the previous longitudinal coordinate; is a smoothing coefficient, and .

[0012] In some embodiments, the step of performing a bounce count when a valid bounce is detected in the differential sequence includes: when a valid bounce is detected in the differential sequence, calculating the descent height of the basketball target during the bounce; performing a bounce count when the descent height of the basketball target is greater than a height threshold; and / or, when a valid bounce is detected in the differential sequence, determining the time interval from the last bounce count; and performing a bounce count when the time interval is within a set time range.

[0013] In some embodiments, the key points of the human body include: the hip joint and the heel; the height threshold is calculated by the following steps: determining a first height based on the hip joint and the heel; obtaining the descent height of the basketball target during historical dribble counts, and calculating the average descent height of the basketball target during historical dribble counts; determining the height threshold based on the first height and the average height.

[0014] In a second aspect, this application provides a ball-bouncing counting device, comprising: a ball-bouncing video stream acquisition module for acquiring a ball-bouncing video stream, the ball-bouncing video stream including a plurality of consecutive target video frames; a human body detection module for locating human body targets and key points in each target video frame to obtain all human body regions and key point positions within each human body region in the target video frame; a basketball detection module for locating basketball targets in the target video frame to obtain all basketball regions in the target video frame; a tracking module for tracking basketball regions in each target video frame and assigning the same identification information to basketball regions belonging to the same basketball target in all target video frames, and assigning different identification information to basketball regions belonging to different basketball targets; and a ball-bouncing counting module for matching a basketball target to each human body target and obtaining the ball-bouncing counting result of the human body target based on the change in the ordinate of a set point of the matched basketball target.

[0015] In a third aspect, this application provides an electronic device comprising: a processor configured to execute program instructions; and a memory configured to store the program instructions, which, when loaded and executed by the processor, cause the processor to perform a ball-counting method according to the first aspect or any optional embodiment of the first aspect.

[0016] In a fourth aspect, this application provides a computer-readable storage medium storing program instructions that, when loaded and executed by a processor, cause the processor to perform the ball-counting method according to the first aspect or any optional embodiment of the first aspect.

[0017] By using the ball-bouncing counting method, device, electronic device, and storage medium provided above, this application embodiment acquires a ball-bouncing video stream comprising multiple consecutive target video frames, and then uses computer vision and intelligent analysis algorithms to count the ball-bouncing of trainees. Specifically, it identifies human targets, key points of the human body, and basketball targets in each target video frame, then matches the human targets and basketball targets. Based on the change in the ordinate of a set point on the basketball target matched to each human target, ball-bouncing is counted for that human target. This achieves automatic, real-time, high-precision, and non-contact counting of basketball dribbling. Furthermore, by matching human targets and basketball targets, ball-bouncing of multiple trainees can be counted simultaneously, resulting in high efficiency. Moreover, this method only uses camera equipment, leading to low deployment costs. Attached Figure Description

[0018] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of this application are illustrated by way of example and not limitation, and the same or corresponding reference numerals denote the same or corresponding parts, wherein: Figure 1 An exemplary flowchart of a ball-counting method according to some embodiments of this application is shown; Figure 2 Exemplary structural block diagrams of ball-counting devices according to some embodiments of this application are shown; Figure 3 An exemplary structural block diagram of an electronic device according to some embodiments of this application is shown. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] It should be understood that the terms "comprising" and "including" used in the specification and claims of this application indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0021] It should also be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this specification and claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this specification and claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations.

[0022] As used in this specification and claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."

[0023] The specific embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0024] Exemplary application scenarios Basketball, as a widely popular sport, is not only a core component of school physical education and competitions at all levels, but also an important way to improve students' physical fitness and motor coordination. As one of the basic techniques in basketball training, dribbling is characterized by high training frequency and strong repetitiveness. The number of dribbles is often used to measure training intensity, ball control proficiency, and technical stability; therefore, the statistics of dribbling counts are particularly important.

[0025] Currently, there are three main methods for counting the number of times a ball is bounced: First, it relies on manual counting, but manual counting is inefficient and prone to omissions or miscounts.

[0026] Secondly, counting can be done using wearable devices (such as smart bracelets, armbands, etc.). However, counting using wearable devices has drawbacks such as inconvenience in wearing them, high cost, and the need for additional maintenance and management.

[0027] Third, combining audio signals and signal processing technology to achieve automatic ball counting improves the level of automation in ball counting to some extent. However, this method cannot distinguish between valid ball slaps and non-training ball touches (e.g., ball handling adjustments, passing, etc.), resulting in inaccurate ball counting results and insufficient reliability.

[0028] In view of this, there is an urgent need to provide a ball-bouncing counting method that can automatically, in real time, with high precision and non-contact counting of basketball bounces using computer vision and intelligent analysis algorithms, and with low deployment costs.

[0029] Figure 1 An exemplary flowchart of a ball-counting method 100 according to some embodiments of this application is shown. It is understood that the ball-counting method 100 described above can be executed by any suitable device with data processing capabilities, such as, but not limited to, terminal devices, processors, and servers.

[0030] like Figure 1 As shown, the above-mentioned ball-bouncing counting method 100 includes: Step S110: acquiring a ball-bouncing video stream, the ball-bouncing video stream including multiple consecutive target video frames; Step S120: for each target video frame, performing region localization and human key point localization on the human targets in the target video frame to obtain all human regions in the target video frame and the positions of human key points in each human region; and Step S130: performing region localization on the basketball targets in the target video frame to obtain all basketball regions in the target video frame; Step S140: tracking the basketball regions in each target video frame, assigning the same identification information to basketball regions belonging to the same basketball target in all target video frames, and assigning different identification information to basketball regions belonging to different basketball targets; Step S150: for each human target, matching a basketball target for the human target, and obtaining the ball-bouncing counting result of the human target based on the change of the ordinate of the set point of the matched basketball target.

[0031] For example, the ball-bouncing video stream in step S110 above refers to dynamic video data of trainees or athletes practicing ball-bouncing, collected by a camera device (e.g., a webcam). In this embodiment, the camera device is positioned above the training field at a height of 2m to 3m above the ground, and its lens is positioned opposite the face of the trainee to ensure that the ball-bouncing practice process can be captured.

[0032] In this embodiment of the application, the acquisition range of the camera device can be divided into N (e.g., 3) ball-bouncing areas, and the number of ball-bouncing practitioners in each ball-bouncing area is required to be 1. In this way, each camera device can count the ball-bouncing of multiple practitioners at the same time.

[0033] In this embodiment of the application, after the camera device acquires the ball-bouncing video stream, it can send the ball-bouncing video stream to the aforementioned device with data processing capabilities for processing.

[0034] For example, the target video frame in step S110 above is a video frame in the ball-bouncing video stream. For instance, every video frame in the ball-bouncing video stream is a target video frame (e.g., when the frame rate of the camera device is 30fps, there are 30 target video frames per second). Another example is that some video frames in the ball-bouncing video stream are target video frames (e.g., by performing frame extraction processing on the ball-bouncing video stream (e.g., extracting one frame every other frame) to obtain the target video frames). This embodiment of the application does not specifically limit this. Each target video frame includes at least one trainee and at least one basketball.

[0035] For example, the human target in step S120 above refers to a natural human individual appearing in the target video frame, and the number of such individuals is at least one. Human key points refer to the iconic anatomical locations of the human body, which may specifically include: nose, left eye, right eye, left ear, right ear, left shoulder, right shoulder, left elbow, right elbow, left wrist, right wrist, left hip joint, right hip joint, left knee, right knee, left ankle, right ankle, left toe, right toe, left heel, and right heel, totaling 21 key points.

[0036] In this embodiment, the human body region is a rectangular bounding box region containing the complete human body target, obtained through region localization. It can be represented as (x1, y1, x2, y2), where x1 represents the x-coordinate of the upper left corner of the human body region in the image coordinate system, y1 represents the y-coordinate of the upper left corner of the human body region in the image coordinate system, x2 represents the x-coordinate of the lower right corner of the human body region in the image coordinate system, and y2 represents the y-coordinate of the lower right corner of the human body region in the image coordinate system. The positions of human body key points can be the center position or centroid position of each key point, etc. This embodiment does not specifically limit this; any position that represents a human body key point is acceptable. Specifically, the position of each human body key point can be represented as (x, y), where x represents the x-coordinate of the human body key point in the image coordinate system, and y represents the y-coordinate of the human body key point in the image coordinate system.

[0037] Here, the orientation of the image coordinate system can be predefined. For example, the rightward and downward directions are the positive directions of the two coordinate axes of the image coordinate system, respectively.

[0038] In this embodiment of the application, for each target video frame, the human target in the target video frame is located in the region and the human key points are located. There are many ways to obtain all human regions in the target video frame and the positions of human key points in each human region. For example, it can be obtained through a pre-trained human key point detection model. Specifically, the target video frame is input into the above-mentioned human key point detection model, and the human key point detection model outputs all human regions in the target video frame and the positions of human key points in each human region.

[0039] The aforementioned human keypoint detection model is a neural network model trained in advance using a large number of human images; for example, it could be the YOLOv8-Pose model. The training method is described in the following examples and will not be elaborated upon here.

[0040] For example, the basketball target in step S130 above refers to the basketball appearing in the dribbling video stream, and there is at least one basketball. The basketball region refers to the rectangular bounding box region containing the complete basketball target obtained by region localization, which can be represented as (x3, y3, x4, y4), where x3 represents the x-coordinate of the upper left corner of the basketball region in the image coordinate system, y3 represents the y-coordinate of the upper left corner of the basketball region in the image coordinate system, x4 represents the x-coordinate of the lower right corner of the basketball region in the image coordinate system, and y4 represents the y-coordinate of the lower right corner of the basketball region in the image coordinate system.

[0041] In this embodiment of the application, there are many ways to locate the basketball target in the target video frame and obtain all the basketball regions in the target video frame. For example, it can be obtained through a pre-trained basketball detection module. Specifically, the target video frame is input into the basketball detection model, and the basketball detection model outputs all the basketball regions in the target video frame.

[0042] The basketball detection model described above is a neural network model trained in advance using a large number of basketball images; for example, it could be a YOLOv8 model. The training method is illustrated in the following examples and will not be elaborated upon here.

[0043] For example, the identification information in step S140 above refers to information that can uniquely identify the target. It can be implemented in many ways, such as numerical code, letter code, text, color, etc. This application embodiment does not specifically limit the identification information.

[0044] In this embodiment, tracking the basketball region in each target video frame can specifically involve associating the same basketball target in consecutive target video frames based on the basketball target's appearance features (e.g., color, texture, etc.) and motion features (e.g., speed, direction, etc.) to ensure consistency of the basketball target across frames. Specifically, tracking can be performed using common multi-target tracking (MOT) algorithms, such as Kalman filtering, Hungarian algorithm, etc. This embodiment does not specifically limit the algorithm; any algorithm that can achieve multi-target tracking is acceptable.

[0045] In this embodiment of the application, after tracking the basketball area in each target video frame, the same identification information can be assigned to the basketball area belonging to the same basketball target in all target video frames, and different identification information can be assigned to the basketball area belonging to different basketball targets.

[0046] For example, in this embodiment of the application, after assigning identification information to all basketball areas, a basketball target can be matched to each human target to establish a correspondence between human targets and basketball targets. For example, human A - basketball 1, human B - basketball 2, so as to count the number of dribbles for each practitioner. Specifically, a greedy algorithm can be used to match a basketball target to each human target with IOU (Intersection over Union) as the matching cost.

[0047] As for the specific process of matching a basketball target to each human target using a greedy algorithm, it is a conventional algorithm, which can be found in the description of relevant materials. It is not a major point of protection in this application and will not be elaborated here.

[0048] In this embodiment, after obtaining the correspondence between the human body and the basketball, a ball-bouncing counter is initialized for each correspondence, with an initial value of 0. When a valid ball bounce is detected, the ball-bouncing counter is incremented by one. Here, a valid ball bounce refers to the closed loop of the basketball target from falling to bouncing and then rising again.

[0049] For example, the setting point of the basketball target mentioned above refers to a pixel point on a predefined basketball area, such as the bottom center point of the basketball area. Of course, it can be other pixels in the basketball area, and this application embodiment does not specifically limit this, but can determine it according to the actual situation.

[0050] Based on the description of a single effective dribble, the motion state of the basketball target (i.e., descending, rebounding, and ascending) can be obtained by observing the change in the ordinate of the target's set point. Specifically, in the image coordinate system, if the ordinate of the target's set point increases, the basketball target is in a descending state; if the ordinate decreases, the basketball target is in an ascending state; and if the ordinate decreases, the basketball target is in a rebounding state. Therefore, based on this method, the dribble count results for each human target can be obtained after the exercise.

[0051] This application embodiment acquires a dribbling video stream comprising multiple consecutive target video frames, and then uses computer vision and intelligent analysis algorithms to count the dribbling of trainees. Specifically, it identifies human targets, key points on the human body, and basketball targets in each target video frame, then matches the human targets and basketball targets. Based on the change in the ordinate of a set point on the basketball target matched to each human target, it counts the dribbling of that human target, achieving automatic, real-time, high-precision, and non-contact counting of basketball dribbling. Furthermore, by matching human targets and basketball targets, it can simultaneously count the dribbling of multiple trainees, resulting in high efficiency. Moreover, this method only uses camera equipment, significantly reducing hardware deployment costs and system integration complexity. It is applicable to various scenarios such as school sports courses, youth basketball training camps, and amateur training, possessing good scalability and practical application value.

[0052] The training process of the human body keypoint detection model and the basketball detection model is described below: (1) Training data collection: Human images of trainees dribbling a ball are captured using camera equipment, and human images of multiple scenes are downloaded from a search engine using web crawlers to obtain a first image set; this first image set is used to train a human keypoint model. Basketball images were captured by camera equipment during training sessions, and basketball images from multiple scenes were downloaded from search engines via web crawlers to obtain a second image set. This second image set was used to train the basketball detection model.

[0053] (2) Data labeling: The human body regions and key points on each image in the first image set are annotated using annotation tools to obtain the first annotated image set; The basketball regions on each image in the second image set were labeled using a labeling tool to obtain the second labeled image set.

[0054] (3) Model training: The first image set and the first labeled image set are divided into a first training set, a first validation set, and a first test set in a ratio of 7:2:1, for model training, model validation, and model testing, respectively. Then, the YOLOv8-Pose model is trained using the first training set, and the performance of the model during training is verified based on the first validation set. If the performance does not meet the requirements, the model parameters are tuned to obtain a trained human keypoint detection model. The generalization performance of the trained human keypoint detection model is tested based on the first test set.

[0055] The second image set and the second labeled image set were also divided into a second training set, a second validation set, and a second test set in a 7:2:1 ratio, for model training, model validation, and model testing, respectively. The YOLOv8 model was then trained using the second training set, and the performance of the model during training was validated using the second validation set. If the performance did not meet the requirements, the model parameters were tuned to obtain a trained basketball detection model. The generalization performance of the trained basketball detection model was then tested using the second test set.

[0056] At this point, the training of the human body key point detection model and the basketball detection model is complete.

[0057] As an optional embodiment of this application, in step S150 above, obtaining the ball-bouncing count result of the human target based on the change of the ordinate of the set point of the matched basketball target includes: performing differential calculation on the ordinate of the set point in multiple consecutive target video frames to obtain a differential sequence including multiple differential values, each differential value corresponding to the motion state of a basketball target, the motion state of the basketball target including: falling, rebounding, and rising; when a valid ball-bouncing is detected in the differential sequence, a ball-bouncing count is performed, a valid ball-bouncing refers to the process of the basketball target going from falling to rising.

[0058] For example, the ordinates of the set points in the aforementioned multiple consecutive target video frames can be stored in a buffer, which can be implemented using a double-ended queue. Here, a double-ended queue refers to a queue that allows for free entry and exit from both the front and rear of the queue, supporting fast operations at both ends.

[0059] In this embodiment, the trajectory of the basketball target (i.e., the ordinate of a set point in a series of consecutive target video frames stored in the buffer) can be directly analyzed and processed to count the number of bounces. Alternatively, the trajectory of the basketball target can be filtered first to remove noise caused by continuous, high-frequency and slight jitter, and then the filtered trajectory of the basketball target can be analyzed and processed to count the number of bounces. This embodiment does not specifically limit the specific method used.

[0060] Specifically, the embodiments of this application can use exponential smoothing to filter the basketball trajectory, which can be achieved through the following formula: Formula 1 in, This indicates the filtering result for the current ordinate; Indicates the current ordinate value; This represents the filtering result of the previous vertical axis; It is a smoothing coefficient, and .

[0061] In this embodiment of the application, the analysis and processing of the basketball target trajectory (the basketball target trajectory before filtering or the basketball target trajectory after filtering) can be performed by: performing difference calculation on the ordinates of multiple consecutive set points to obtain a difference sequence including multiple difference values. Specifically, it can be calculated using the following formula: Formula 2 in, Represents the t-th ordinate; This represents the (t-1)th ordinate; This represents the difference between the t-th ordinate and the (t-1)-th ordinate.

[0062] In this embodiment of the application, each difference value can correspond to the motion state of a basketball target. Specifically, At this time, it indicates that the basketball target is in a descending state. When the basketball target is in an ascending state, it indicates that the basketball is in an ascending state. and At that time, the basketball target changes from a downward state to an upward state (i.e., a rebound state, a trough). and When the basketball target changes from an upward state to a downward state (i.e., a peak), the timestamp and pixel position of each peak and trough can be recorded.

[0063] In this embodiment of the application, based on the above definition of a valid bounce, the bounce can be detected according to the change of the difference value in the difference sequence. When a valid bounce is detected in the difference sequence (that is, the difference value is first greater than 0, then changes from greater than 0 to less than 0, and then to less than 0), a bounce count is performed to complete the final bounce count.

[0064] This application embodiment introduces a periodic determination mechanism based on motion state. By detecting the complete motion process of the basketball target from the highest point (i.e., peak value) to the lowest point (i.e., trough value) and then rising again, it can realize the counting of ball bounces for each trainee.

[0065] As an optional embodiment of this application, the trainee may hover, sway slightly, or drop halfway during the ball-bouncing process, which may lead to miscounting. Therefore, in order to ensure the accuracy of the counting results, the above situations need to be excluded.

[0066] As an optional embodiment of this application, when a valid dribble is detected in the differential sequence, a dribble count is performed, including: when a valid dribble is detected in the differential sequence, calculating the descent height of the basketball target during the dribble; when the descent height of the basketball target is greater than a height threshold, performing a dribble count; and / or, when a valid dribble is detected in the differential sequence, determining the time interval from the last dribble count; and when the time interval is within a set time range, performing a dribble count.

[0067] For example, the descent height (denoted as H) of the basketball target during this dribbling can be calculated using the distance between the recorded peak and trough values ​​(i.e., the difference in the vertical axis).

[0068] The aforementioned height threshold (denoted as T) refers to the minimum descent height required to determine whether a dribbling action is valid. If the descent height H of the basketball target during the dribbling is lower than the height threshold T, the dribbling action is invalid and no dribbling count is performed. If the descent height H of the basketball target during the dribbling is greater than the height threshold T, a dribbling count is performed. In this embodiment, the height threshold T can be a pre-set fixed value or dynamically calculated (examples are provided below), and this embodiment does not specifically limit it.

[0069] For example, the aforementioned time interval refers to the time difference between the detection of a valid bounce and the previous bounce count. For instance, it can be calculated using the timestamp of the recorded valley value and the timestamp of the valley value recorded during the previous bounce count.

[0070] The aforementioned time range can be a pre-set range (denoted as [δ1, δ2]), which can be determined by historical large-scale real ball-bouncing counts (e.g., training data). Specifically, δ1 refers to the minimum duration of a historical effective ball-bouncing, and δ2 refers to the maximum duration of a historical effective ball-bouncing.

[0071] If the time interval is within the set time range, a ball-bouncing count is performed; if the time interval exceeds the set time range, no ball-bouncing count is performed.

[0072] In this embodiment of the application, the counting statistics are performed by combining the time interval between the last ball-bouncing count and the descending height of the basketball target as dual constraints. This can effectively eliminate the miscounting caused by the incomplete ball-bouncing action and ensure that each count corresponds to a valid ball-bouncing action, thereby significantly improving the accuracy and robustness of the counting results.

[0073] As an optional embodiment of this application, the key points of the human body include: the hip joint and the heel; the height threshold is calculated by the following steps: determining a first height based on the hip joint and the heel; obtaining the descent height of the basketball target during historical ball-bouncing counts, and calculating the average descent height of the basketball target during historical ball-bouncing counts; determining the height threshold based on the first height and the average height.

[0074] For example, the aforementioned first height (denoted as The result is calculated based on the hip joint and the heel, specifically by the difference between the ordinate of the hip joint and the ordinate of the heel.

[0075] In this embodiment, the descent height of the basketball target during historical dribble counts is the descent height of the basketball target during previous dribble counts in this training (i.e., each H during previous dribble counts). After obtaining the descent height of the basketball target during historical dribble counts, the average descent height of the basketball target during historical dribble counts is calculated based on the average calculation formula (denoted as H). ).

[0076] As a specific example of this application, the descent heights of the first 5 effective ball bounces are 100, 120, 110, 130, and 120 respectively, so the average height is (100+120+110+130+120) / 5=116.

[0077] In this application embodiment, there are many methods for determining the height threshold based on the first height and the average height. For example, the first height... and average height The average value is used as the height threshold; for example, the first height is taken. With the first scaling factor (denoted as The product of (where is a constant) and the average height With the second proportionality factor (denoted as The larger value of the product of (where is a constant) is... .

[0078] This application's embodiments are based on deep learning-based multi-target detection and pose estimation technology. By calibrating the ball-dribbling area, it analyzes the motion trajectories of human targets and basketball targets in the video stream in real time, and uses an IOU greedy matching algorithm to establish the correspondence between "human targets - basketball targets". For each unique "human target - basketball target" target pair, it independently maintains a trajectory buffer and state machine. By performing exponential smoothing and first-order difference analysis on the bottom ordinate of the basketball area, combined with multiple constraints such as height and time, it accurately identifies the complete ball-dribbling cycle, achieves highly robust automatic counting, and can support multi-user parallel analysis. It is suitable for scenarios such as sports training and smart stadiums.

[0079] Figure 2 An exemplary structural block diagram of a ball-counting device according to some embodiments of this application is shown.

[0080] like Figure 2 As shown, the ball-bouncing counting device 200 includes: a ball-bouncing video stream acquisition module 210, used to acquire a ball-bouncing video stream, which includes multiple consecutive target video frames; a human body detection module 220, used to perform region localization and human body key point localization for each target video frame, obtaining all human body regions and the positions of human body key points within each human body region in the target video frame; a basketball detection module 230, used to perform region localization for basketball targets in the target video frame, obtaining all basketball regions in the target video frame; a tracking module 240, used to track basketball regions in each target video frame, assigning the same identification information to basketball regions belonging to the same basketball target in all target video frames, and assigning different identification information to basketball regions belonging to different basketball targets; and a ball-bouncing counting module 250, used to match a basketball target for each human body target, and obtain the ball-bouncing counting result of the human body target based on the change of the ordinate of the set point of the matched basketball target.

[0081] As an optional embodiment of this application, the human detection module 220 is specifically used to: locate the human target in the target video frame and locate the human key points using a pre-trained human key point detection model, thereby obtaining all human regions in the target video frame and the positions of human key points within each human region; and / or, The basketball detection module 230 is specifically used to: locate the basketball target in the target video frame using the trained basketball detection module, and obtain all basketball regions in the target video frame.

[0082] As an optional embodiment of this application, the human body key point detection model is the yolov8-pose model; and / or, the basketball detection model is the yolov8 model.

[0083] As an optional embodiment of this application, the ball-bouncing counting module 250 is specifically used to: perform differential calculation on the ordinate of a set point in multiple consecutive target video frames to obtain a differential sequence including multiple differential values, each differential value corresponding to the motion state of a basketball target, the motion state of the basketball target including: falling, rebounding, and rising; when a valid ball bounce is detected in the differential sequence, a ball-bouncing count is performed, a valid ball bounce refers to the process of the basketball target going from falling to rebounding and then rising.

[0084] As an optional embodiment of this application, the above-mentioned ball-bouncing counting device further includes: a filtering module, used to filter the ordinate of a set point in a series of consecutive target video frames using the following formula:

[0085] in, This indicates the filtering result for the current ordinate; Indicates the current ordinate value; This represents the filtering result of the previous vertical axis; It is a smoothing coefficient, and .

[0086] As an optional embodiment of this application, the ball-counting module 250 described above performs a ball-counting operation when a valid ball-counting operation is detected in the differential sequence, including: when a valid ball-counting operation is detected in the differential sequence, calculating the descent height of the basketball target during the ball-counting operation; performing a ball-counting operation when the descent height of the basketball target is greater than a height threshold; and / or, when a valid ball-counting operation is detected in the differential sequence, determining the time interval from the last ball-counting operation; and performing a ball-counting operation when the time interval is within a set time range.

[0087] As an optional embodiment of this application, the above-mentioned key human body locations include: the hip joint and the heel; the height threshold is calculated by the following steps: determining a first height based on the hip joint and the heel; obtaining the descent height of the basketball target during historical ball-bouncing counts, and calculating the average descent height of the basketball target during historical ball-bouncing counts; determining the height threshold based on the first height and the average height.

[0088] Correspondingly, embodiments of this application also provide Figure 2 The hardware structure diagram of the device shown is as follows: Figure 3 As shown, the electronic device 300 can be a device for implementing the above-described ball-counting method 100. For example... Figure 3 As shown, the electronic device 300 includes a processor 310 and a memory 320. The memory 320 is configured to store program instructions; the processor 310 is configured to load and execute the program instructions stored in the memory 320 to implement the embodiment of the ball-counting method 100 shown above.

[0089] As one embodiment, memory 320 can be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as program instructions, data, etc. For example, memory 320 can be volatile memory, non-volatile memory, or similar storage media. Specifically, memory 320 can be RAM (Random Access Memory), flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.

[0090] This concludes the process. Figure 3 Description of the electronic device shown.

[0091] While numerous embodiments of this application have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will arise for those skilled in the art without departing from the spirit and intent of this application. It should be understood that various alternatives to the embodiments of this application described herein may be employed in the practice of this application. The appended claims are intended to define the scope of protection of this application and therefore cover equivalents or alternatives within the scope of these claims.

Claims

1. A method for counting bounces, characterized in that, include: Acquire a ball-bouncing video stream, the ball-bouncing video stream comprising multiple consecutive target video frames; For each target video frame, the human target in the target video frame is located in the region and the key points of the human body are located, so as to obtain all human body regions in the target video frame and the positions of human body key points in each human body region. as well as The basketball target in the target video frame is located by region, and all basketball regions in the target video frame are obtained. The basketball region in each target video frame is tracked, and the basketball regions belonging to the same basketball target in all target video frames are assigned the same identification information, while the basketball regions belonging to different basketball targets are assigned different identification information. For each human target, a basketball target is matched to that human target, and the ball-bouncing count result of that human target is obtained based on the change of the ordinate of the set point of the matched basketball target.

2. The method according to claim 1, characterized in that, The process of locating human targets and key points in the target video frame to obtain all human regions and the locations of key points within each human region in the target video frame includes: Using a pre-trained human keypoint detection model, the human targets in the target video frame are located in regions and human keypoints are located, resulting in all human regions in the target video frame and the positions of human keypoints within each human region. And / or, The step of locating the basketball target in the target video frame to obtain all basketball regions in the target video frame includes: Using a pre-trained basketball detection module, the basketball target in the target video frame is located, and all basketball regions in the target video frame are obtained.

3. The method according to claim 2, characterized in that, The human body key point detection model is a yolov8-pose model; and / or, the basketball detection model is a yolov8 model.

4. The method according to claim 1, characterized in that, The method of obtaining the ball-bouncing count result of the human target based on the change of the ordinate of the set point of the matched basketball target includes: The ordinates of a set point in multiple consecutive target video frames are differentially calculated to obtain a differential sequence containing multiple differential values. Each differential value corresponds to the motion state of a basketball target, and the motion state of the basketball target includes: falling, rebounding, and rising. When a valid bounce is detected in the differential sequence, a bounce count is performed. A valid bounce refers to the process of the basketball target going from falling to bouncing and then rising again.

5. The method according to claim 4, characterized in that, Before performing differential calculations on the ordinates of a set point in multiple consecutive target video frames, the method further includes: The ordinate of the set point in the multiple consecutive target video frames is filtered using the following formula: in, This indicates the filtering result for the current ordinate; Indicates the current ordinate value; This represents the filtering result of the previous vertical axis; It is a smoothing coefficient, and .

6. The method according to claim 4, characterized in that, The step of performing a bounce count when a valid bounce is detected in the differential sequence includes: When a valid bounce is detected in the differential sequence, the descent height of the basketball target during this bounce is calculated; When the descent height of the basketball target is greater than a height threshold, a ball-bouncing count is performed. And / or, When a valid bounce is detected in the differential sequence, the time interval since the last bounce count is determined; When the time interval is within the set time range, a ball-bouncing count is performed.

7. The method according to claim 6, characterized in that, The key points on the human body include the hip joint and the heel; the height threshold is calculated through the following steps: The first height is determined based on the hip joint and the heel; Obtain the descent height of the basketball target during historical dribble counts, and calculate the average descent height of the basketball target during historical dribble counts; The height threshold is determined based on the first height and the average height.

8. A ball-counting device, characterized in that, include: A ball-bouncing video stream acquisition module is used to acquire a ball-bouncing video stream, which includes multiple consecutive target video frames; The human detection module is used to locate the human targets in each target video frame and locate the key points of the human body in each target video frame, so as to obtain all human body regions in the target video frame and the positions of the key points of the human body in each human body region. as well as The basketball detection module is used to locate the basketball target in the target video frame and obtain all basketball areas in the target video frame. The tracking module is used to track the basketball area in each target video frame, and assign the same identification information to basketball areas belonging to the same basketball target in all target video frames, and assign different identification information to basketball areas belonging to different basketball targets. The ball-bouncing counting module is used to match a basketball target to each human target and obtain the ball-bouncing count result of the human target based on the change of the ordinate of the set point of the matched basketball target.

9. An electronic device, characterized in that, include: A processor, configured to execute program instructions; as well as A memory configured to store the program instructions, which, when loaded and executed by the processor, cause the processor to perform the ball-counting method according to any one of claims 1-7.

10. A computer-readable storage medium storing program instructions, characterized in that, When the program instructions are loaded and executed by the processor, the processor performs the ball-counting method according to any one of claims 1-7.