(self, skeleton)
Input a new skeleton, return the extracted feature.
        Returns:
            is_success {bool}: Return the feature only when
                the historical input skeletons are more than self._window_size.
            features {np.array}
Input a new skeleton, return the extracted feature.
        Returns:
            is_success {bool}: Return the feature only when
                the historical input skeletons are more than self._window_size.
            features {np.array}
Input a new skeleton return the extracted feature . Returns : is_success { bool } : Return the feature only when the historical input skeletons are more than self . _window_size . features { np . array }
def add_cur_skeleton(self, skeleton):
        ''' Input a new skeleton, return the extracted feature.
        Returns:
            is_success {bool}: Return the feature only when
                the historical input skeletons are more than self._window_size.
            features {np.array} 
        '''

        x = retrain_only_body_joints(skeleton)

        if not ProcFtr.has_neck_and_thigh(x):
            self.reset()
            return False, None

        else:
            ''' The input skeleton has a neck and at least one thigh '''
            # -- Preprocess x
            # Fill zeros, compute angles/lens
            x = self._fill_invalid_data(x)
            if self._is_adding_noise:
                # Add noise druing training stage to augment data
                x = self._add_noises(x, self._noise_intensity)
            x = np.array(x)
            # angles, lens = ProcFtr.joint_pos_2_angle_and_length(x) # deprecate

            # Push to deque
            self._x_deque.append(x)
            # self._angles_deque.append(angles) # deprecate
            # self._lens_deque.append(lens) # deprecate

            self._maintain_deque_size()
            self._pre_x = x.copy()

            # -- Extract features
            if len(self._x_deque) < self._window_size:
                return False, None
            else:
                # -- Normalize all 1~t features
                h_list = [ProcFtr.get_body_height(xi) for xi in self._x_deque]
                mean_height = np.mean(h_list)
                xnorm_list = [ProcFtr.remove_body_offset(xi)/mean_height
                              for xi in self._x_deque]

                # -- Get features of pose/angles/lens
                f_poses = self._deque_features_to_1darray(xnorm_list)
                # f_angles = self._deque_features_to_1darray(self._angles_deque) # deprecate
                # f_lens = self._deque_features_to_1darray(
                #     self._lens_deque) / mean_height # deprecate

                # -- Get features of motion

                f_v_center = self._compute_v_center(
                    self._x_deque, step=1) / mean_height  # len = (t=4)*2 = 8
                f_v_center = np.repeat(f_v_center, 10)  # repeat to add weight

                f_v_joints = self._compute_v_all_joints(
                    xnorm_list, step=1)  # len = (t=(5-1)/step)*12*2 = 96

                # -- Output
                features = np.concatenate((f_poses, f_v_joints, f_v_center))
                return True, features.copy()
def add_cur_skeleton ( self , skeleton ) : x = retrain_only_body_joints ( skeleton ) if not ProcFtr . has_neck_and_thigh ( x ) : self . reset ( ) return False , None else : ''' The input skeleton has a neck and at least one thigh ''' # -- Preprocess x # Fill zeros, compute angles/lens x = self . _fill_invalid_data ( x ) if self . _is_adding_noise : # Add noise druing training stage to augment data x = self . _add_noises ( x , self . _noise_intensity ) x = np . array ( x ) # angles, lens = ProcFtr.joint_pos_2_angle_and_length(x) # deprecate # Push to deque self . _x_deque . append ( x ) # self._angles_deque.append(angles) # deprecate # self._lens_deque.append(lens) # deprecate self . _maintain_deque_size ( ) self . _pre_x = x . copy ( ) # -- Extract features if len ( self . _x_deque ) < self . _window_size : return False , None else : # -- Normalize all 1~t features h_list = [ ProcFtr . get_body_height ( xi ) for xi in self . _x_deque ] mean_height = np . mean ( h_list ) xnorm_list = [ ProcFtr . remove_body_offset ( xi ) / mean_height for xi in self . _x_deque ] # -- Get features of pose/angles/lens f_poses = self . _deque_features_to_1darray ( xnorm_list ) # f_angles = self._deque_features_to_1darray(self._angles_deque) # deprecate # f_lens = self._deque_features_to_1darray( #     self._lens_deque) / mean_height # deprecate # -- Get features of motion f_v_center = self . _compute_v_center ( self . _x_deque , step = 1 ) / mean_height # len = (t=4)*2 = 8 f_v_center = np . repeat ( f_v_center , 10 ) # repeat to add weight f_v_joints = self . _compute_v_all_joints ( xnorm_list , step = 1 ) # len = (t=(5-1)/step)*12*2 = 96 # -- Output features = np . concatenate ( ( f_poses , f_v_joints , f_v_center ) ) return True , features . copy ( )