youngwoo-yoon / Co-Speech_Gesture_Generation

This is an implementation of Robots learn social skills: End-to-end learning of co-speech gesture generation for humanoid robots.
https://sites.google.com/view/youngwoo-yoon/projects/co-speech-gesture-generation
Other
72 stars 9 forks source link

meet error "KeyError: 'LeftUpLeg'" when run the function "process_bvh()"? #4

Closed chuangyu-robotics closed 4 years ago

chuangyu-robotics commented 4 years ago

this is the debug information.

Thanks in advance.


KeyError Traceback (most recent call last)

in ----> 1 out_data=process_bvh(base_path+'Recording_001.bvh') in process_bvh(gesture_filename) 20 ]) 21 ---> 22 out_data = data_pipe.fit_transform(data_all) 23 24 ~\.conda\envs\tf2\lib\site-packages\sklearn\pipeline.py in fit_transform(self, X, y, **fit_params) 383 """ 384 last_step = self._final_estimator --> 385 Xt, fit_params = self._fit(X, y, **fit_params) 386 with _print_elapsed_time('Pipeline', 387 self._log_message(len(self.steps) - 1)): ~\.conda\envs\tf2\lib\site-packages\sklearn\pipeline.py in _fit(self, X, y, **fit_params) 313 message_clsname='Pipeline', 314 message=self._log_message(step_idx), --> 315 **fit_params_steps[name]) 316 # Replace the transformer of the step with the fitted 317 # transformer. This is necessary when loading the transformer ~\.conda\envs\tf2\lib\site-packages\joblib\memory.py in __call__(self, *args, **kwargs) 353 354 def __call__(self, *args, **kwargs): --> 355 return self.func(*args, **kwargs) 356 357 def call_and_shelve(self, *args, **kwargs): ~\.conda\envs\tf2\lib\site-packages\sklearn\pipeline.py in _fit_transform_one(transformer, X, y, weight, message_clsname, message, **fit_params) 726 with _print_elapsed_time(message_clsname, message): 727 if hasattr(transformer, 'fit_transform'): --> 728 res = transformer.fit_transform(X, y, **fit_params) 729 else: 730 res = transformer.fit(X, y, **fit_params).transform(X) ~\.conda\envs\tf2\lib\site-packages\sklearn\base.py in fit_transform(self, X, y, **fit_params) 569 if y is None: 570 # fit method of arity 1 (unsupervised transformation) --> 571 return self.fit(X, **fit_params).transform(X) 572 else: 573 # fit method of arity 2 (supervised transformation) ~\.conda\envs\tf2\lib\site-packages\pymo-0.0.1-py3.7.egg\pymo\preprocessing.py in transform(self, X, y) 36 return X 37 elif self.param_type == 'position': ---> 38 return self._to_pos(X) 39 elif self.param_type == 'expmap2pos': 40 return self._expmap_to_pos(X) ~\.conda\envs\tf2\lib\site-packages\pymo-0.0.1-py3.7.egg\pymo\preprocessing.py in _to_pos(self, X) 108 109 for joint in track.traverse(): --> 110 parent = track.skeleton[joint]['parent'] 111 rot_order = track.skeleton[joint]['order'] 112 KeyError: 'LeftUpLeg'
chuangyu-robotics commented 4 years ago

target_joints = ['Spine', 'Spine1', 'Spine2', 'Spine3', 'Neck', 'Neck1', 'Head', 'RightShoulder', 'RightArm', 'RightForeArm', 'RightHand', 'LeftShoulder', 'LeftArm', 'LeftForeArm', 'LeftHand']

def process_bvh(gesture_filename): p = BVHParser()

data_all = list()
data_all.append(p.parse(gesture_filename))

data_pipe = Pipeline([
    ('dwnsampl', DownSampler(tgt_fps=20, keep_all=False)),
    ('root', RootTransformer('hip_centric')),
    ('mir', Mirror(axis='X', append=True)),
    ('jtsel', JointSelector(target_joints, include_root=True)),
   ('exp', MocapParameterizer('expmap')), 
   ('cnst', ConstantsRemover()),
    ('np', Numpyfier())
])

out_data = data_pipe.fit_transform(data_all)

return out_data
chuangyu-robotics commented 4 years ago

when I use the " ('exp', MocapParameterizer('expmap'))," it is ok.

But when I changed to ('exp', MocapParameterizer('position')), it show the error as above.

chuangyu-robotics commented 4 years ago

I got it. It is the reason of PyMo. its traverse() in "data.py" make it wrong.

youngwoo-yoon commented 4 years ago

If it is a problem with PyMo, please see the original repository and modified version by Simon Alexanderson that I used. https://github.com/omimo/PyMO https://github.com/simonalexanderson/PyMO