MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / process_human_model_output_batch_simplify

Function process_human_model_output_batch_simplify

util/preprocessing.py:691–854  ·  view source on GitHub ↗
(human_model_param,
                                     do_flip,
                                     rot,
                                     as_smplx, data_name=None
                                     )

Source from the content-addressed store, hash-verified

689 return pose, shape, expr, rotation_valid, coord_valid, expr_valid, shape_valid
690
691def process_human_model_output_batch_simplify(human_model_param,
692 do_flip,
693 rot,
694 as_smplx, data_name=None
695 ):
696 num_person = human_model_param['body_pose'].shape[0]
697 human_model = smpl_x
698 rotation_valid = np.ones((num_person,smpl_x.orig_joint_num), dtype=np.float32)
699 coord_valid = np.ones((num_person,smpl_x.joint_num), dtype=np.float32)
700 # expr_valid = np.ones((num_person), dtype=np.float32)
701 # shape_valid = np.ones((num_person), dtype=np.float32)
702 # shape, trans = human_model_param['shape'], human_model_param['trans']
703 # check smplx valid key exsits
704 if 'smplx_valid' in human_model_param:
705 smplx_valid = human_model_param['smplx_valid']
706 shape_valid = human_model_param['smplx_valid']
707 else:
708 smplx_valid = np.ones(num_person, dtype=np.bool8)
709 shape_valid = np.ones(num_person, dtype=np.bool8)
710
711 if 'expr_valid' in human_model_param:
712 expr_valid = human_model_param['expr_valid']
713 else:
714 expr_valid = np.ones(num_person, dtype=np.bool8)
715 expr_valid*=smplx_valid
716
717 # check face valid key exsits
718 if 'face_valid' in human_model_param:
719 face_valid = human_model_param['face_valid']
720 else:
721 face_valid = np.ones(num_person, dtype=np.bool8)
722 face_valid *= smplx_valid
723
724 # check lhand valid key exsits
725 if 'lhand_valid' in human_model_param:
726 lhand_valid = human_model_param['lhand_valid']
727 else:
728 lhand_valid = np.ones(num_person, dtype=np.bool8)
729 lhand_valid*=smplx_valid
730
731 # check rhand valid key exsits
732 if 'rhand_valid' in human_model_param:
733 rhand_valid = human_model_param['rhand_valid']
734 else:
735 rhand_valid = np.ones(num_person, dtype=np.bool8)
736 rhand_valid*=smplx_valid
737
738 # check validation of the smplx parameters
739 if 'body_pose' in human_model_param \
740 and human_model_param['body_pose'] is not None:
741 root_pose, body_pose = human_model_param['root_pose'], human_model_param['body_pose']
742 shape, trans = human_model_param['shape'], human_model_param['trans']
743 root_pose = torch.FloatTensor(root_pose).view(num_person, 1, 3)
744 body_pose = torch.FloatTensor(body_pose).view(num_person, -1, 3)
745 shape = torch.FloatTensor(shape).view(num_person, -1)
746 trans = torch.FloatTensor(trans).view(num_person,-1)
747 else:
748 root_pose = np.zeros((num_person, 3), dtype=np.float32)

Callers 2

__getitem__Method · 0.90
__getitem__Method · 0.90

Calls 2

cloneMethod · 0.80
copyMethod · 0.80

Tested by

no test coverage detected