From 8300036a7e993cc943eec593642f26751c2d727a Mon Sep 17 00:00:00 2001 From: visonpon Date: Mon, 25 Apr 2022 10:43:51 +0800 Subject: [PATCH 1/2] Create convert_amass_mesh_to_bvh.py --- tests/convert_amass_mesh_to_bvh.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/convert_amass_mesh_to_bvh.py diff --git a/tests/convert_amass_mesh_to_bvh.py b/tests/convert_amass_mesh_to_bvh.py new file mode 100644 index 0000000..8f13b2d --- /dev/null +++ b/tests/convert_amass_mesh_to_bvh.py @@ -0,0 +1,26 @@ +import torch +import numpy as np +from human_body_prior.body_model.body_model import BodyModel +from fairmotion.core import motion as motion_class +from fairmotion.ops import conversions +from fairmotion.utils import +from fairmotion.data import amass,bvh + +def load_body_model(bm_path, num_betas=10, model_type="smplh"): + comp_device = torch.device("cpu") + bm = BodyModel( + bm_fname=bm_path, + num_betas=num_betas, + # model_type=model_type + ).to(comp_device) + return bm + + file='./*.npz'#TODO --- file from amass + bm_path = '../smplh/male/model.npz' + num_betas=10 #TODO --- set tp 16 with hand but this tool doesn't support hand + model_type='smplh' + bm = load_body_model(bm_path,num_betas,model_type) + + motion = amass.load(file,bm,bm_path,model_type) + bvh.save(motion,filename='./result.bvh') + From e1e589ce187397d237877f4754c699dda4639723 Mon Sep 17 00:00:00 2001 From: visonpon Date: Mon, 25 Apr 2022 10:44:51 +0800 Subject: [PATCH 2/2] Update convert_amass_mesh_to_bvh.py --- tests/convert_amass_mesh_to_bvh.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/convert_amass_mesh_to_bvh.py b/tests/convert_amass_mesh_to_bvh.py index 8f13b2d..b86fb5e 100644 --- a/tests/convert_amass_mesh_to_bvh.py +++ b/tests/convert_amass_mesh_to_bvh.py @@ -14,13 +14,13 @@ def load_body_model(bm_path, num_betas=10, model_type="smplh"): # model_type=model_type ).to(comp_device) return bm + +file='./*.npz'#TODO --- file from amass +bm_path = '../smplh/male/model.npz' +num_betas=10 #TODO --- set tp 16 with hand but this tool doesn't support hand +model_type='smplh' +bm = load_body_model(bm_path,num_betas,model_type) - file='./*.npz'#TODO --- file from amass - bm_path = '../smplh/male/model.npz' - num_betas=10 #TODO --- set tp 16 with hand but this tool doesn't support hand - model_type='smplh' - bm = load_body_model(bm_path,num_betas,model_type) - - motion = amass.load(file,bm,bm_path,model_type) - bvh.save(motion,filename='./result.bvh') +motion = amass.load(file,bm,bm_path,model_type) +bvh.save(motion,filename='./result.bvh')