Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] MotionbertLabel codec #2739

Merged
merged 2 commits into from
Oct 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions mmpose/codecs/motionbert_label.py
Original file line number Diff line number Diff line change
@@ -74,19 +74,19 @@ 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:
"""Encoding keypoints from input image space to normalized space.

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[...,