in env_humanoid_imitation.py [0:0]
def load_motions(motion_files, skel, char_info, verbose):
assert motion_files is not None
motion_file_names = []
for names in motion_files:
head, tail = os.path.split(names)
motion_file_names.append(tail)
if isinstance(motion_files[0], str):
motion_dict = {}
motion_all = []
for i, file in enumerate(motion_files):
''' If the same file is already loaded, do not load again for efficiency'''
if file in motion_dict:
m = motion_dict[file]
else:
if file.endswith('bvh'):
m = bvh.load(motion=Motion(name=file, skel=skel),
file=file,
scale=1.0,
load_skel=False,
v_up_skel=char_info.v_up,
v_face_skel=char_info.v_face,
v_up_env=char_info.v_up_env)
m = MotionWithVelocity.from_motion(m)
elif file.endswith('bin'):
m = pickle.load(open(file, "rb"))
elif file.endswith('gzip') or file.endswith('gz'):
with gzip.open(file, "rb") as f:
m = pickle.load(f)
else:
raise Exception('Unknown Motion File Type')
if verbose:
print('Loaded: %s'%file)
motion_all.append(m)
elif isinstance(motion_files[0], MotionWithVelocity):
motion_all = motion_files
else:
raise Exception('Unknown Type for Reference Motion')
return motion_all, motion_file_names