Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -20,14 +20,23 @@ The AD-Trajectories dataset is a large-scale synthetic dataset generated using t
|
|
| 20 |
|
| 21 |
---
|
| 22 |
## Dataset Overview
|
|
|
|
| 23 |
The dataset comprises exactly 187,200 individual synthetic tennis trajectories. All physical kinematics, including the 3D positions, linear velocities, and angular velocities (spin), are captured at a high resolution of 500 frames per second (fps), corresponding to a time step of 0.002 seconds.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
---
|
|
|
|
| 26 |
# Folder Structure & Metadata
|
| 27 |
Unlike datasets that use a separate JSON or CSV file for labels, the metadata for each trajectory is encoded directly into its folder path. The repository utilizes a four-tier nested folder structure categorized by the specific properties of the shot:
|
| 28 |
|
| 29 |
Base Stroke (Hit Type): The top-level folder defines the stroke. There are 7 options: groundstroke, lob, serve, short, smash, toss, or volley.
|
| 30 |
-
Direction of Flight: The second tier defines the trajectory's direction, organized into close_to_far and far_to_close subfolders. Close_to_far means that the ball is flying in the negative x-axis direction. Far_to_close means the ball flies in the positce x-axis direction.
|
| 31 |
Status (In/Out): The third tier indicates whether the ball's first bounce landed validly inside the court (in) or outside the lines (out).
|
| 32 |
Trajectory ID: The final folder contains the isolated data for a single shot, numbered sequentially (e.g., trajectory_0000, trajectory_0001, ...).
|
| 33 |
|
|
@@ -46,9 +55,55 @@ Inside each trajectory_xxxx folder, you will find exactly seven .npy files. Thes
|
|
| 46 |
Mext.npy: The extrinsic camera matrix.
|
| 47 |
|
| 48 |
The position and velocity is defined in relation to the 3D world coordinate system, which is defined like follows:
|
| 49 |
-
<img src="./
|
| 50 |
|
| 51 |
The ball spin (rotations.npy) is defined in relation to the ball's local coordinate system. The direction of which is defined as follows:
|
| 52 |
-
<img src="./
|
| 53 |
|
| 54 |
Note on 2D Image Projections: To save space and reduce redundancy, this dataset does not include pre-calculated 2D image projections (u,v). Because both the intrinsic (Mint) and extrinsic (Mext) camera matrices are provided for every trajectory, users can easily calculate the 2D image projections themselves by multiplying the 3D world coordinates by the provided camera matrices.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
---
|
| 22 |
## Dataset Overview
|
| 23 |
+
|
| 24 |
The dataset comprises exactly 187,200 individual synthetic tennis trajectories. All physical kinematics, including the 3D positions, linear velocities, and angular velocities (spin), are captured at a high resolution of 500 frames per second (fps), corresponding to a time step of 0.002 seconds.
|
| 25 |
+
The trajectories do not only comprise of the 3D trajectory information (position, velocity, ...) but also include camera parameters that define a camera's intrinsic and extrinsic camera matrix. The camera is always placed behind the baseline on the positive x-axis (see image).
|
| 26 |
+
|
| 27 |
+
<img src="./camera_and court_origin.png" alt="Camera position in realtion to the world coordinate frame" style="width:50%; height:auto;" >
|
| 28 |
+
|
| 29 |
+
## Size
|
| 30 |
+
|
| 31 |
+
The dataset is saved as a .tar file becuase it compromises out of 187,200 individual folders. The tar file has a size of 17 GB. The unpacked dataset has a size of approx. 20 GB
|
| 32 |
|
| 33 |
---
|
| 34 |
+
|
| 35 |
# Folder Structure & Metadata
|
| 36 |
Unlike datasets that use a separate JSON or CSV file for labels, the metadata for each trajectory is encoded directly into its folder path. The repository utilizes a four-tier nested folder structure categorized by the specific properties of the shot:
|
| 37 |
|
| 38 |
Base Stroke (Hit Type): The top-level folder defines the stroke. There are 7 options: groundstroke, lob, serve, short, smash, toss, or volley.
|
| 39 |
+
Direction of Flight: The second tier defines the trajectory's direction in raltion to the camera's position, organized into close_to_far and far_to_close subfolders. Close_to_far means that the ball is flying in the negative x-axis direction. Far_to_close means the ball flies in the positce x-axis direction.
|
| 40 |
Status (In/Out): The third tier indicates whether the ball's first bounce landed validly inside the court (in) or outside the lines (out).
|
| 41 |
Trajectory ID: The final folder contains the isolated data for a single shot, numbered sequentially (e.g., trajectory_0000, trajectory_0001, ...).
|
| 42 |
|
|
|
|
| 55 |
Mext.npy: The extrinsic camera matrix.
|
| 56 |
|
| 57 |
The position and velocity is defined in relation to the 3D world coordinate system, which is defined like follows:
|
| 58 |
+
<img src="./3d_coordinate_system_in_field.png" alt="Coordinate system definition of 3D world coordinates" style="width:50%; height:auto;" >
|
| 59 |
|
| 60 |
The ball spin (rotations.npy) is defined in relation to the ball's local coordinate system. The direction of which is defined as follows:
|
| 61 |
+
<img src="./Screenshot 2026-04-20 194926.png" alt="Definition of the ball's local coordinate system" >
|
| 62 |
|
| 63 |
Note on 2D Image Projections: To save space and reduce redundancy, this dataset does not include pre-calculated 2D image projections (u,v). Because both the intrinsic (Mint) and extrinsic (Mext) camera matrices are provided for every trajectory, users can easily calculate the 2D image projections themselves by multiplying the 3D world coordinates by the provided camera matrices.
|
| 64 |
+
|
| 65 |
+
---
|
| 66 |
+
|
| 67 |
+
# Download the Dataset
|
| 68 |
+
|
| 69 |
+
You can download the specific tar file using the hf_hub_download function. This is more efficient than cloning the entire repository if you only need the archive.
|
| 70 |
+
Python
|
| 71 |
+
|
| 72 |
+
```
|
| 73 |
+
from huggingface_hub import hf_hub_download
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
```
|
| 77 |
+
REPO_ID = "XSpaceCoderX/AD-Trajectories"
|
| 78 |
+
FILENAME = "data.tar"
|
| 79 |
+
|
| 80 |
+
print(f"Downloading {FILENAME}...")
|
| 81 |
+
|
| 82 |
+
local_path = hf_hub_download(
|
| 83 |
+
repo_id=REPO_ID,
|
| 84 |
+
filename=FILENAME,
|
| 85 |
+
repo_type="dataset"
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
print(f"File downloaded to: {local_path}")
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
## Unpack the Dataset
|
| 92 |
+
|
| 93 |
+
Once downloaded, you can extract the contents using Python's built-in tarfile module or a system command.
|
| 94 |
+
Option A: Using Python (Cross-platform)
|
| 95 |
+
|
| 96 |
+
This is the recommended way to ensure compatibility across Windows, macOS, and Linux.
|
| 97 |
+
|
| 98 |
+
```
|
| 99 |
+
import tarfile
|
| 100 |
+
import os
|
| 101 |
+
|
| 102 |
+
def extract_tar(file_path, extract_path="."):
|
| 103 |
+
print(f"Extracting {file_path}...")
|
| 104 |
+
with tarfile.open(file_path, "r") as tar:
|
| 105 |
+
tar.extractall(path=extract_path)
|
| 106 |
+
print("Extraction complete!")
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
Note: Make sure you have at least 35-40GB of free disk space (17GB for the archive + ~20GB for the extracted contents).
|