2021-04-14 15:22:51 +08:00
|
|
|
'''
|
|
|
|
@ Date: 2021-04-13 20:12:58
|
|
|
|
@ Author: Qing Shuai
|
|
|
|
@ LastEditors: Qing Shuai
|
2021-06-28 10:38:36 +08:00
|
|
|
@ LastEditTime: 2021-06-25 22:14:58
|
|
|
|
@ FilePath: /EasyMocapRelease/easymocap/pipeline/weight.py
|
2021-04-14 15:22:51 +08:00
|
|
|
'''
|
2021-06-28 10:38:36 +08:00
|
|
|
def load_weight_shape(model, opts):
|
|
|
|
if model in ['smpl', 'smplh', 'smplx']:
|
|
|
|
weight = {'s3d': 1., 'reg_shapes': 5e-3}
|
|
|
|
elif model == 'mano':
|
|
|
|
weight = {'s3d': 1e2, 'reg_shapes': 5e-5}
|
|
|
|
else:
|
|
|
|
raise NotImplementedError
|
2021-04-14 15:22:51 +08:00
|
|
|
for key in opts.keys():
|
|
|
|
if key in weight.keys():
|
|
|
|
weight[key] = opts[key]
|
|
|
|
return weight
|
|
|
|
|
|
|
|
def load_weight_pose(model, opts):
|
|
|
|
if model == 'smpl':
|
|
|
|
weight = {
|
2021-06-28 10:38:36 +08:00
|
|
|
'k3d': 1., 'reg_poses_zero': 1e-2, 'smooth_body': 5e0,
|
|
|
|
'smooth_poses': 1e0, 'reg_poses': 1e-3,
|
2021-04-14 15:22:51 +08:00
|
|
|
'k2d': 1e-4
|
|
|
|
}
|
|
|
|
elif model == 'smplh':
|
|
|
|
weight = {
|
|
|
|
'k3d': 1., 'k3d_hand': 5.,
|
|
|
|
'reg_poses_zero': 1e-2,
|
|
|
|
'smooth_body': 5e-1, 'smooth_poses': 1e-1, 'smooth_hand': 1e-3,
|
|
|
|
'reg_hand': 1e-4,
|
|
|
|
'k2d': 1e-4
|
|
|
|
}
|
|
|
|
elif model == 'smplx':
|
|
|
|
weight = {
|
|
|
|
'k3d': 1., 'k3d_hand': 5., 'k3d_face': 2.,
|
|
|
|
'reg_poses_zero': 1e-2,
|
|
|
|
'smooth_body': 5e-1, 'smooth_poses': 1e-1, 'smooth_hand': 1e-3,
|
|
|
|
'reg_hand': 1e-4, 'reg_expr': 1e-2, 'reg_head': 1e-2,
|
|
|
|
'k2d': 1e-4
|
|
|
|
}
|
2021-05-27 21:12:17 +08:00
|
|
|
elif model == 'mano':
|
|
|
|
weight = {
|
2021-06-28 10:38:36 +08:00
|
|
|
'k3d': 1e2, 'k2d': 2e-3,
|
|
|
|
'reg_poses': 1e-3, 'smooth_body': 1e2,
|
|
|
|
# 'collision': 1 # If the frame number is too large (more than 1000), then GPU oom
|
2021-05-27 21:12:17 +08:00
|
|
|
}
|
2021-06-28 10:38:36 +08:00
|
|
|
# weight = {
|
|
|
|
# 'k3d': 1., 'k2d': 1e-4,
|
|
|
|
# 'reg_poses': 1e-4, 'smooth_body': 0
|
|
|
|
# }
|
2021-04-14 15:22:51 +08:00
|
|
|
else:
|
2021-05-27 21:12:17 +08:00
|
|
|
print(model)
|
2021-04-14 15:22:51 +08:00
|
|
|
raise NotImplementedError
|
|
|
|
for key in opts.keys():
|
|
|
|
if key in weight.keys():
|
|
|
|
weight[key] = opts[key]
|
|
|
|
return weight
|
2021-05-27 21:12:17 +08:00
|
|
|
|
|
|
|
def load_weight_pose2d(model, opts):
|
|
|
|
if model == 'smpl':
|
|
|
|
weight = {
|
|
|
|
'k2d': 2e-4,
|
|
|
|
'init_poses': 1e-3, 'init_shapes': 1e-2,
|
|
|
|
'smooth_body': 5e-1, 'smooth_poses': 1e-1,
|
|
|
|
}
|
|
|
|
elif model == 'smplh':
|
|
|
|
raise NotImplementedError
|
|
|
|
elif model == 'smplx':
|
|
|
|
raise NotImplementedError
|
|
|
|
else:
|
|
|
|
weight = {}
|
|
|
|
for key in opts.keys():
|
|
|
|
if key in weight.keys():
|
|
|
|
weight[key] = opts[key]
|
|
|
|
return weight
|