AI-based intelligent table tennis serving robot
Through an AI-based intelligent table tennis serving robot, a model is established using video acquisition and deep learning, combined with reinforcement learning and transfer learning, and optimize serving movements, the problems of slow serving speed and high error rate in the existing technology are solved, and flexible and efficient serving effect is achieved.
Patent Information
- Application Number
- CN202410918611.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2044-07-10
AI Technical Summary
The existing table tennis robots have slow serving speed, high serving error rate, low serving flexibility, and small working space for parallel robots, which are only suitable for special table tennis tables.
Using an AI-based intelligent table tennis serving robot, the athlete's serving action video is collected through the camera, and the table tennis serving model is established using convolutional neural network and long-term memory network. Combined reinforcement learning and transfer learning, multi-stage training goals and reward and punishment measures are set, and the serving action is optimized.
It improves the flexibility and accuracy of the robot serving, reduces the serving error rate, can adapt to complex environments, and quickly learn the serving skills of different athletes.
Smart Images

Figure CN118876047B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of AI-based intelligent table tennis serving robots, and in particular relates to an AI-based intelligent table tennis serving robot. Background Art
[0002] A table tennis robot is an auxiliary device designed for table tennis. It can play table tennis with users. Compared with devices such as table tennis serving machines, it can enhance the fun of training, and users can improve their level by playing against the table tennis robot. For a table tennis robot, serving is a very important part.
[0003] In the prior art, the table tennis robot serves are mainly realized by the following methods:
[0004] (1) Establish a table tennis aerodynamic model and collision model to predict the trajectory of the table tennis ball; establish a racket rebound model and robot kinematic model to determine a reasonable serving strategy;
[0005] (2) Using a physical model method to predict the trajectory and manually setting the starting point based on the physical model;
[0006] (3) The parallel robot is used as the executive mechanism of the serving strategy. The target point of the ball and the height when it passes the net are manually set, and the robot kinematic model completes the serving strategy.
[0007] The above-mentioned prior art has the following technical problems:
[0008] (1) When predicting the trajectory of a table tennis ball based on physics analysis, the prediction results have large fluctuations and certain lags in the face of complex and changing real-world environments. The calculation of the hitting position of the table tennis ball by predicting the trajectory and artificially given conditions limits the table tennis robot's ability to autonomously learn to select the appropriate serving point, affecting the table tennis robot's serving performance. The robot learns to serve slowly and has a high serving error rate.
[0009] (2) Although the parallel robot has the advantage of fast response, the robot's workspace is too small, so the parallel robot can only be used in special table tennis tables, and the serving posture is not graceful. Summary of the Invention
[0010] In order to solve the problems in the above-mentioned prior art such as the slow speed of robots learning to serve, high serving error rate, and low serving flexibility, the present invention proposes an AI-based intelligent table tennis serving robot to improve the above-mentioned problems.
[0011] The specific application is as follows:
[0012] A method for implementing a table tennis serving robot based on AI, the method comprising:
[0013] S101: collecting a table tennis player's serving action, capturing the player's serving action process through a camera, and shooting a complete serving action video, wherein the complete serving action video includes the serving posture, serving tossing posture characteristics, hitting control after tossing, the motion trajectory of the table tennis ball landing on the player's half of the table after serving, the motion trajectory of the table tennis ball bouncing from the landing point on the player's half of the table over the table tennis net, and the trajectory of the table tennis ball landing on the opponent's half of the table after passing the net, and storing the shot video in a database;
[0014] S102: Preprocessing the collected video data, converting the video into images and performing segmentation to eliminate the background;
[0015] S103: Extracting features of the serving process using a convolutional neural network (CNN), including the serving posture, serving tossing posture features, hitting control after tossing, the trajectory of the ball landing on the home side of the table after serving, the trajectory of the ball bouncing from the landing point on the home side of the table across the table tennis net, and the trajectory of the ball landing on the opponent's half of the table after crossing the net;
[0016] S104: Modeling the extracted serving process features using a long short-term memory (LSTM) artificial neural network and a support vector machine (SVM) classifier to establish a dual LSTM model for table tennis serving. The dual LSTM model is divided into LSTM-A and LSTM-B. LSTM-A is used for training before the table tennis ball contacts the table tennis racket, and LSTM-B is used for training after the table tennis ball leaves the table tennis racket. The output of LSTM-A training is used as input for LSTM-B, and training is continued.
[0017] S105: Inputting the table tennis serving model into the serving robot for serving training, wherein the serving training adopts reinforcement learning and transfer learning, and the transfer learning is mainly used for serving posture planning;
[0018] S106: Setting a first-stage training goal and a first-stage learning task reward and penalty to perform reinforcement learning of serve training, thereby obtaining a first serve reinforcement training model, wherein the first serve reinforcement training model is to ensure that the serving racket contacts the ball, and the penalty is determined based on the deviation loss between the first-stage training goal and the first-stage learning task;
[0019] S107: Setting a second-stage training goal and a second-stage learning task reward and penalty to perform reinforcement learning for serving training, thereby obtaining a second serving reinforcement training model. The second serving reinforcement training model is configured to ensure that the serve leaves the racket and forms a landing trajectory on the own half of the table. The penalty is determined based on the deviation loss between the second-stage training goal and the second-stage learning task.
[0020] S108: Setting a training goal for the third stage and a reward and penalty for the learning task for the third stage to perform reinforcement learning for serving training, thereby obtaining a third serving reinforcement training model, wherein the third serving reinforcement training model is a trajectory of a table tennis ball that bounces from a landing point on the own half of the table over the table tennis net, and the penalty is determined based on a deviation loss between the training goal for the third stage and the learning task for the third stage;
[0021] S109: Setting a fourth-stage training goal and a fourth-stage learning task reward and penalty to perform reinforcement learning for serving training, thereby obtaining a fourth serving reinforcement training model. The fourth serving reinforcement training model is a trajectory of the table tennis ball landing on the opponent's half of the table after passing the net. The penalty is determined based on the deviation loss between the fourth-stage training goal and the fourth-stage learning task.
[0022] S110: After four stages of intensive training, the output results are obtained and the robot's serve training is evaluated to assess whether the robot has learned to serve the table tennis ball and the learning effect. If the robot has not learned to serve, the robot continues to perform the four-stage learning task until it learns to serve.
[0023] Furthermore, the pre-processing of the collected video data, converting the video into an image and performing segmentation, and removing the background specifically includes the following steps:
[0024] S21: Read a complete serving action video data from the database;
[0025] S22: converting the video data into an image sequence and performing analysis and processing on each frame of the image;
[0026] S23: Using a background subtraction algorithm to remove the background part of the image, the characteristics of the player's serve and the trajectory of the table tennis ball are further highlighted;
[0027] S24: The image after background removal is further processed to extract the player's serve feature information and the table tennis ball's trajectory feature information and store them in a new data set Km.
[0028] Furthermore, the extraction of features of the serving process by a convolutional neural network (CNN), including the serving posture, the tossing posture features, the hitting control after the toss, the trajectory of the table tennis ball landing on one's own half of the table after the serve, the trajectory of the table tennis ball bouncing from the landing point on one's own half of the table over the table tennis net, and the trajectory of the table tennis ball landing on the opponent's half of the table after crossing the net, specifically includes the following steps:
[0029] S31: extracting image data from the data set Km for preprocessing, using image smoothing, noise removal, and binarization operations to process the image data in Km, enhancing image quality, and using a convolutional neural network (CNN) to extract features;
[0030] S32: obtaining serving speed information by calculating the displacement between adjacent frames according to the movement trajectory of the player serving the ball in the image;
[0031] S33: Analyze the continuous changes of image frames during the athlete's serve, and extract the postural features of the serve, the tossing posture features of the serve, and the hitting control after the toss using the YOLOv8 algorithm;
[0032] S34: Analyzing the motion trajectory of the table tennis ball and employing contour tracking image processing technology to identify and track the motion trajectory of the table tennis ball, thereby extracting motion trajectory features, wherein the motion trajectory features include the motion trajectory of the table tennis ball landing point on the player's half of the table after serving, the motion trajectory of the table tennis ball bouncing from the landing point on the player's half of the table over the table tennis net, and the motion trajectory of the table tennis ball landing point on the opponent's half of the table after crossing the net;
[0033] S35: Integrate and encode the extracted features of the serving posture, the serving tossing posture, the hitting control after tossing, the trajectory of the table tennis ball landing on the own half of the table after serving, the trajectory of the table tennis ball bouncing from the landing point on the own half of the table over the table tennis net, and the trajectory of the table tennis ball landing on the opponent's half of the table after passing the net. The encoded data is stored in a new data set Kn, part of which is used as training set data, and the other part is used as test set data.
[0034] The ball hitting control after throwing the ball specifically includes ball hitting timing control, ball rotation control and ball speed control.
[0035] Furthermore, the LSTM-A is used for training before the table tennis ball contacts the table tennis racket, and the LSTM-B is used for training after the table tennis ball leaves the table tennis racket. The output result of the LSTM-A training is used as the input of the LSTM-B. The specific implementation is as follows:
[0036] M1: The LSTM-A is a two-layer model. The first layer is used to train the posture features of the serve, and the second layer is used to train the toss posture features of the serve and the hitting control after the toss.
[0037] M2: The LSTM-B is a single-layer model used for training the first, second, third, and fourth stage learning tasks.
[0038] M3: The output result of the LSTM unit in the first layer of LSTM-A is the body posture of the serve, which is used as the input of the second layer of LSTM-A. The serve action is performed in combination with the tossing posture characteristics of the serve;
[0039] The transfer learning is mainly used for posture planning of serving. The specific steps are:
[0040] A1: Build the first-layer LSTM-A model to describe the robot's posture when serving a ping-pong ball.
[0041] A2: Acquire and process the player's serving posture data and the target's posture data;
[0042] A3: Use the posture recognition algorithm GaitSet to extract features from the robot's serving posture data and the athlete's serving posture data;
[0043] A4: Use deep reinforcement learning and transfer learning to learn the characteristics of the athlete's serving posture and then plan the robot's serving posture;
[0044] The step A1 specifically includes the following steps:
[0045] A11: Build a 4-link robot model with knee-shaped curved legs. The robot model consists of two thighs, two shanks, and two curved legs. The legs are connected by steel rods through hinges, and the curved legs are fixed to the shanks. Two motors are installed at the knee joints to apply control torque to support the shanks and swing the thighs.
[0046] A12: Analyze the process from when the robot picks up the racket to when it throws the ball and then collides with the racket.
[0047] The A3 step specifically includes the following steps:
[0048] A31: The process from when the athlete and robot pick up the racket to when they throw the ball until the ball collides with the racket is defined as a posture cycle.
[0049] A32: Using the robot model as a reference, take the 2D plane horizontal to the athlete's posture, and from left to right, define the athlete's posture state as A1. Use A1 to represent all the data in the athlete's posture process description, and use A1 as a row vector to combine and obtain the athlete's posture data A1.
[0050] A33: Select a posture cycle from the athlete's posture data A1 as the robot's learning object, extract the odd frames in the learning object data to form a new data set, and define it as the target posture data A2, where any row vector in the target posture data A2 is extracted from A1;
[0051] A34: Sample the robot's posture state A2 in the posture cycle according to the sampling frequency in A1 to form the robot's posture data A3;
[0052] In step A4, the deep deterministic policy gradient algorithm (PPO) is selected as the robot's learning algorithm. During the continuous serving process, the robot collects data of different body postures and provides them to the deep deterministic policy gradient algorithm for training. At the same time, serving training is performed through transfer learning, and ultimately the deep deterministic policy gradient algorithm has the ability to control the robot to complete the serve.
[0053] Furthermore, the extracted serving process features are modeled using a long short-term memory artificial neural network (LSTM) model and an SVM classifier to establish a table tennis serving model, specifically comprising the following steps:
[0054] S41: extracting feature vector data from the data set Kn;
[0055] S42: After completing the preprocessing of the data, the preprocessed data is processed using a dual LSTM model to obtain multiple serialized feature vectors, a cross entropy loss function is used to calculate the multiple serialized feature vectors to obtain a loss value of the dual LSTM model, and the dual LSTM model is trained using a stochastic gradient descent algorithm, using the training set data for training to obtain a trained dual LSTM model;
[0056] S43: Update the SVM classifier according to the trained dual LSTM model to obtain a new SVM classifier. Based on the obtained trained dual LSTM model and the new SVM classifier, a trained table tennis serve model is constructed. The SVM represents a support vector machine, and the output classification feature matrix is Among them, M i Indicates the number of times of serving training, i=1,2...n,N j represents the jth learning task in a training session, where the learning tasks include the learning tasks of the first stage, the learning tasks of the second stage, the learning tasks of the third stage, and the learning tasks of the fourth stage.
[0057] Furthermore, the training goal of the first stage is to make the serving racket contact the ball;
[0058] By completing the training objectives of the first stage and the rewards and penalties of the learning tasks of the first stage, reinforcement learning of serve training is carried out to obtain the first serve reinforcement training model;
[0059] Reinforcement learning of serve training is performed based on the first serve reinforcement training model, the second stage training objectives, and the learning task rewards and penalties, to obtain a second serve reinforcement training model, wherein the second stage training objective is to ensure that the serve leaves the racket and forms a landing trajectory on the own half of the table;
[0060] Reinforcement learning of serve training is performed based on the second serve reinforcement training model, the training objectives of the third stage, and the learning task rewards and penalties, to obtain a third serve reinforcement training model, wherein the training objective of the third stage is to make the trajectory of the table tennis ball bounce from the landing point on the player's half of the table over the table tennis net;
[0061] Based on the third serve reinforcement training model, the training objectives of the fourth stage, and the learning task rewards and penalties, reinforcement learning of serve training is performed to obtain the fourth serve reinforcement training model. The training objective of the fourth stage is to make the trajectory of the table tennis ball landing on the opponent's half of the table after passing the net.
[0062] Furthermore, the classification feature matrix outputted in step S43 is Calculate the rewards and penalties for each stage of learning tasks and the deviation loss of each stage of learning tasks;
[0063] The deviation loss is calculated as:
[0064]
[0065] in, represents the goal of the learning task at stage j, The degree of completion of the learning task at stage j is represented by the coefficients k0, k1, k2, k3 and the boundaries of the value range m1, m2 satisfying the following constraints:
[0066]
[0067] The reward weight function of the learning task at each stage is:
[0068] reward j =α*reward all +(1-α)*reward i,j ,
[0069] Among them, reward all Represents the global stage weight, a complete table tennis serve process, reward i,,j Represents the local stage weight, which is the j-th stage learning task in the i-th serve process. The reward weight of the learning task in each stage is composed of the weighted sum of the local stage weight and the global stage weight. The coefficient α determines the importance of the global stage and the local stage in this calculation. The calculation function of the global stage weight is:
[0070]
[0071] The process i,j represents the j-th stage learning task value during the i-th serve process, represents the target value of the j-th stage learning task during the i-th serve process, k is the scaling coefficient, the coefficient γ determines the range of the function, and i represents the number of serve trainings, starting from 1;
[0072] The calculation function of the local stage weight is:
[0073]
[0074] The rewards for the first stage of learning tasks are:
[0075] A*reward1,
[0076] The rewards for the second stage of learning tasks are:
[0077] B*reward2,
[0078] The learning task rewards for the third stage are:
[0079] C*reward3,
[0080] The learning task rewards for the fourth stage are:
[0081] D*reward4,
[0082] Where A, B, C, and D represent the base value of the learning task reward in the first stage, the base value of the learning task reward in the second stage, the base value of the learning task reward in the third stage, and the base value of the learning task reward in the fourth stage respectively;
[0083] The reward value of the robot for one table tennis training is:
[0084] W i =A*reward1+B*reward2+C*reward3+D*reward4.
[0085] Furthermore, the penalty function of the learning task at each stage is:
[0086]
[0087] Among them, j represents the number of serving training, Q is the average loss value of the deviation of one serving training, Y is the threshold, qq is the penalty value,
[0088]
[0089] Each penalty is processed according to the average loss value of the deviation of the previous serve training. If Q is greater than the threshold Y, a penalty measure is taken.
[0090] Furthermore, the specific process of evaluating whether the robot has learned to serve a table tennis ball is as follows:
[0091] The classification feature matrix outputted in step S43 is: Evaluate whether the robot has learned to serve a ping-pong ball. The evaluation is divided into three levels: not learned, learned, and excellent.
[0092] The learning level, for the classification feature matrix is Serve N times in a row, completing all four stages of learning tasks each time;
[0093] The excellent level, for the classification feature matrix is Serve N times in a row, complete all 4 stages of learning tasks each time, and the reward value of each training is greater than the threshold Q;
[0094] The unlearned level, for the classification feature matrix is Serve N times in a row, and at least one of the four stages of learning tasks is not completed each time.
[0095] The serving implementation system 20 of the intelligent table tennis serving robot based on AI comprises:
[0096] An acquisition module 201 is used to capture the player's serving action process through a camera and extract key features of the serving process using an image recognition algorithm;
[0097] Deep learning module 202, which is used to train feature extractors for various table tennis tasks using deep learning methods in a simulation environment, establish a table tennis serving model through transfer learning of the robot's serving posture combined with deep learning, and generate a classification matrix for the tasks;
[0098] The reinforcement learning module 203 is used to apply the four-stage learning tasks to reinforcement learning. By setting learning goals for the learning tasks and setting corresponding rewards and punishments, the output results are obtained through reinforcement learning of serving training at the target points. The output results include the joint parameters of each joint of the robot, and the joint parameters include joint positions and joint velocities. The output results are used to control the robot to serve.
[0099] The storage medium is characterized in that an executable program is stored therein, and the executable program is executed by a controller to implement the serving method of the AI-based intelligent table tennis serving robot according to any one of claims 1 to 8.
[0100] The beneficial effects of the AI-based intelligent table tennis serving robot of the present invention are as follows:
[0101] The present invention collects the serving action process of the athlete through a camera, and uses an image recognition algorithm to extract features of the serving process, including body posture, serving racket posture, serving racket speed, the motion trajectory of the table tennis ball landing point on the own half of the table after the serve, the motion trajectory of the table tennis ball from the landing point on the own half of the table over the table tennis net, and the trajectory of the table tennis ball landing point on the opponent's half of the table after passing the net. A table tennis serving model is established based on the extracted serving process features through a long short-term memory artificial neural network LSTM and an SVM classifier, and a serving learning matrix for the classification task is generated. The table tennis serving model is input into a serving robot for reinforcement learning. Rewards and penalties are implemented by setting training goals and learning tasks for each stage. The reward function is a balanced reward measure based on the local weights of the learning tasks at different stages of a complete serving task and the global stage weights. The penalty function is processed based on the deviation average loss value of a training session. Penalize those serves that result in high deviation losses. Through these reward and penalty measures, the robot can complete the contact between the serving racket and the ball, the ball facing its own half of the table and successfully landing, the ball successfully bouncing over the table tennis net after landing on its own half of the table, and the table tennis ball landing on the opponent's half of the table as quickly as possible. The serve learning matrix is used to evaluate the effect of the robot's serve training, and further achieve the goal of completing the robot's serve training. By establishing a robot posture model, the athlete's serve posture data and target posture data are obtained and processed. The posture recognition algorithm GaitSet is used to extract features from the robot's serve posture data and the athlete's serve posture data respectively. Deep reinforcement learning and transfer learning are used to learn the athlete's serve posture features, and then the robot's serve posture is planned. The serve posture can coordinate the robot to learn to play table tennis faster and complete learning tasks at different stages. This invention combines deep learning, reinforcement learning, and transfer learning, which can significantly reduce the number of interactions between the robot and the real environment and improve the robot's serving flexibility. By setting a local and global balanced reward function and a penalty measure for high deviation loss, it ensures that the robot quickly learns the serving task and learns the complex serving skills of different athletes, reducing the serving error rate. By establishing a robot posture model, the serving action can be better optimized and the robot can learn to serve faster. BRIEF DESCRIPTION OF THE DRAWINGS
[0102] Figure 1 Schematic diagram of the flow of a method for implementing a serving method of an AI-based intelligent table tennis serving robot according to the present invention;
[0103] Figure 2 Schematic diagram of the serving system of the AI-based intelligent table tennis serving robot of the present invention;
[0104] Figure 3 This is a schematic diagram of the process of preprocessing the collected video data according to the present invention;
[0105] Figure 4Schematic diagram of the process of extracting features of the serving process by using a convolutional neural network (CNN) in the present invention;
[0106] Figure 5 The figure is a flow chart of the body posture for serving a ball according to the present invention.
[0107] Among them, 20-AI-based intelligent table tennis serving robot serving implementation system, 201-acquisition module, 202-deep learning module, 203-reinforcement learning module. DETAILED DESCRIPTION
[0108] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0109] Example 1
[0110] First, the technical terms involved in the embodiments of the present application are explained.
[0111] (1) LSTM model
[0112] LSTM (Long Short-Term Memory) is a special type of recurrent neural network (RNN) designed to address the vanishing and exploding gradient problems encountered by traditional RNNs when processing long sequences of data. LSTM uses gating mechanisms to control the flow of information, enabling it to learn long-term dependencies. LSTM models are widely used in natural language processing (NLP), speech recognition, time series analysis, and many other fields.
[0113] (2) Convolutional Neural Network
[0114] Convolutional Neural Network (CNN) is a deep learning model that has performed well in image and video recognition, recommendation systems, natural language processing, and other fields. CNN's design mimics the working principle of the human visual system. Through layer-by-layer abstraction, it can automatically learn useful feature representations from raw data. This ability makes CNN particularly effective when processing data with a strong spatial hierarchical structure.
[0115] (3) Reinforcement Learning
[0116] Reinforcement learning (RL) is an important branch of machine learning. It mainly studies how an intelligent agent can discover behavioral strategies that maximize cumulative rewards in a specific environment through trial and error without explicit instructions. RL has applications in many fields, including games, robotics, self-driving cars, resource management, and recommendation systems.
[0117] (4) Transfer Learning
[0118] Transfer learning is a technique in the field of machine learning that allows the knowledge gained by a model trained on one task to be applied to another different but related task. This method is particularly suitable for new tasks with less data because the model trained on a large dataset can be used as a starting point, thereby reducing the dependence on large amounts of labeled data.
[0119] Figure 1 The figure is a flow chart of a serving method of an AI-based intelligent table tennis serving robot according to the present invention.
[0120] The method comprises the following steps S101-S110:
[0121] S101: collecting a table tennis player's serving action, capturing the player's serving action process through a camera, and shooting a complete serving action video, wherein the complete serving action video includes the serving posture, serving tossing posture characteristics, hitting control after tossing, the motion trajectory of the table tennis ball landing on the player's half of the table after serving, the motion trajectory of the table tennis ball bouncing from the landing point on the player's half of the table over the table tennis net, and the trajectory of the table tennis ball landing on the opponent's half of the table after passing the net, and storing the shot video in a database;
[0122] S102: Preprocessing the collected video data, converting the video into images and performing segmentation to eliminate the background;
[0123] S103: Extracting features of the serving process using a convolutional neural network (CNN), including the serving posture, serving racket posture, serving toss posture features, ball control after tossing, the trajectory of the ball landing on the home side of the table after serving, the trajectory of the ball bouncing from the landing point on the home side of the table across the table tennis net, and the trajectory of the ball landing on the opponent's half of the table after crossing the net;
[0124] S104: Modeling the extracted serving process features using a long short-term memory (LSTM) artificial neural network and a support vector machine (SVM) classifier to establish a dual LSTM model for table tennis serving. The dual LSTM model is divided into LSTM-A and LSTM-B. LSTM-A is used for training before the table tennis ball contacts the table tennis racket, and LSTM-B is used for training after the table tennis ball leaves the table tennis racket. The output of LSTM-A training is used as input for LSTM-B, and training is continued.
[0125] S105: Inputting the table tennis serving model into the serving robot for serving training, wherein the serving training adopts reinforcement learning and transfer learning, and the transfer learning is mainly used for posture planning of serving;
[0126] S106: Setting a first-stage training goal and a first-stage learning task reward and penalty to perform reinforcement learning of serve training, thereby obtaining a first serve reinforcement training model, wherein the first serve reinforcement training model is to ensure that the serving racket contacts the ball, and the penalty is determined based on the deviation loss between the first-stage training goal and the first-stage learning task;
[0127] S107: Setting a second-stage training goal and a second-stage learning task reward and penalty to perform reinforcement learning for serving training, thereby obtaining a second serving reinforcement training model. The second serving reinforcement training model is configured to ensure that the serve leaves the racket and forms a landing trajectory on the own half of the table. The penalty is determined based on the deviation loss between the second-stage training goal and the second-stage learning task.
[0128] S108: Setting a training goal for the third stage and a reward and penalty for the learning task for the third stage to perform reinforcement learning for serving training, thereby obtaining a third serving reinforcement training model, wherein the third serving reinforcement training model is a trajectory of a table tennis ball that bounces from a landing point on the own half of the table over the table tennis net, and the penalty is determined based on a deviation loss between the training goal for the third stage and the learning task for the third stage;
[0129] S109: Setting a fourth-stage training goal and a fourth-stage learning task reward and penalty to perform reinforcement learning for serving training, thereby obtaining a fourth serving reinforcement training model. The fourth serving reinforcement training model is a trajectory of the table tennis ball landing on the opponent's half of the table after passing the net. The penalty is determined based on the deviation loss between the fourth-stage training goal and the fourth-stage learning task.
[0130] S110: After four stages of intensive training, the output results are obtained and the robot's serve training is evaluated to assess whether the robot has learned to serve the table tennis ball and the learning effect. If the robot has not learned to serve, the robot continues to perform the four-stage learning task until it learns to serve.
[0131] Example 2, this example is based on the above example, please refer to Figure 3The pre-processing of the collected video data, converting the video into an image and performing segmentation, and eliminating the background specifically include the following steps:
[0132] S21: Read a complete serving action video data from the database;
[0133] S22: converting the video data into an image sequence and performing analysis and processing on each frame of the image;
[0134] S23: Using a background subtraction algorithm to remove the background part of the image, the characteristics of the player's serve and the trajectory of the table tennis ball are further highlighted;
[0135] S24: The image after background removal is further processed to extract the player's serve feature information and the table tennis ball's trajectory feature information and store them in a new data set Km.
[0136] Example 3, this example is based on the above example, please refer to Figure 4 The process of extracting features of the serving process using a convolutional neural network (CNN), including the serving posture, the tossing posture features, the hitting control after the toss, the trajectory of the table tennis ball landing on one's own half of the table after the serve, the trajectory of the table tennis ball bouncing from the landing point on one's own half of the table over the table tennis net, and the trajectory of the table tennis ball landing on the opponent's half of the table after crossing the net, specifically includes the following steps:
[0137] S31: extracting image data from the data set Km for preprocessing, using image smoothing, noise removal, and binarization operations to process the image data in Km, enhancing image quality, and using a convolutional neural network (CNN) to extract features;
[0138] S32: obtaining serving speed information by calculating the displacement between adjacent frames according to the movement trajectory of the player serving the ball in the image;
[0139] S33: Analyze the continuous changes of image frames during the athlete's serve, and extract the postural features of the serve, the tossing posture features of the serve, and the hitting control after the toss using the YOLOv8 algorithm;
[0140] S34: Analyzing the motion trajectory of the table tennis ball and employing contour tracking image processing technology to identify and track the motion trajectory of the table tennis ball, thereby extracting motion trajectory features, wherein the motion trajectory features include the motion trajectory of the table tennis ball landing point on the player's half of the table after serving, the motion trajectory of the table tennis ball bouncing from the landing point on the player's half of the table over the table tennis net, and the motion trajectory of the table tennis ball landing point on the opponent's half of the table after crossing the net;
[0141] S35: Integrate and encode the extracted features of the serving posture, the serving tossing posture, the hitting control after tossing, the trajectory of the table tennis ball landing on the own half of the table after serving, the trajectory of the table tennis ball bouncing from the landing point on the own half of the table over the table tennis net, and the trajectory of the table tennis ball landing on the opponent's half of the table after passing the net. The encoded data is stored in a new data set Kn, part of which is used as training set data, and the other part is used as test set data.
[0142] The ball hitting control after throwing the ball specifically includes ball hitting timing control, ball rotation control and ball speed control.
[0143] 5. Example 4. This example is based on the above example. LSTM-A is used for training before the table tennis ball contacts the table tennis racket, and LSTM-B is used for training after the table tennis ball leaves the table tennis racket. The output of LSTM-A training is used as the input of LSTM-B. The specific implementation is as follows:
[0144] M1: The LSTM-A is a two-layer model. The first layer is used to train the posture features of the serve, and the second layer is used to train the toss posture features of the serve and the hitting control after the toss.
[0145] M2: The LSTM-B is a single-layer model used for training the first, second, third, and fourth stage learning tasks.
[0146] M3: The output result of the LSTM unit in the first layer of LSTM-A is the body posture of the serve, which is used as the input of the second layer of LSTM-A. The serve action is performed in combination with the tossing posture characteristics of the serve;
[0147] The extracted serving process features are modeled using a long short-term memory artificial neural network (LSTM) model and an SVM classifier to establish a table tennis serving model, specifically comprising the following steps:
[0148] S41: extracting feature vector data from the data set Kn;
[0149] S42: After completing the preprocessing of the data, the preprocessed data is processed using an LSTM model to obtain multiple serialized feature vectors, a cross-entropy loss function is used to calculate the multiple serialized feature vectors to obtain a loss value of the LSTM model, and a stochastic gradient descent algorithm is used to train the dual LSTM model using the training set data to obtain a trained dual LSTM model;
[0150] S43: Update the SVM classifier according to the trained dual LSTM model to obtain a new SVM classifier. Based on the obtained trained dual LSTM model and the new SVM classifier, a trained table tennis serve model is constructed. The SVM represents a support vector machine, and the output classification feature matrix is Among them, M i Indicates the number of times of serving training, i=1,2...n,N j represents the jth learning task in a training session, where the learning tasks include the learning tasks of the first stage, the learning tasks of the second stage, the learning tasks of the third stage, and the learning tasks of the fourth stage.
[0151] Example 5: This example is based on the above example, and the training goal of the first stage is to make the serving racket contact the ball;
[0152] By completing the training objectives of the first phase and the rewards and penalties of the learning tasks of the first phase, reinforcement learning of serve training is carried out to obtain the first serve reinforcement training model;
[0153] Reinforcement learning of serve training is performed based on the first serve reinforcement training model, the second stage training objectives, and the learning task rewards and penalties, to obtain a second serve reinforcement training model, wherein the second stage training objective is to ensure that the serve leaves the racket and forms a landing trajectory on the own half of the table;
[0154] Reinforcement learning of serve training is performed based on the second serve reinforcement training model, the training objectives of the third stage, and the learning task rewards and penalties, to obtain a third serve reinforcement training model, wherein the training objective of the third stage is to make the trajectory of the table tennis ball bounce from the landing point on the player's half of the table over the table tennis net;
[0155] Based on the third serve reinforcement training model, the training objectives of the fourth stage, and the learning task rewards and penalties, reinforcement learning of serve training is performed to obtain the fourth serve reinforcement training model. The training objective of the fourth stage is to make the trajectory of the table tennis ball landing on the opponent's half of the table after passing the net.
[0156] Example 6, based on the above example, the classification feature matrix outputted in step S43 is: Calculate the rewards and penalties for each stage of learning tasks and the deviation loss of each stage of learning tasks;
[0157] The deviation loss is calculated as:
[0158]
[0159] in, represents the goal of the learning task at stage j, The degree of completion of the learning task at stage j is represented by the coefficients k0, k1, k2, k3 and the boundaries of the value range m1, m2 satisfying the following constraints:
[0160]
[0161] The reward weight function of the learning task at each stage is:
[0162] reward j =α*reward all +(1-α)*reward i,j ,
[0163] Among them, reward all Represents the global stage weight, a complete table tennis serve process, reward i,,j Represents the local stage weight, which is the j-th stage learning task in the i-th serve process. The reward weight of the learning task in each stage is composed of the weighted sum of the local stage weight and the global stage weight. The coefficient α determines the importance of the global stage and the local stage in this calculation. The calculation function of the global stage weight is:
[0164]
[0165] The process i,j represents the j-th stage learning task value during the i-th serve process, represents the target value of the j-th stage learning task during the i-th serve process, k is the scaling coefficient, the coefficient γ determines the range of the function, and i represents the number of serve trainings, starting from 1;
[0166] The calculation function of the local stage weight is:
[0167]
[0168] The rewards for the first stage of learning tasks are:
[0169] A*reward1,
[0170] The rewards for the second stage of learning tasks are:
[0171] B*reward2,
[0172] The learning task rewards for the third stage are:
[0173] C*reward3,
[0174] The learning task rewards for the fourth stage are:
[0175] D*reward4,
[0176] Where A, B, C, and D represent the base value of the learning task reward in the first stage, the base value of the learning task reward in the second stage, the base value of the learning task reward in the third stage, and the base value of the learning task reward in the fourth stage respectively;
[0177] The reward value of the robot for one table tennis training is:
[0178] W i =A*reward1+B*reward2+C*reward3+D*reward4.
[0179] Furthermore, the penalty function of the learning task at each stage is:
[0180]
[0181] Among them, i represents the number of serving training, Q is the average loss value of the deviation of one serving training, Y is the threshold, qq is the penalty value,
[0182]
[0183] Each penalty is processed according to the average loss value of the deviation of the previous serve training. If Q is greater than the threshold, penalty measures are taken.
[0184] Furthermore, the specific process of evaluating whether the robot has learned to serve a table tennis ball is as follows:
[0185] The classification feature matrix outputted in step S43 is: Evaluate whether the robot has learned to serve a ping-pong ball. The evaluation is divided into three levels: not learned, learned, and excellent.
[0186] The learning level, for the classification feature matrix is The robot has learned to serve after serving 100 times in a row and completing all four stages of learning tasks each time.
[0187] The excellent level, for the classification feature matrix is 100 consecutive serves, each time completing all 4 stages of learning tasks, and the reward value of each training is greater than the threshold of 100;
[0188] There is no learning level, and the classification feature matrix is Serve the ball 100 times in a row, with at least one of the 4 stages of learning tasks not completed each time.
[0189] Example 7, this example is based on the above example, as Figure 5 ,
[0190] Transfer learning is mainly used for posture planning of serving. The specific steps are:
[0191] A1: Build the first-layer LSTM-A model to describe the robot's posture when serving a ping-pong ball.
[0192] A2: Acquire and process the player's serving posture data and the target's posture data;
[0193] A3: Use the posture recognition algorithm GaitSet to extract features from the robot's serving posture data and the athlete's serving posture data;
[0194] A4: Use deep reinforcement learning and transfer learning to learn the characteristics of the athlete's serving posture and then plan the robot's serving posture;
[0195] The step A1 specifically includes the following steps:
[0196] A11: Build a 4-link robot model with knee-shaped curved legs. The robot model consists of two thighs, two shanks, and two curved legs. The legs are connected by steel rods through hinges, and the curved legs are fixed to the shanks. Two motors are installed at the knee joints to apply control torque to support the shanks and swing the thighs.
[0197] A12: Analyze the process from when the robot picks up the racket to when it throws the ball and then collides with the racket.
[0198] The A3 step specifically includes the following steps:
[0199] A31: The process from when the athlete and robot pick up the racket to when they throw the ball until the ball collides with the racket is defined as a posture cycle.
[0200] A32: Using the robot model as a reference, take the 2D plane horizontal to the athlete's posture, and from left to right, define the athlete's posture state as A1. Use A1 to represent all the data in the athlete's posture process description, and use A1 as a row vector to combine and obtain the athlete's posture data A1.
[0201] A33: Select a posture cycle from the athlete's posture data A1 as the robot's learning object, extract the odd frames in the learning object data to form a new data set, and define it as the target posture data A2, where any row vector in the target posture data A2 is the extracted A1;
[0202] A34: Sample the robot's posture state A2 in the posture cycle according to the sampling frequency in A1 to form the robot's posture data A3;
[0203] In step A4, the deep deterministic policy gradient algorithm (PPO) is selected as the robot's learning algorithm. During the continuous serving process, the robot collects data of different body postures and provides them to the deep deterministic policy gradient algorithm for training. At the same time, through transfer learning, the deep deterministic policy gradient algorithm is finally able to control the robot to reach and complete the serve.
[0204] Example 8, based on the above embodiment, is an AI-based intelligent table tennis serving robot serving implementation system 20, which includes:
[0205] An acquisition module 201 is used to capture the player's serving action process through a camera and extract key features of the serving process using an image recognition algorithm;
[0206] Deep learning module 202, which is used to train feature extractors for various table tennis tasks using deep learning methods in a simulation environment, establish a table tennis serving model through transfer learning of the robot's serving posture combined with deep learning, and generate a classification matrix for the tasks;
[0207] The reinforcement learning module 203 is used to apply the four-stage learning tasks to reinforcement learning. By setting learning goals for the learning tasks and setting corresponding rewards and punishments, the output results are obtained through reinforcement learning of serving training at the target points. The output results include the joint parameters of each joint of the robot, and the joint parameters include joint position and joint speed.
[0208] The beneficial effects of the AI-based intelligent table tennis serving robot of the present invention are as follows:
[0209] The present invention uses a camera to capture the serving action process of an athlete, and uses an image recognition algorithm to extract features of the serving process, including body posture, serving racket posture, serving racket speed, the motion trajectory of the table tennis ball landing point on one's own half of the table after serving, the motion trajectory of the table tennis ball bouncing from the landing point on one's own half of the table over the table tennis net, and the trajectory of the table tennis ball landing point on the opponent's half of the table after passing the net. A table tennis serving model is established based on the extracted serving process features using a long short-term memory artificial neural network (LSTM) and an SVM classifier, and a serving learning matrix for the classification task is generated. The table tennis serving model is input into a serving robot for reinforcement learning. Rewards and penalties are implemented by setting training goals and learning tasks for each stage. The reward function is a balanced reward measure based on the local weights of the learning tasks at different stages of a complete serving task and the global stage weights. The penalty function is processed based on the deviation average loss value of a training session. Penalize those serves that result in high deviation losses. Through these reward and penalty measures, the robot can complete the contact between the serving racket and the ball, the ball facing its own half of the table and successfully landing, the ball successfully bouncing over the table tennis net after landing on its own half of the table, and the table tennis ball landing on the opponent's half of the table as quickly as possible. The serve learning matrix is used to evaluate the effect of the robot's serve training, and further achieve the goal of completing the robot's serve training. By establishing a robot posture model, the athlete's serve posture data and target posture data are obtained and processed. The posture recognition algorithm GaitSet is used to extract features from the robot's serve posture data and the athlete's serve posture data respectively. Deep reinforcement learning and transfer learning are used to learn the athlete's serve posture features, and then the robot's serve posture is planned. The serve posture can coordinate the robot to learn to play table tennis faster and complete learning tasks at different stages. The present invention combines deep learning, reinforcement learning and transfer learning, which can significantly reduce the number of interactions between the robot and the real environment and improve the robot's serving flexibility. By setting a local and global balanced reward function and a penalty measure for high deviation loss, the robot can quickly learn the serving task and learn the complex serving skills of different athletes, reducing the serving error rate. By establishing a robot posture model, the posture of the serving robot is better combined with the serving task, the serving action is better optimized, and the robot learns to serve faster.
[0210] The present invention and its embodiments are described above. This description is not restrictive. What is shown in the accompanying drawings is only one of the embodiments of the present invention, and the actual content is not limited to this. In short, if ordinary technicians in this field are inspired by it and do not depart from the purpose of the invention, they can creatively design structural methods and embodiments similar to the technical solution, which should all fall within the scope of protection of the present invention.
Claims
1. A serving method for an AI-based intelligent table tennis serving robot, characterized in that: The method comprises: S101: collecting a table tennis player's serving action, capturing the player's serving action process through a camera, and shooting a complete serving action video, wherein the complete serving action video includes the serving posture, serving tossing posture characteristics, hitting control after tossing, the motion trajectory of the table tennis ball landing on the player's half of the table after serving, the motion trajectory of the table tennis ball bouncing from the landing point on the player's half of the table over the table tennis net, and the trajectory of the table tennis ball landing on the opponent's half of the table after passing the net, and storing the shot video in a database; S102: Preprocessing the collected video data, converting the video into images and performing segmentation to eliminate the background; S103: Extracting features of the serving process using a convolutional neural network (CNN), including the serving posture, serving racket posture, tossing posture features, ball control after tossing, the trajectory of the ball landing on the home side of the table after serving, the trajectory of the ball bouncing from the landing point on the home side of the table across the table tennis net, and the trajectory of the ball landing on the opponent's half of the table after crossing the net; S104: Modeling the extracted serving process features using a long short-term memory (LSTM) artificial neural network and a support vector machine (SVM) classifier to establish a dual LSTM model for table tennis serving. The dual LSTM model is divided into LSTM-A and LSTM-B. LSTM-A is used for training before the table tennis ball contacts the table tennis racket, and LSTM-B is used for training after the table tennis ball leaves the table tennis racket. The output of LSTM-A training is used as input for LSTM-B, and training is continued. S105: Inputting the dual LSTM model into the serving robot for serving training, wherein the serving training adopts reinforcement learning and transfer learning, and the transfer learning is used for posture planning of serving; S106: Setting a first-stage training goal and a first-stage learning task reward and penalty to perform reinforcement learning of serve training, thereby obtaining a first serve reinforcement training model, wherein the first serve reinforcement training model is configured to ensure contact between the serving racket and the ball, and the first-stage learning task reward and penalty are determined based on a deviation loss between the first-stage training goal and the first-stage learning task; S107: Setting a second-stage training goal and a second-stage learning task reward and penalty to perform reinforcement learning of serve training, thereby obtaining a second serve reinforcement training model. The second serve reinforcement training model is configured to ensure that the serve leaves the racket and forms a landing trajectory on the own half of the table. The second-stage learning task reward and penalty are determined based on the deviation loss between the second-stage training goal and the second-stage learning task. S108: Setting a training goal for the third stage and a learning task reward and penalty for the third stage to perform reinforcement learning for serving training, thereby obtaining a third serving reinforcement training model. The third serving reinforcement training model is a trajectory of a table tennis ball that bounces from a landing point on the own half of the table over the table tennis net. The learning task reward and penalty for the third stage are determined based on a deviation loss between the training goal for the third stage and the learning task for the third stage. S109: Setting a fourth-stage training goal and a fourth-stage learning task reward and penalty to perform reinforcement learning of serve training, obtaining a fourth serve reinforcement training model, wherein the fourth serve reinforcement training model is a trajectory of the table tennis ball landing on the opponent's half of the table after passing the net, and the fourth-stage learning task reward and penalty are determined based on the deviation loss between the fourth-stage training goal and the fourth-stage learning task; S110: After four stages of intensive training, the output results are obtained, and the robot's serve training is evaluated to assess whether the robot has learned to serve the table tennis ball and the learning effect. If the robot has not learned to serve, the robot continues to perform the four-stage learning task until it learns to serve.
2. The serving method of the AI-based intelligent table tennis serving robot according to claim 1, characterized in that: The preprocessing of the collected video data, converting the video into an image and performing segmentation, and removing the background specifically include the following steps: S21: Read a complete serving action video data from the database; S22: converting the video data into an image sequence and performing analysis and processing on each frame of the image; S23: Using a background subtraction algorithm to remove the background part of the image, the characteristics of the player's serve and the trajectory of the table tennis ball are further highlighted; S24: The image after background removal is further processed to extract the player's serve feature information and the table tennis ball's trajectory feature information and store them in a new data set Km.
3. The serving method of the AI-based intelligent table tennis serving robot according to claim 2, characterized in that: The extraction of features of the serving process by a convolutional neural network (CNN), including the serving posture, the tossing posture features, the hitting control after the toss, the trajectory of the table tennis ball landing on one's own half of the table after the serve, the trajectory of the table tennis ball bouncing from the landing point on one's own half of the table over the table tennis net, and the trajectory of the table tennis ball landing on the opponent's half of the table after crossing the net, specifically includes the following steps: S31: extracting image data from the data set Km for preprocessing, using image smoothing, noise removal, and binarization operations to process the image data in Km, enhancing image quality, and using a convolutional neural network (CNN) to extract features; S32: obtaining serving speed information by calculating the displacement between adjacent frames according to the movement trajectory of the player serving the ball in the image; S33: Analyze the continuous changes of image frames during the athlete's serve, and extract the postural features of the serve, the tossing posture features of the serve, and the hitting control after the toss using the YOLOv8 algorithm; S34: Analyzing the motion trajectory of the table tennis ball and employing contour tracking image processing technology to identify and track the motion trajectory of the table tennis ball, thereby extracting motion trajectory features, wherein the motion trajectory features include the motion trajectory of the table tennis ball landing point on the player's half of the table after serving, the motion trajectory of the table tennis ball bouncing from the landing point on the player's half of the table over the table tennis net, and the motion trajectory of the table tennis ball landing point on the opponent's half of the table after crossing the net; S35: Integrate and encode the extracted posture features of the serve, the tossing posture features of the serve, the hitting control after tossing the ball, the motion trajectory of the table tennis ball landing point on the own half of the table after serving, the motion trajectory of the table tennis ball bouncing from the landing point on the own half of the table over the table tennis net, and the trajectory features of the table tennis ball landing point on the opponent's half of the table after passing the net. The encoded data is stored in a new data set Kn, part of which is used as training set data and the other part is used as test set data The ball hitting control after throwing the ball specifically includes ball hitting timing control, ball rotation control and ball speed control.
4. The serving method of the AI-based intelligent table tennis serving robot according to claim 3, characterized in that: The LSTM-A is used for training before the ping-pong ball contacts the ping-pong racket, and the LSTM-B is used for training after the ping-pong ball leaves the ping-pong racket. The output of the LSTM-A training is used as the input of the LSTM-B. M1: The LSTM-A is a two-layer model. The first layer is used to train the posture features of the serve, and the second layer is used to train the toss posture features of the serve and the hitting control after the toss. M2: The LSTM-B is a single-layer model used for training the first, second, third, and fourth stage learning tasks. M3: The output result of the LSTM unit in the first layer of LSTM-A is the body posture of the serve, which is used as the input of the second layer of LSTM-A. The serve action is performed in combination with the tossing posture characteristics of the serve; The specific steps of the transfer learning for posture planning of serving are as follows: A1: Build a robot posture model in the first layer of LSTM-A to describe the robot's posture process when serving a ping-pong ball. A2: Acquire and process the player's serving posture data and the target's posture data; A3: Use the posture recognition algorithm GaitSet to extract features from the robot's serving posture data and the athlete's serving posture data; A4: Use deep reinforcement learning and transfer learning to learn the characteristics of the athlete's serving posture and then plan the robot's serving posture; The step A1 specifically includes the following steps: A11: Build a 4-link robot model with knee-shaped curved legs. The robot model consists of two thighs, two shanks, and two curved legs. The legs are connected by steel rods through hinges, and the curved legs are fixed to the shanks. Two motors are installed at the knee joints to apply control torque to support the shanks and swing the thighs. A12: Analyze the process from when the robot picks up the racket to when it throws the ball and then collides with the racket. The A3 step specifically includes the following steps: A31: The process from when the athlete and robot pick up the racket to when they throw the ball until the ball collides with the racket is defined as a posture cycle. A32: Using the robot model as a reference, take the 2D plane horizontal to the athlete's posture, and from left to right, define the athlete's posture state as A1. Use A1 to represent all the data in the athlete's posture process description, and use A1 as a row vector to combine and obtain the athlete's posture data A1. A33: Select a posture cycle from the athlete's posture data A1 as the robot's learning object, extract the odd frames in the learning object data to form a new data set, and define it as the target posture data A2, where any row vector in the target posture data A2 is extracted from A1; A34: Sample the robot's posture state A2 in the posture cycle according to the sampling frequency in A1 to form the robot's posture data A3; In step A4, the deep deterministic policy gradient algorithm (PPO) is selected as the robot's learning algorithm. During the continuous serving process, the robot collects data of different body postures and provides them to the deep deterministic policy gradient algorithm for training. At the same time, serving training is performed through transfer learning, and ultimately the deep deterministic policy gradient algorithm has the ability to control the robot to complete the serve.
5. The serving method of the AI-based intelligent table tennis serving robot according to claim 4, characterized in that: The extracted serving process features are modeled using a long short-term memory artificial neural network (LSTM) model and an SVM classifier to establish a table tennis serving model, specifically comprising the following steps: S41: extracting feature vector data from the data set Kn; S42: After completing the preprocessing of the data, the preprocessed data is processed using a dual LSTM model to obtain multiple serialized feature vectors, a cross entropy loss function is used to calculate the multiple serialized feature vectors to obtain a loss value of the dual LSTM model, and the dual LSTM model is trained using a stochastic gradient descent algorithm, using the training set data for training to obtain a trained dual LSTM model; S43: Update the SVM classifier according to the trained dual LSTM model to obtain a new SVM classifier. Based on the obtained trained dual LSTM model and the new SVM classifier, a trained table tennis serve model is constructed. The SVM represents a support vector machine, and the output classification feature matrix is Among them, M i Indicates the number of times of serving training, i=1,2...n,N j represents the jth learning task in a training session, where the learning tasks include the learning tasks of the first stage, the learning tasks of the second stage, the learning tasks of the third stage, and the learning tasks of the fourth stage.
6. The serving method of the AI-based intelligent table tennis serving robot according to claim 5, characterized in that: The training goal of the first phase is to make the serving racket contact the ball; By completing the training objectives of the first phase and the rewards and penalties of the learning tasks of the first phase, reinforcement learning of serve training is performed to obtain a first serve reinforcement training model; Reinforcement learning of serve training is performed based on the first serve reinforcement training model, the training objectives of the second stage, and the rewards and penalties of the learning tasks of the second stage, thereby obtaining a second serve reinforcement training model, wherein the training objective of the second stage is to ensure that the serve leaves the racket and forms a landing trajectory on the own half of the table; Reinforcement learning of serve training is performed based on the second serve reinforcement training model, the training goal of the third stage, and the rewards and penalties of the learning tasks of the third stage, to obtain a third serve reinforcement training model, wherein the training goal of the third stage is to make the trajectory of the table tennis ball bounce from the landing point on the player's half of the table over the table tennis net; Based on the third serve reinforcement training model, the training goal of the fourth stage and the learning task rewards and penalties of the fourth stage, reinforcement learning of serve training is performed to obtain the fourth serve reinforcement training model. The training goal of the fourth stage is to make the trajectory of the table tennis ball landing on the opponent's half of the table after passing the net.
7. The serving method of the AI-based intelligent table tennis serving robot according to claim 6, characterized in that: The classification feature matrix outputted in step S43 is: Calculate the rewards and penalties for each stage of learning tasks and the deviation loss of each stage of learning tasks; The deviation loss is calculated as: in, represents the goal of the learning task at stage j, The degree of completion of the learning task at stage j is represented by the coefficients k0, k1, k2, k3 and the boundaries of the value range m1, m2 satisfying the following constraints: The reward weight function of the learning task at each stage is: reward j =α*reward all +(1-α)*reward i,j , Among them, reward all Represents the global stage weight, a complete table tennis serve process, reward i,,j Represents the local stage weight, which is the j-th stage learning task in the i-th serve process. The reward weight of the learning task in each stage is composed of the weighted sum of the local stage weight and the global stage weight. The coefficient α determines the importance of the global stage and the local stage in this calculation. The calculation function of the global stage weight is: The process i,j represents the j-th stage learning task value during the i-th serve process, represents the target value of the j-th stage learning task during the i-th serve process, k is the scaling coefficient, the coefficient γ determines the range of the function, and i represents the number of serve trainings, starting from 1; The calculation function of the local stage weight is: The reward and penalty for the learning task in the first stage are: A*reward1, The reward and penalty for the learning task in the second stage are: B*reward2, The reward and penalty for the learning task in the third stage are: C*reward3, The reward and penalty for the learning task in the fourth stage are: D*reward4, Where A, B, C, and D represent the base value of the learning task reward in the first stage, the base value of the learning task reward in the second stage, the base value of the learning task reward in the third stage, and the base value of the learning task reward in the fourth stage respectively; The reward value of the robot for one table tennis training is: W i =A*reward1+B*reward2+C*reward3+D*reward4。 8. The serving method of the AI-based intelligent table tennis serving robot according to claim 7, characterized in that: The penalty function of the learning task at each stage is: Among them, i represents the number of serving training, Q is the average loss value of the deviation of one serving training, Y is the threshold, qq is the penalty value, Among them, loss1 is the deviation loss value of the first stage learning task, loss2 is the deviation loss value of the second stage learning task, loss3 is the deviation loss value of the third stage learning task, and loss4 is the deviation loss value of the fourth stage learning task. Each penalty is processed according to the average deviation loss value of the previous serve training. If Q is greater than the threshold Y, a penalty is imposed.
9. The serving method of the AI-based intelligent table tennis serving robot according to claim 8, characterized in that: The specific process of evaluating whether the robot has learned to serve a ping-pong ball is as follows: The classification feature matrix outputted in step S43 is: Evaluate whether the robot has learned to serve a ping-pong ball. The evaluation is divided into three levels: not learned, learned, and excellent. The learning level, for the classification feature matrix is Serve N times in a row, completing all four stages of learning tasks each time; The excellent level, for the classification feature matrix is Serve N times in a row, complete all 4 stages of learning tasks each time, and the reward value of each training is greater than the threshold; The unlearned level, for the classification feature matrix is Serve N times in a row, and at least one of the four stages of learning tasks is not completed each time.
10. An AI-based intelligent table tennis serving robot serving implementation system, configured to be implemented by the AI-based intelligent table tennis serving robot serving implementation method according to any one of claims 1 to 9, characterized in that: It includes: An acquisition module (201) is used to collect the player's serving action process through a camera and extract key features of the serving process using an image recognition algorithm; A deep learning module (202) is used to train feature extractors for each table tennis task using a deep learning method in a simulation environment, establish a table tennis serving model by combining transfer learning of the robot's serving posture with deep learning, and generate a classification matrix for the task; The reinforcement learning module (203) is used to apply the four-stage learning tasks to reinforcement learning, formulate learning goals for the learning tasks, and set corresponding rewards and punishments, and obtain output results through reinforcement learning of serving training at the target point. The output results include joint parameters of each joint of the robot, and the joint parameters include joint positions and joint speeds. The output results are used to control the robot to serve.
Citation Information
Patent Citations
Batting method and device for table tennis robot
CN110711368A
End-to-end robot reinforcement learning ball hitting strategy implementation method based on stage rewards
CN115946137A