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

My own dataset visualization #146

Closed
MayuOshima opened this issue Jan 16, 2022 · 2 comments
Closed

My own dataset visualization #146

MayuOshima opened this issue Jan 16, 2022 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@MayuOshima
Copy link

Hello, thanks for your great work!

Actually, I have used your code to train my own dataset and saved the dict.
Now I want to render the predicted meshes.
How can I get the renderings using the saved 'verts', 'pose', 'betas', 'cam', 'trans'?
I've got the SMPL model and read your code visualization.py. However, it seems you don't use the 'cam' as cam_param.
If I do what visualization.py does, I can't get a correct rendered image.

So could you please tell me how to get the correct rendered images using saved dict information?

@Arthur151
Copy link
Owner

Arthur151 commented Jan 17, 2022

To visualize the mesh on image, you just need to run visualize_renderer_verts_list with right inputs.

The vertex are just verts in npz.

The estimated translation of meshes are cam_trans.
I just submit a commit to master to save cam_trans into npz via this line and this line.

You just need to collect the npz results into tow lists and put them into visualize_renderer_verts_list. For instance, the code might like

import numpy as np
import torch
import cv2

results = np.load('path/to/npz',allow_pickle=True)['results'][()]
for img_path in results:
    image_results = results[img_path]
    org_imgs = [cv2.imread(img_path)]
    per_img_verts_list = [torch.from_numpy(image_results[person_id]['verts']).float() for person_id in image_results]
    mesh_trans = [torch.from_numpy(image_results[person_id]['cam_trans']).float() for person_id in image_results]
    rendered_imgs = self.visualize_renderer_verts_list(per_img_verts_list, images=org_imgs, trans=mesh_trans)

Just like that. Enjoy your day with ROMP~
Best,
Yu

@MayuOshima
Copy link
Author

MayuOshima commented Jan 17, 2022

Thanks for your quick reply!
I have tried your code and it works!

@Arthur151 Arthur151 added the documentation Improvements or additions to documentation label Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants