scripts.body_module

Author: Jason Ho

class BodyGesture(name: str, position_checker: Callable[[scripts.core.position.Position], bool], tracker: scripts.core.position_tracker.PositionTracker)

Bases: scripts.core.gesture.Gesture

Author: Jason Ho

class BodyLandmarkDetector

Bases: scripts.core.module.LandmarkDetector

get_raw_data(raw_data: scripts.core.raw_data.RawData, image: numpy.ndarray) None

Adds the coordinates of all landmarks detected on the image into the RawData instance.

Parameters
  • raw_data (RawData) – RawData instance to add the landmarks to

  • image (np.ndarray) – Image to proccess with mediapipe and read the landmarks locations from

Author: Jason Ho

class BodyPosition(raw_body_data: Dict[str, numpy.ndarray], used_primitives: Optional[Set[str]] = None)

Bases: scripts.core.position.Position

pose_classification = None
filtered_pose_classification = None
get_primitives_names() Set[str]

Returns set of used primitives.

Returns

Set of used primitives

Return type

Set[str]

get_primitive(name: str) Optional[bool]

Returns the state of the given primitive in the Position if it has been calculated. Returns None If the primitive has not been calculated, hence either is not defined for current module or the landmarks needed to calculate it were not provided

Parameters

name (str) – name of the primitive (e.g. “up” or “arm_left”)

Returns

state of the primitive

Return type

Optional[bool]

Author: code originally from Motioninput V2, refined by Jason Ho

class EMASmoothing

Bases: object

Smoothes pose classification.

Author: code originally from Motioninput V2, refined by Jason Ho

class FullBodyPoseEmbedder

Bases: object

Converts 3D pose landmarks into 3D embeddings.

class PoseSample(name: str, landmarks: numpy.ndarray, class_name: str, embedding: numpy.ndarray)

Bases: object

Object to represent a pose sample.

class PoseClassification(used_exercises: Optional[set] = None)

Bases: object

Classifies pose landmarks.

load_samples(exercise_mode: str, pose_embedder: scripts.body_module.classification.pose_classification.FullBodyPoseEmbedder, used_exercises: str) List[scripts.body_module.classification.pose_classification.PoseSample]

Loads pose samples in the form of .csv files from the given folder.

Parameters
  • exercise_mode (str) – mode of the training model .csv files

  • pose_embedder (FullBodyPoseEmbedder) – Pose embedder object

  • used_exercises (str) – list of exercises to only load their .csv files for

Returns

List of PoseSample objects for each exercise state

Return type

List[PoseSample]

Module contents

class BodyModule

Bases: scripts.core.module.Module