VIBE icon indicating copy to clipboard operation
VIBE copied to clipboard

[BUG] .fbx conversion

Open alivemachine opened this issue 4 years ago • 26 comments

It seems that the .fbx conversion does not work in many situations. The sample video conversion to fbx worked but any other video gave me the following error:

Traceback (most recent call last): File "lib/utils/fbx_output.py", line 320, in <module> 
person_id=args.person_id 
File "lib/utils/fbx_output.py", line 166, in process_poses 
poses = data[person_id]['pose'] 
KeyError: 1 
Error: Not freed memory blocks: 8, total unfreed memory 0.010223 MB

It seems to be linked to having multiple people in the shots? Or to having people disappear/reappear?

windows 10 pro python 3.8.5

alivemachine avatar Jan 12 '21 00:01 alivemachine

Hi @alivemachine , an irrelavant question, do you mind sharing how you installed bpy? bpy is called within fbx_output.py.

shawkontzu avatar Mar 31 '21 02:03 shawkontzu

I think I saw what was the problem. when you have lots of people on a video, maybe the default person id (1) wont be available. So you have to use the --person_id argument and try others ids, like, 2, 3, 4.

I had a problem like that in the past.

carlosedubarreto avatar Mar 31 '21 06:03 carlosedubarreto

Hi @alivemachine , an irrelavant question, do you mind sharing how you installed bpy? bpy is called within fbx_output.py.

Windows or Linux?

sumingrui avatar Apr 09 '21 08:04 sumingrui

Hello, how did you install the bpy library

liuhaorandezhanghao avatar Apr 27 '21 01:04 liuhaorandezhanghao

嗨@alivemachine,这是一个不相关的问题,您介意分享如何安装bpy吗?bpy在fbx_output.py中被调用。

Windows还是Linux?

您好,麻烦问下如何在mac安装bpy,我安装的bpy不全,没有data.scene

liuhaorandezhanghao avatar Apr 27 '21 01:04 liuhaorandezhanghao

Hello, how did you install the bpy library

You can try these instructions @liuhaorandezhanghao

https://github.com/carlosedubarreto/vibe_win_install#fbx-conversion

carlosedubarreto avatar Apr 27 '21 07:04 carlosedubarreto

Is the bpy module bundled with blender and cannot be installed separately? I can only use bpy in blender, and I will get an error when I use it in my python environment. Do you have any good methods?

On 04/27/2021 15:37,Carlos @.***> wrote:

Hello, how did you install the bpy library

You can try these instructions @liuhaorandezhanghao

https://github.com/carlosedubarreto/vibe_win_install#fbx-conversion

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

liuhaorandezhanghao avatar May 08 '21 03:05 liuhaorandezhanghao

Is the bpy module bundled with blender and cannot be installed separately? I can only use bpy in blender, and I will get an error when I use it in my python environment. Do you have any good methods?

I wal able to install using miniconda python.

I used this command.

conda install -c kitsune.one python

You can install miniconda even if you have vanilla python installed.

Things with miniconda are much easier

carlosedubarreto avatar May 08 '21 06:05 carlosedubarreto

Hello, in my fbx output, the character model is always lying on the ground, that is, it is rotated 90 degrees downwards. Where can I change this code? Thanks!

On 05/8/2021 @.***> wrote: Is the bpy module bundled with blender and cannot be installed separately? I can only use bpy in blender, and I will get an error when I use it in my python environment. Do you have any good methods?

On 04/27/2021 15:37,Carlos @.***> wrote:

Hello, how did you install the bpy library

You can try these instructions @liuhaorandezhanghao

https://github.com/carlosedubarreto/vibe_win_install#fbx-conversion

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

liuhaorandezhanghao avatar Jun 16 '21 09:06 liuhaorandezhanghao

@liuhaorandezhanghao , you do 2 tricks to solve the problem.

Go to edit pose and get the root bone, remove all the Keyframes on it and insert one keyframe at the begging, rotating the root bone to the expected position.

Another truck would be export it as bvh and when importing, choose the axis to the way that brings the model correctly.

Another way would be using bvh retargetter http://diffeomorphic.blogspot.com/2020/03/bvh-retargeter.html?m=1

Or using animaide

https://github.com/aresdevo/animaide

Hope it helps

Os. Lol, at the end i gave 4 "trick" 🤣

carlosedubarreto avatar Jun 16 '21 09:06 carlosedubarreto

The code that generates fbx is fbx_output.py, isn't this defined in the code? I thought that modifying the code can change the pose of the model. Thanks!

On 06/16/2021 17:24,Carlos @.***> wrote:

@liuhaorandezhanghao , you do 2 tricks to solve the problem.

Go to edit pose and get the root bone, remove all the Keyframes on it and insert one keyframe at the begging, rotating the root bone to the expected position.

Another truck would be export it as bvh and when importing, choose the axis to the way that brings the model correctly.

Another way would be using bvh retargetter http://diffeomorphic.blogspot.com/2020/03/bvh-retargeter.html?m=1

Or using animaide

https://github.com/aresdevo/animaide

Hope it helps

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

liuhaorandezhanghao avatar Jun 16 '21 09:06 liuhaorandezhanghao

he code that generates fbx is fbx_output.py, isn't this defined in the code? I thought that modifying the code can change the pose of the model. Thanks!

To be honest, I couldnt understand the code. I guess you can search for parameters in the pkl file that could bring the hips movement, I just dont know which parameter you will need and how to apply them.

carlosedubarreto avatar Jun 16 '21 13:06 carlosedubarreto

@liuhaorandezhanghao

look at this link https://github.com/mkocabas/VIBE/blob/master/doc/demo.md#output-format

carlosedubarreto avatar Jun 16 '21 13:06 carlosedubarreto

Hello, in my fbx output, the character model is always lying on the ground, that is, it is rotated 90 degrees downwards. Where can I change this code?

You can adjust the rotation of the model to suit your needs: https://github.com/mkocabas/VIBE/blob/c0c3f77d587351c806e901221a9dc05d1ffade4b/lib/utils/fbx_output.py#L138-L146

e.g.:

bone_rotation = Matrix(mat_rot).to_quaternion()
quat_y_180_cw = Quaternion((0.0, 1.0, 0.0), radians(-180))
quat_z_180_cw = Quaternion((0.0, 0.0, 1.0), radians(-180))

if index == 0:
    bone.rotation_quaternion = (quat_y_180_cw @ quat_z_180_cw) @ bone_rotation
else:
    bone.rotation_quaternion = bone_rotation

a-svyrydenko avatar Jun 25 '21 16:06 a-svyrydenko

我想我看到了问题所在。当您在视频中有很多人时,可能默认的人 ID (1) 将不可用。 因此,您必须使用 --person_id 参数并尝试其他 ID,例如 2、3、4。

我过去也遇到过这样的问题。

Hello, I used fbx_output.py, but I found that only the pose is used in the code, that is, the pose of each frame is added to the smpl model, and the camera parameters are not used, resulting in the output of the fbx animation character (0,0,0) is the center, it doesn't move left and right, how to solve this problem? Thank you

liuhaorandezhanghao avatar Jul 22 '21 11:07 liuhaorandezhanghao

你好,在我的fbx输出中,人物模型总是趴在地上,也就是向下旋转90度。我在哪里可以更改此代码?

您可以调整模型的旋转以满足您的需要: https://github.com/mkocabas/VIBE/blob/c0c3f77d587351c806e901221a9dc05d1ffade4b/lib/utils/fbx_output.py#L138-L146

例如:

骨骼旋转 = 矩阵(mat_rot)。to_quaternion()
 quat_y_180_cw  = 四元数((0.0,1.0,0.0),弧度(- 180))
 quat_z_180_cw  = 四元数((0.0,0.0,1.0),弧度(- 180))

如果 索引 ==  0:
    骨骼。rotation_quaternion  = ( quat_y_180_cw @ quat_z_180_cw ) @bone_rotation 
else :
    骨骼。旋转四元数 = 骨骼旋转

Hello, I used your fbx_output.py, but I found that only the pose is used in the code, that is, the pose of each frame is added to the smpl model, and the camera parameters are not used, resulting in the output of the fbx animation character (0,0,0) is the center, it doesn't move left and right, how to solve this problem? Thank you

liuhaorandezhanghao avatar Jul 22 '21 11:07 liuhaorandezhanghao

@liuhaorandezhanghao did u manage to incorporate the camera parameters so that the character isn't anchored on the mid point anymore?

rlleshi avatar Mar 08 '22 10:03 rlleshi

@carlosedubarreto fbx_output.py will get error, do you know how to solve it?

Exception ignored in: <function CyclesRender.__del__ at 0x7fdf440cf680>
Traceback (most recent call last):
  File "/home/miniconda3/envs/vibe/lib/python3.7/site-packages/2.91/scripts/addons/cycles/__init__.py", line 67, in __del__
TypeError: 'NoneType' object is not callable
Segmentation fault

akk-123 avatar Apr 09 '22 02:04 akk-123

@carlosedubarreto fbx_output.py will get error, do you know how to solve it?

Exception ignored in: <function CyclesRender.__del__ at 0x7fdf440cf680>
Traceback (most recent call last):
  File "/home/miniconda3/envs/vibe/lib/python3.7/site-packages/2.91/scripts/addons/cycles/__init__.py", line 67, in __del__
TypeError: 'NoneType' object is not callable
Segmentation fault

I dont remember exactly but I think I used it with blender 2.79 and worked without a problem. But there is an easier alternative. You could try an addon I did for blender , its free.

https://carlosedubarreto.gumroad.com/l/mocap_import

carlosedubarreto avatar Apr 09 '22 06:04 carlosedubarreto

@akk-123 I have the same question, have you soloved it?

JACKYLUO1991 avatar Jun 20 '22 06:06 JACKYLUO1991

@akk-123 I have the same question, have you soloved it? 我不用英语回你了 ,你问题是啥?不能用bpy还是人物角度有问题?

liuhaorandezhanghao avatar Jun 20 '22 06:06 liuhaorandezhanghao

@liuhaorandezhanghao Exception ignored in: <function CyclesRender.del at 0x7fdf440cf680> Traceback (most recent call last): File "/home/miniconda3/envs/vibe/lib/python3.7/site-packages/2.91/scripts/addons/cycles/init.py", line 67, in del TypeError: 'NoneType' object is not callable Segmentation fault

也是这个问题,并且貌似导出的fbx中是静止人物。

JACKYLUO1991 avatar Jun 20 '22 06:06 JACKYLUO1991

@liuhaorandezhanghao Exception ignored in: <function CyclesRender.del at 0x7fdf440cf680> Traceback (most recent call last): File "/home/miniconda3/envs/vibe/lib/python3.7/site-packages/2.91/scripts/addons/cycles/init.py", line 67, in del TypeError: 'NoneType' object is not callable Segmentation fault

也是这个问题,并且貌似导出的fbx中是静止人物。

你下载了blender 然后在终端启动blender的python的吗?这个步骤是通的

liuhaorandezhanghao avatar Jun 20 '22 06:06 liuhaorandezhanghao

@liuhaorandezhanghao 我是在ubuntu上下载blender2.91.0,然后基于此环境转换fbx的。转换中没有出现问题,就是最后部分显示”TypeError: 'NoneType' object is not callable Segmentation fault”的问题,再就是人物一致静止状态。

JACKYLUO1991 avatar Jun 20 '22 06:06 JACKYLUO1991

@liuhaorandezhanghao 我是在ubuntu上下载blender2.91.0,然后基于此环境转换fbx的。转换中没有出现问题,就是最后部分显示”TypeError: 'NoneType' object is not callable Segmentation fault”的问题,再就是人物一致静止状态。

你有打印一下转换的数据吗?会不会每一帧的旋转或者位置数据都是0,确定都成功了吗?

liuhaorandezhanghao avatar Jun 20 '22 07:06 liuhaorandezhanghao

@liuhaorandezhanghao 转换是成功的,但是就是会出现最后Exception ignored in: <function CyclesRender.del at 0x7fcbd5de0950> Traceback (most recent call last): File "/root/anaconda3/envs/alphamocap/lib/python3.7/site-packages/2.91/scripts/addons/cycles/init.py", line 67, in del TypeError: 'NoneType' object is not callable 的问题

JACKYLUO1991 avatar Jul 06 '22 05:07 JACKYLUO1991