--- license: gpl-3.0 task_categories: - tabular-classification - tabular-regression - image-to-3d - depth-estimation pretty_name: AD Trajectories size_categories: - 100K ## Size 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 --- # Folder Structure & Metadata 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: Base Stroke (Hit Type): The top-level folder defines the stroke. There are 7 options: groundstroke, lob, serve, short, smash, toss, or volley. 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. Status (In/Out): The third tier indicates whether the ball's first bounce landed validly inside the court (in) or outside the lines (out). Trajectory ID: The final folder contains the isolated data for a single shot, numbered sequentially (e.g., trajectory_0000, trajectory_0001, ...). Example Path: groundstroke/close_to_far/in/trajectory_0000/ --- # Data Structures per Trajectory Inside each trajectory_xxxx folder, you will find exactly seven .npy files. These numpy arrays store the spatial, temporal, and camera data for that specific sequence: positions.npy: The 3D position of the ball (x, y, z) throughout the trajectory, recorded at a resolution of 0.002s. velocities.npy: The linear velocity of the ball relative to the world coordinate system, recorded at a resolution of 0.002s. rotations.npy: The angular velocity (spin) of the ball in all 3 directions, recorded at a resolution of 0.002s. times.npy: A 1D array containing the corresponding timestamps for the positions, velocities, and rotations arrays. bounces.npy: Includes the exact timestamps of the bounces occurring during the trajectory, where t=0 represents the start of the trajectory. Mint.npy: The intrinsic camera matrix. Mext.npy: The extrinsic camera matrix. The position and velocity is defined in relation to the 3D world coordinate system, which is defined like follows: Coordinate system definition of 3D world coordinates The ball spin (rotations.npy) is defined in relation to the ball's local coordinate system. The direction of which is defined as follows: Definition of the ball's local coordinate system 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. --- # Download the Dataset 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. Python ``` from huggingface_hub import hf_hub_download ``` ``` REPO_ID = "XSpaceCoderX/AD-Trajectories" FILENAME = "data.tar" print(f"Downloading {FILENAME}...") local_path = hf_hub_download( repo_id=REPO_ID, filename=FILENAME, repo_type="dataset" ) print(f"File downloaded to: {local_path}") ``` ## Unpack the Dataset Once downloaded, you can extract the contents using Python's built-in tarfile module or a system command. Option A: Using Python (Cross-platform) This is the recommended way to ensure compatibility across Windows, macOS, and Linux. ``` import tarfile import os def extract_tar(file_path, extract_path="."): print(f"Extracting {file_path}...") with tarfile.open(file_path, "r") as tar: tar.extractall(path=extract_path) print("Extraction complete!") ``` Note: Make sure you have at least 35-40GB of free disk space (17GB for the archive + ~20GB for the extracted contents).