DOI: 10.5061/dryad.0zpc8677f
title: TTSwing: Table Tennis Swing and racket kinematics analysis

description: We introduce TTSwing, a novel dataset designed to analyze table tennis
 swings. The dataset was collected using custom racket grips embedded with
 9-axis motion sensors, which provide precise kinematic data on swings. In
 addition, we provide anonymized demographic data for players. The dataset
 was collected from 93 participants, all of whom are elite table tennis
 players from Taiwan. TTSwing has excellent potential to facilitate
 innovative research in table tennis analysis and is a valuable resource
 for the scientific community.
description: # TTSwing: Table Tennis Swing and racket kinematics analysis Che-Yu Chou,
 Zheng-Hao Chen, Yung-Hoh Sheu, Hung-Hsuan Chen, Min-Te Sun, Sheng K. Wu
 The repository contains the TTSWING dataset, a novel dataset for table
 tennis swing analysis. It also includes the code for the pilot studies to
 demonstrate the value of our dataset. In particular, we predict user
 personal information, such as gender, age, racket-holding hand, and years
 of experience playing table tennis, based on the features derived from the
 waveforms. ## Dataset The dataset comprises comprehensive swing
 information obtained through 9-axis sensors integrated into custom-made
 racket grips, accompanied by anonymized demographic data of the players.
 The dataset contains 90,000+ collected stroke data from 93 Taiwanese
 players in Group A (the elite group). The participants included 53 males
 and 40 females; their ages ranged between 13 and 28 years old; their years
 of experience ranged between 1 to 19 years. They were asked to perform at
 least one of three different swing modes: swinging in the air, full power
 stroke, and stable hitting, denoted as mode 0 to mode 2, respectively. The
 participants swing the racket 50 times continuously in each mode to
 generate a complete waveform set, which is further transformed into
 tabular data. You can download the dataset
 [here](https://github.com/DEPhantom/TTSWING/blob/main/dataset/TTSWING.csv)
 &gt; **Note** &gt; In order to safeguard players' privacy, we
 categorized player age, height, weight, and play years into three tiers
 ("high," "medium," and "low") based on the
 current data distribution. The dataset will be continually updated in the
 presence of additional data or when the features can be released publicly.
 ### Detail of the attributes The unit of the accelerations (e.g., ax_mean,
 ay_mean, az_mean) is LSB/G (least significant bit per unit of G-force). By
 multiplying this value by 2/32768, the original G value can be obtained.
 The unit of angular velocities (e.g., gx_mean, gy_mean, gz_mean) is
 LSB/deg/s (least significant bit per unit of angular velocity). By
 multiplying this value by 250/32768, the original DPS (degree per second)
 can be obtained. | Field | Description | | ------------------ |
 ----------------------------------------------------------------------------------------------------------------------------------- | | id | An unique ID to identify players | | date | The data collected date | | testmode | Three testing modes: swing in the air, full power stroke, and stable hitting, with values 0, 1, and 2 | | teststage | This value is only useful when testmode is 1. The values 1 to 3 represent three different ball speeds served by the serving machine | | fileindex | The round that the player performs the swing | | count | The count of swings in this round | | ax\_mean | The mean of x-axis acceleration (unit: LSB/G) | | ay\_mean | The mean of y-axis acceleration (unit: LSB/G) | | az\_mean | The mean of z-axis acceleration (unit: LSB/G) | | gx\_mean | The mean of x-axis angular velocity (unit: LSB/deg/s) | | gy\_mean | The mean of y-axis angular velocity (unit: LSB/deg/s) | | gz\_mean | The mean of z-axis angular velocity (unit: LSB/deg/s) | | ax\_var | The variance of x-axis acceleration (unit: the square of LSB/G) | | ay\_var | The variance of y-axis acceleration (unit: the square of LSB/G) | | az\_var | The variance of z-axis acceleration (unit: the square of LSB/G) | | gx\_var | The variance of x-axis angular velocity (unit: the square of LSB/deg/s) | | gy\_var | The variance of y-axis angular velocity (unit: the square of LSB/deg/s) | | gz\_var | The variance of z-axis angular velocity (unit: the square of LSB/deg/s) | | ax\_rms | The root mean square of x-axis acceleration (unit: LSB/G) | | ay\_rms | The root mean square of y-axis acceleration (unit: LSB/G) | | az\_rms | The root mean square of z-axis acceleration (unit: LSB/G) | | gx\_rms | The root mean square of x-axis angular velocity (unit: LSB/deg/s) | | gy\_rms | The root mean square of y-axis angular velocity (unit: LSB/deg/s) | | gz\_rms | The root mean square of z-axis angular velocity (unit: LSB/deg/s) | | a\_max | The maximum acceleration of a swing (unit: LSB/G) | | a\_mean | The mean of acceleration of a swing (unit: LSB/G) | | a\_min | The minimum acceleration of a swing (unit: LSB/G) | | g\_max | The maximum angular velocity of a swing (unit: LSB/deg/s) | | g\_mean | The mean angular velocity of a swing (unit: LSB/deg/s) | | g\_min | The minimum angular velocity of a swing (unit: LSB/deg/s) | | a\_fft | The Fourier transform of the acceleration (unit: LSB/G) | | g\_fft | The Fourier transform of the angular velocity (unit: LSB/deg/s) | | a\_psdx | The power spectral density of the acceleration (unit: (LSB/G)^2/Hz) | | g\_psdx | The power spectral density of the angular velocity (unit: (LSB/deg/s)^2/Hz) | | a\_kurt | The kurtosis of the acceleration (no unit) | | g\_kurt | The kurtosis of the angular velocity (no unit) | | a\_skewn | The skewness of the acceleration (no unit) | | g\_skewn | The skewness of the angular velocity (no unit) | | a\_entropy | The spectral entropy of the acceleration (no unit) | | g\_entropy | The spectral entropy of the angular velocity (no unit) | | gender | The gender of the player: 1 for males and 0 for females. | | age | The age of the player: high/medium/low | | play years | Number of years players have played ball games: high/medium/low | | height | The height of the player: high/medium/low | | weight | The weight of the player: high/medium/low | | handedness | Player’s dominant hand: 1 for the right hand; 0 for the left hand | | hold racket handed | The hand holds the racket: 1 for the right hand and 0 for the left hand | ## Files * `classification_gender.py` - The experiment in predicting a player's gender. * `classification_age.py` - The experiment in predicting a player's age. * `classification_mode.py` - The experiment in predicting testmode. * `classification_holding.py` - The experiment in predicting a player's racket-holding hand. * `classification_exp_years.py` - The experiment in predicting a player's years of experience. * `general_utils.py` - Some general funcitons used in classification experiments. * `globals.py` - Global variables for recording experiment results. ## Usage To execute the code and run experiments, follow these. Install ```Shell git clone https://github.com/DEPhantom/TTSWING.git ``` Then `cd` into the root and run the command: ```Python python classification_.py ``` where `` could be `gender`, `age`, `mode`, `holding`, or `exp_years`. These scripts predict `gender`, `age`, `mode`, `holding`, or `exp_years` based on the derived features. Each script generates an Excel file to summarize the results. To compute statistical summaries of numerical and categorical features, run: ```Python python show_stat.py ``` It outputs `categorical_stat_summary.csv` and `numerical_stat_summary.csv` in the same folder. ## Requirements We tested the codes on `Python 3.10.4` (installed by `Conda`) on Mac. Package versions are available in `requirements.txt`, which is generated via `pip freeze &gt; requirements.txt`. To install these packages, runs ```sh pip install -r requirements.txt ```