From 5456e4019413735ff49699265b14d765dc9304fc Mon Sep 17 00:00:00 2001 From: LareinaM Date: Wed, 20 Sep 2023 13:35:46 +0800 Subject: [PATCH 1/2] fix codec --- mmpose/codecs/motionbert_label.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/mmpose/codecs/motionbert_label.py b/mmpose/codecs/motionbert_label.py index 9efc89e946..fd0b78ae4e 100644 --- a/mmpose/codecs/motionbert_label.py +++ b/mmpose/codecs/motionbert_label.py @@ -74,8 +74,8 @@ def __init__(self, def encode(self, keypoints: np.ndarray, + lifting_target: np.ndarray, keypoints_visible: Optional[np.ndarray] = None, - lifting_target: Optional[np.ndarray] = None, lifting_target_visible: Optional[np.ndarray] = None, camera_param: Optional[dict] = None, factor: Optional[np.ndarray] = None) -> dict: @@ -83,10 +83,10 @@ def encode(self, Args: keypoints (np.ndarray): Keypoint coordinates in shape (B, T, K, D). - keypoints_visible (np.ndarray, optional): Keypoint visibilities in - shape (B, T, K). lifting_target (np.ndarray, optional): 3d target coordinate in shape (T, K, C). + keypoints_visible (np.ndarray, optional): Keypoint visibilities in + shape (B, T, K). lifting_target_visible (np.ndarray, optional): Target coordinate in shape (T, K, ). camera_param (dict, optional): The camera parameter dictionary. @@ -110,9 +110,6 @@ def encode(self, if keypoints_visible is None: keypoints_visible = np.ones(keypoints.shape[:2], dtype=np.float32) - if lifting_target is None: - lifting_target = [keypoints[..., 0, :, :]] - # set initial value for `lifting_target_weight` if lifting_target_visible is None: lifting_target_visible = np.ones( @@ -154,9 +151,7 @@ def encode(self, if self.mode == 'train': w, h = w / 1000, h / 1000 lifting_target_label[ - ..., :2] = lifting_target_label[..., :2] / w * 2 - [ - 0.001, h / w - ] + ..., :2] = lifting_target_label[..., :2] / w * 2 - [1, h / w] lifting_target_label[..., 2] = lifting_target_label[..., 2] / w * 2 lifting_target_label[..., :, :] = lifting_target_label[ ..., :, :] - lifting_target_label[..., From e27835e1a1fb0c519b89b6c35697ee58596bc860 Mon Sep 17 00:00:00 2001 From: LareinaM Date: Mon, 9 Oct 2023 11:36:36 +0800 Subject: [PATCH 2/2] fix input args --- mmpose/codecs/motionbert_label.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mmpose/codecs/motionbert_label.py b/mmpose/codecs/motionbert_label.py index fd0b78ae4e..98024ea4e6 100644 --- a/mmpose/codecs/motionbert_label.py +++ b/mmpose/codecs/motionbert_label.py @@ -74,8 +74,8 @@ def __init__(self, def encode(self, keypoints: np.ndarray, - lifting_target: np.ndarray, keypoints_visible: Optional[np.ndarray] = None, + lifting_target: Optional[np.ndarray] = None, lifting_target_visible: Optional[np.ndarray] = None, camera_param: Optional[dict] = None, factor: Optional[np.ndarray] = None) -> dict: @@ -83,10 +83,10 @@ def encode(self, Args: keypoints (np.ndarray): Keypoint coordinates in shape (B, T, K, D). - lifting_target (np.ndarray, optional): 3d target coordinate in - shape (T, K, C). keypoints_visible (np.ndarray, optional): Keypoint visibilities in shape (B, T, K). + lifting_target (np.ndarray, optional): 3d target coordinate in + shape (T, K, C). lifting_target_visible (np.ndarray, optional): Target coordinate in shape (T, K, ). camera_param (dict, optional): The camera parameter dictionary. @@ -124,6 +124,7 @@ def encode(self, encoded = dict() + assert lifting_target is not None lifting_target_label = lifting_target.copy() keypoint_labels = keypoints.copy()