facebookresearch / AnimatedDrawings

Code to accompany "A Method for Animating Children's Drawings of the Human Figure"
MIT License
10.56k stars 926 forks source link

AssertionError,when I use my own BVH file #106

Closed Pythonpa closed 1 year ago

Pythonpa commented 1 year ago

Thanks to the author's outstanding work! I encountered the following error when using the BVH file extracted by myself to drive the picture animation. Where can I correct it?

from animated_drawings import render render.start('./examples/config/mvc/interactive_window_example.yaml') CRITICAL:root:framenum specified (1482) and found (1483) do not match CRITICAL:root:Error loading BVH: framenum specified (1482) and found (1483) do not match Traceback (most recent call last): File "D:\pythonProject\AnimatedDrawings\animated_drawings\model\retargeter.py", line 34, in init self.bvh = BVH.from_file(str(motion_cfg.bvh_p), motion_cfg.start_frame_idx, motion_cfg.end_frame_idx) File "D:\pythonProject\AnimatedDrawings\animated_drawings\model\bvh.py", line 162, in from_file assert False, msg AssertionError: framenum specified (1482) and found (1483) do not match

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "D:\pythonProject\AnimatedDrawings\animated_drawings\render.py", line 21, in start scene = Scene(cfg.scene) File "D:\pythonProject\AnimatedDrawings\animated_drawings\model\scene.py", line 30, in init ad = AnimatedDrawing(*each) File "D:\pythonProject\AnimatedDrawings\animated_drawings\model\animated_drawing.py", line 255, in init self._initialize_retargeter_bvh(motion_cfg, retarget_cfg) File "D:\pythonProject\AnimatedDrawings\animated_drawings\model\animated_drawing.py", line 317, in _initialize_retargeter_bvh self.retargeter = Retargeter(motion_cfg, retarget_cfg) File "D:\pythonProject\AnimatedDrawings\animated_drawings\model\retargeter.py", line 38, in init assert False, msg AssertionError: Error loading BVH: framenum specified (1482) and found (1483) do not match

hjessmith commented 1 year ago

Hi @Pythonpa,

BVH files contain some 'motion metadata' specifying the number of frames which should be present within the file. The error means the specified number and the actual number don't match. Did you use Rokoko to create your BVH? I encountered this issue when I did (though I neglected to mention it in the readme).

To resolve, open the BVH file with a text editor. Search for the string Frames: 1482, then update it to 1483 so it matches. Alternatively, you can delete the first frame of motion- it should be two lines below Frames: 1482.

Please close the issue if this answer resolves your problems.

Pythonpa commented 1 year ago

Yes,it worked,thanks again~~