wyysf-98 / GenMM

Apache License 2.0
259 stars 21 forks source link

Error occur on certain .bvh file #5

Open HYLee1008 opened 1 year ago

HYLee1008 commented 1 year ago

Hi, thanks to your amazing work!

I've tried to run your code on my custom .bvh file. While some .bvh files work fine, there are also .bvh files that cause errors. Here is the error message. Traceback (most recent call last): File "run_random_generation.py", line 116, in <module> generate(cfg) File "run_random_generation.py", line 78, in generate motion_data = [BVHMotion(cfg.input, skeleton_name=cfg.skeleton_name, repr=cfg.repr, File "/home/hylee/workspace/GenMM/dataset/bvh_motion.py", line 53, in __init__ self.raw_data = BVH_file(bvh_file, skeleton_confs[skeleton_name] if skeleton_name is not None else None, requires_contact, joint_reduction, auto_scale=True) File "/home/hylee/workspace/GenMM/dataset/bvh/bvh_parser.py", line 96, in __init__ self.anim = bvh_io.load(file_path) File "/home/hylee/workspace/GenMM/dataset/bvh/bvh_io.py", line 179, in load data_block = data_block.reshape(N, 6) ValueError: cannot reshape array of size 813 into shape (137,6)

It seems that errors occur if the number of channels for all joints is not the same. How can I handle this problem?

wyysf-98 commented 1 year ago

Hi, the current python bvh parser is not very stable and can not handle some special format .bvh file, such as different channels of joints. I think you can try to import your custom .bvh file into Blender, and then export it, then you may get the correct format. If you have any issues, please share more information about your motion file.

HYLee1008 commented 1 year ago

Thanks for your reply!

I already made my custom .bvh file using blender. I think blender cannot solve this problem automatically.

Beside, when I made .bvh file from the mixam character and animation using blender, it also has the differnet channels of joints. I think it would be great if GenMM can handle this problem to use more bvh file generally.

wyysf-98 commented 1 year ago

Got it. I think I'll try to fix this to support more motion files in the future.

As for mixamo data, you can convert it using fbx2bvh, which works fine on most data during my experiments.