add HumanAct12, UTD_MHAD
This commit is contained in:
@ -15,25 +15,13 @@ def create_dir_not_exist(path):
|
||||
os.mkdir(path)
|
||||
|
||||
|
||||
def save_pic(target, res, smpl_layer, file, logger):
|
||||
pose_params, shape_params, verts, Jtr = res
|
||||
name = re.split('[/.]', file)[-2]
|
||||
gt_path = "fit/output/HumanAct12/picture/gt/{}".format(name)
|
||||
fit_path = "fit/output/HumanAct12/picture/fit/{}".format(name)
|
||||
create_dir_not_exist(gt_path)
|
||||
def save_pic(res, smpl_layer, file, logger, dataset_name):
|
||||
_, _, verts, Jtr = res
|
||||
file_name = re.split('[/.]', file)[-2]
|
||||
fit_path = "fit/output/{}/picture/fit/{}".format(dataset_name,file_name)
|
||||
create_dir_not_exist(fit_path)
|
||||
logger.info('Saving pictures at {} and {}'.format(gt_path, fit_path))
|
||||
for i in tqdm(range(target.shape[0])):
|
||||
display_model(
|
||||
{'verts': verts.cpu().detach(),
|
||||
'joints': target.cpu().detach()},
|
||||
model_faces=smpl_layer.th_faces,
|
||||
with_joints=True,
|
||||
kintree_table=smpl_layer.kintree_table,
|
||||
savepath=os.path.join(gt_path+"/frame_{}".format(i)),
|
||||
batch_idx=i,
|
||||
show=False,
|
||||
only_joint=True)
|
||||
logger.info('Saving pictures at {}'.format(fit_path))
|
||||
for i in tqdm(range(Jtr.shape[0])):
|
||||
display_model(
|
||||
{'verts': verts.cpu().detach(),
|
||||
'joints': Jtr.cpu().detach()},
|
||||
@ -42,14 +30,15 @@ def save_pic(target, res, smpl_layer, file, logger):
|
||||
kintree_table=smpl_layer.kintree_table,
|
||||
savepath=os.path.join(fit_path+"/frame_{}".format(i)),
|
||||
batch_idx=i,
|
||||
show=False)
|
||||
show=False,
|
||||
only_joint=False)
|
||||
logger.info('Pictures saved')
|
||||
|
||||
|
||||
def save_params(res, file, logger):
|
||||
def save_params(res, file, logger, dataset_name):
|
||||
pose_params, shape_params, verts, Jtr = res
|
||||
name = re.split('[/.]', file)[-2]
|
||||
fit_path = "fit/output/HumanAct12/params/"
|
||||
file_name = re.split('[/.]', file)[-2]
|
||||
fit_path = "fit/output/{}/params/".format(dataset_name)
|
||||
create_dir_not_exist(fit_path)
|
||||
logger.info('Saving params at {}'.format(fit_path))
|
||||
pose_params = pose_params.cpu().detach()
|
||||
@ -58,11 +47,13 @@ def save_params(res, file, logger):
|
||||
shape_params = shape_params.numpy().tolist()
|
||||
Jtr = Jtr.cpu().detach()
|
||||
Jtr = Jtr.numpy().tolist()
|
||||
verts = verts.cpu().detach()
|
||||
verts = verts.numpy().tolist()
|
||||
params = {}
|
||||
params["pose_params"] = pose_params
|
||||
params["shape_params"] = shape_params
|
||||
params["Jtr"] = Jtr
|
||||
params["mesh"] = verts
|
||||
f = open(os.path.join((fit_path),
|
||||
"{}_params.json".format(name)), 'w')
|
||||
"{}_params.json".format(file_name)), 'w')
|
||||
json.dump(params, f)
|
||||
logger.info('Params saved')
|
||||
|
||||
Reference in New Issue
Block a user