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

Weird visualization from 6D rotation representation. #24

Open
WindVChen opened this issue Jan 29, 2024 · 2 comments
Open

Weird visualization from 6D rotation representation. #24

WindVChen opened this issue Jan 29, 2024 · 2 comments

Comments

@WindVChen
Copy link

I'm trying to visualize the human motions with the given 6D rotation representations in "motions_processed" folder. However, with the following code, the visualization result is quite weird.

Could you provide some guidance?

    from human_body_prior.body_model.body_model import BodyModel
    import numpy as np
    from pytorch3d import transforms
    from common.quaternion import *

    imw, imh = 800, 800
    mv = MeshViewer(width=imw, height=imh, use_offscreen=False)

    bm_fname = '/smplh/neutral/model.npz'
    bm = BodyModel(bm_fname=bm_fname, num_betas=10)

    data1 = np.load("./data/motions_processed/person1/6035.npy")

    rot_6d = data1[..., 62 * 3:62 * 3 + 21 * 6]

    rot_matrix = cont6d_to_matrix(torch.from_numpy(rot_6d.reshape(-1, 6)))
    rot_axis_angle = transforms.matrix_to_axis_angle(rot_matrix).view(-1, 63)

    body_pose_beta = bm(pose_body=rot_axis_angle)
    for fId in tqdm.tqdm(range(body_pose_beta.v.shape[0])):
        body_mesh = trimesh.Trimesh(vertices=convert(body_pose_beta.v[fId]), faces=bm.f, vertex_colors=np.tile(colors['grey'], (6890, 1)))
        mv.viewer.render_lock.acquire()
        mv.set_static_meshes([body_mesh])
        mv.viewer.render_lock.release()
        plt.pause(1)

微信截图_20240130001623

@TLDX-XIONG
Copy link

I'm trying to visualize the human motions with the given 6D rotation representations in "motions_processed" folder. However, with the following code, the visualization result is quite weird.

Could you provide some guidance?

    from human_body_prior.body_model.body_model import BodyModel
    import numpy as np
    from pytorch3d import transforms
    from common.quaternion import *

    imw, imh = 800, 800
    mv = MeshViewer(width=imw, height=imh, use_offscreen=False)

    bm_fname = '/smplh/neutral/model.npz'
    bm = BodyModel(bm_fname=bm_fname, num_betas=10)

    data1 = np.load("./data/motions_processed/person1/6035.npy")

    rot_6d = data1[..., 62 * 3:62 * 3 + 21 * 6]

    rot_matrix = cont6d_to_matrix(torch.from_numpy(rot_6d.reshape(-1, 6)))
    rot_axis_angle = transforms.matrix_to_axis_angle(rot_matrix).view(-1, 63)

    body_pose_beta = bm(pose_body=rot_axis_angle)
    for fId in tqdm.tqdm(range(body_pose_beta.v.shape[0])):
        body_mesh = trimesh.Trimesh(vertices=convert(body_pose_beta.v[fId]), faces=bm.f, vertex_colors=np.tile(colors['grey'], (6890, 1)))
        mv.viewer.render_lock.acquire()
        mv.set_static_meshes([body_mesh])
        mv.viewer.render_lock.release()
        plt.pause(1)

微信截图_20240130001623

hello, do you solve the problem?

@WindVChen
Copy link
Author

Hi @TLDX-XIONG ,

Yes, I did manage to solve the problem. However, it's been a while since I worked on it, so I don't recall all the specifics of the correct visualization method. From what I remember, the issue with the visualization script above was related to the Rotation 6D representation. You might want to try visualizing it by taking the 6D as either columns or rows of the rotation matrix. One of these approaches should yield the correct visualization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants