def preprocessing(self, motion3d, view_angle=None, params=None): if self.aug: motion3d, params = self.augmentation(motion3d, params) basis = None if view_angle is not None: basis = get_change_of_basis(motion3d, view_angle) motion3d = preprocess_mixamo(motion3d) motion3d = rotate_motion_3d(motion3d, basis) motion2d = motion3d[:, [0, 2], :] motion2d_scale = limb_scale_motion_2d(motion2d, self.global_range, self.local_range) motion2d = localize_motion(motion2d) motion2d_scale = localize_motion(motion2d_scale) motion2d = normalize_motion(motion2d, self.meanpose, self.stdpose) motion2d_scale = normalize_motion(motion2d_scale, self.meanpose, self.stdpose) motion2d = motion2d.reshape([-1, motion2d.shape[-1]]) motion2d_scale = motion2d_scale.reshape((-1, motion2d_scale.shape[-1])) motion2d = torch.from_numpy(motion2d).float() motion2d_scale = torch.from_numpy(motion2d_scale).float() return motion2d, motion2d_scale
def preprocessing(self, motion3d, view_angle=None, params=None): """ :param item: filename built from self.build_tiem :return: """ if self.aug: motion3d, params = self.augmentation(motion3d, params) basis = None if view_angle is not None: basis = get_change_of_basis(motion3d, view_angle) motion3d = preprocess_mixamo(motion3d) motion3d = rotate_motion_3d(motion3d, basis) motion3d = localize_motion(motion3d) motion3d = normalize_motion(motion3d, self.meanpose, self.stdpose) motion2d = motion3d[:, [0, 2], :] motion3d = motion3d.reshape([-1, motion3d.shape[-1]]) motion2d = motion2d.reshape([-1, motion2d.shape[-1]]) motion3d = torch.from_numpy(motion3d).float() motion2d = torch.from_numpy(motion2d).float() return motion3d, motion2d
def preprocessing(self, motion): motion = motion * self.unit motion[1, :, :] = (motion[2, :, :] + motion[5, :, :]) / 2 motion[8, :, :] = (motion[9, :, :] + motion[12, :, :]) / 2 global_scale = self.global_range[0] + np.random.random() * (self.global_range[1] - self.global_range[0]) local_scales = self.local_range[0] + np.random.random([8]) * (self.local_range[1] - self.local_range[0]) motion_scale = scale_limbs(motion, global_scale, local_scales) motion = localize_motion(motion) motion_scale = localize_motion(motion_scale) motion = normalize_motion(motion, self.meanpose, self.stdpose) motion_scale = normalize_motion(motion_scale, self.meanpose, self.stdpose) motion = motion.reshape((-1, motion.shape[-1])) motion_scale = motion_scale.reshape((-1, motion_scale.shape[-1])) motion = torch.from_numpy(motion).float() motion_scale = torch.from_numpy(motion_scale).float() return motion, motion_scale