## Dataset Overview This dataset contains sequences of MediaPipe pose landmarks for several padel strokes. ### Classes - Forehand - filename: forehand (i).pkl - Backhand - filename: backhand (i).pkl - Forehand Volley - filename: fhvolley (i).pkl - Backhand Volley - filename: bhvolley (i).pkl - Bandeja - filename: bandeja (i).pkl - Smash - filename: smash (i).pkl ### File Contents Each `.pkl` file contains the `PoseLandmarkerResult` returned by `detect_for_video` from MediaPipe. #### `PoseLandmarkerResult` Structure - **Landmarks**: - `Landmark #0`: - `x`: 0.638852 - `y`: 0.671197 - `z`: 0.129959 - `visibility`: 0.9999997615814209 - `presence`: 0.9999984502792358 - `Landmark #1`: - `x`: 0.634599 - `y`: 0.536441 - `z`: -0.06984 - `visibility`: 0.999909 - `presence`: 0.999958 - ... (33 landmarks per pose) - **WorldLandmarks**: - `Landmark #0`: - `x`: 0.067485 - `y`: 0.031084 - `z`: 0.055223 - `visibility`: 0.9999997615814209 - `presence`: 0.9999984502792358 - `Landmark #1`: - `x`: 0.063209 - `y`: -0.00382 - `z`: 0.020920 - `visibility`: 0.999976 - `presence`: 0.999998 - ... (33 world landmarks per pose) More information on its format can be found [here](https://ai.google.dev/edge/mediapipe/solutions/vision/pose_landmarker/python). ## Loading Data ### Loading `PoseLandmarkerResult` To load a `PoseLandmarkerResult` from a `.pkl` file, use the following code: ```python import joblib detection_results = joblib.load(pkl_filepath) ``` ### Loading the Complete Dataset To load the dataset into arrays `X`, `Y`, `Z`, and `labels`, use the sample code below. Make sure to point `folderpath` to the directory containing the dataset files. ```python import os import joblib def build_coordinates_dataset(folderpath): all_files = os.listdir(folderpath) pkl_filepaths = [os.path.join(folderpath, pkl_filepath) for pkl_filepath in all_files if pkl_filepath.endswith(".pkl")] print(f'{len(pkl_filepaths)} samples found') X, Y, Z, labels = [], [], [], [] for pkl_filepath in pkl_filepaths: detection_results = joblib.load(pkl_filepath) try: loaded_pose_landmarks = detection_results x_frames, y_frames, z_frames = [], [], [] for frame_detection_result in loaded_pose_landmarks: landmarks = frame_detection_result.pose_world_landmarks[0] x_landmarks, y_landmarks, z_landmarks = [], [], [] for i in landmarks: x_landmarks.append(i.x) y_landmarks.append(i.y) z_landmarks.append(i.z) x_frames.append(x_landmarks) y_frames.append(y_landmarks) z_frames.append(z_landmarks) X.append(x_frames) Y.append(y_frames) Z.append(z_frames) labels.append(os.path.basename(pkl_filepath)[:3]) except Exception as e: print(e) print(f"Error loading {pkl_filepath}") return X, Y, Z, labels ``` To load the dataset into arrays X, Y, Z, and labels, use the sample code below. Make sure to point folderpath to the directory containing the dataset files.