From c78055921492d567d89e36b3d75d069f6e376927 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Wed, 3 May 2023 12:18:16 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 529161249 --- mediapipe/tasks/python/vision/__init__.py | 1 + .../tasks/python/vision/pose_landmarker.py | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/mediapipe/tasks/python/vision/__init__.py b/mediapipe/tasks/python/vision/__init__.py index 9dee86401..cea950ea7 100644 --- a/mediapipe/tasks/python/vision/__init__.py +++ b/mediapipe/tasks/python/vision/__init__.py @@ -59,6 +59,7 @@ ObjectDetectorResult = object_detector.ObjectDetectorResult PoseLandmarker = pose_landmarker.PoseLandmarker PoseLandmarkerOptions = pose_landmarker.PoseLandmarkerOptions PoseLandmarkerResult = pose_landmarker.PoseLandmarkerResult +PoseLandmarksConnections = pose_landmarker.PoseLandmarksConnections RunningMode = core.vision_task_running_mode.VisionTaskRunningMode # Remove unnecessary modules to avoid duplication in API docs. diff --git a/mediapipe/tasks/python/vision/pose_landmarker.py b/mediapipe/tasks/python/vision/pose_landmarker.py index b91eb0326..3ff7edb0a 100644 --- a/mediapipe/tasks/python/vision/pose_landmarker.py +++ b/mediapipe/tasks/python/vision/pose_landmarker.py @@ -132,6 +132,55 @@ def _build_landmarker_result( return pose_landmarker_result +class PoseLandmarksConnections: + """The connections between pose landmarks.""" + + @dataclasses.dataclass + class Connection: + """The connection class for pose landmarks.""" + + start: int + end: int + + POSE_LANDMARKS: List[Connection] = [ + Connection(0, 1), + Connection(1, 2), + Connection(2, 3), + Connection(3, 7), + Connection(0, 4), + Connection(4, 5), + Connection(5, 6), + Connection(6, 8), + Connection(9, 10), + Connection(11, 12), + Connection(11, 13), + Connection(13, 15), + Connection(15, 17), + Connection(15, 19), + Connection(15, 21), + Connection(17, 19), + Connection(12, 14), + Connection(14, 16), + Connection(16, 18), + Connection(16, 20), + Connection(16, 22), + Connection(18, 20), + Connection(11, 23), + Connection(12, 24), + Connection(23, 24), + Connection(23, 25), + Connection(24, 26), + Connection(25, 27), + Connection(26, 28), + Connection(27, 29), + Connection(28, 30), + Connection(29, 31), + Connection(30, 32), + Connection(27, 31), + Connection(28, 32) + ] + + @dataclasses.dataclass class PoseLandmarkerOptions: """Options for the pose landmarker task.