mkocabas / VIBE

Official implementation of CVPR2020 paper "VIBE: Video Inference for Human Body Pose and Shape Estimation"
https://arxiv.org/abs/1912.05656
Other
2.85k stars 551 forks source link

[BUG] .fbx conversion #173

Open alivemachine opened 3 years ago

alivemachine commented 3 years ago

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

shawkontzu commented 3 years ago

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

carlosedubarreto commented 3 years ago

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.

sumingrui commented 3 years ago

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

Windows or Linux?

liuhaorandezhanghao commented 3 years ago

Hello, how did you install the bpy library

liuhaorandezhanghao commented 3 years ago

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

Windows还是Linux?

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

carlosedubarreto commented 3 years ago

Hello, how did you install the bpy library

You can try these instructions @liuhaorandezhanghao

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

liuhaorandezhanghao commented 3 years ago

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.

carlosedubarreto commented 3 years ago

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

liuhaorandezhanghao commented 3 years ago

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.

carlosedubarreto commented 3 years ago

@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" 🤣

liuhaorandezhanghao commented 3 years ago

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.

carlosedubarreto commented 3 years ago

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 commented 3 years ago

@liuhaorandezhanghao

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

a-svyrydenko commented 3 years ago

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
liuhaorandezhanghao commented 2 years ago

我想我看到了问题所在。当您在视频中有很多人时,可能默认的人 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 commented 2 years ago

你好,在我的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

rlleshi commented 2 years ago

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

akk-123 commented 2 years ago

@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
carlosedubarreto commented 2 years ago

@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

JACKYLUO1991 commented 2 years ago

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

liuhaorandezhanghao commented 2 years ago

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

JACKYLUO1991 commented 2 years ago

@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中是静止人物。

liuhaorandezhanghao commented 2 years ago

@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的吗?这个步骤是通的

JACKYLUO1991 commented 2 years ago

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

liuhaorandezhanghao commented 2 years ago

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

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

JACKYLUO1991 commented 2 years ago

@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 的问题