ValidPosesInputs#
- class movement.validators.datasets.ValidPosesInputs(*, position_array, confidence_array=None, individual_names=None, fps=None, source_software=None, keypoint_names=None)[source]#
Bases:
_BaseDatasetInputsClass for validating input data for a
movement posesdataset.The validator ensures that within the
movement posesdataset:The required
position_arrayis a numpy array with thespacedimension containing 2 or 3 spatial coordinates.The optional
confidence_array, if provided, is a numpy array with its shape matching that of theposition_array, excluding thespacedimension; otherwise, it defaults to an array of NaNs.The optional
individual_namesandkeypoint_names, if provided, match the number of individuals and keypoints in the dataset, respectively; otherwise, default names are assigned.The optional
fpsis a positive float; otherwise, it defaults to None.The optional
source_softwareis a string; otherwise, it defaults to None.
- position_array#
Array of shape (n_frames, n_space, n_keypoints, n_individuals) containing the poses.
- Type:
np.ndarray
- confidence_array#
Array of shape (n_frames, n_keypoints, n_individuals) containing the point-wise confidence scores. If None (default), the scores will be set to an array of NaNs.
- Type:
np.ndarray, optional
- individual_names#
List of unique names for the individuals in the video. If None (default), the individuals will be named “id_0”, “id_1”, etc.
- keypoint_names#
List of unique names for the keypoints in the skeleton. If None (default), the keypoints will be named “keypoint_0”, “keypoint_1”, etc.
- source_software#
Name of the software from which the poses were loaded. Defaults to None.
- Type:
str, optional
- Raises:
ValueError – If the dataset does not meet the
movement posesdataset requirements.
Methods
Convert validated poses inputs to a
movement posesdataset.validate(ds)Validate that the dataset has the required variables and dimensions.
- to_dataset()[source]#
Convert validated poses inputs to a
movement posesdataset.- Returns:
movementdataset containing the pose tracks, confidence scores, and associated metadata.- Return type:
- classmethod validate(ds)#
Validate that the dataset has the required variables and dimensions.
- Parameters:
ds (xarray.Dataset) – Dataset to validate.
- Raises:
TypeError – If the input is not an xarray Dataset.
ValueError – If the dataset is missing required data variables or dimensions for a valid
movementdataset.
- Return type: