caizhongang / SMPLer-X

Official Code for "SMPLer-X: Scaling Up Expressive Human Pose and Shape Estimation"
https://caizhongang.github.io/projects/SMPLer-X/
Other
1.01k stars 73 forks source link

版本问题 #69

Closed xion-cyber closed 3 weeks ago

xion-cyber commented 4 months ago

作者你好, 我在使用inference.py进行推理时遇到了很多关于版本的问题。 比如numpy版本过高会不支持bool类型,yapf版本过高会在FormatCode()中报错:TypeError: FormatCode() got an unexpected keyword argument ‘verify‘,pytorch我使用的1.12,但是在torchgeometry/core/conversions.py中会对mask进行一个反转操作,但是这个版本的pytorch不再支持这种bool类型的1-mask的操作,而是使用~mask来进行反转操作。 所以,作者您能提供完整的版本信息吗,不然一步一步找错太累了…… Thank you~

Traceback (most recent call last): File "/PaperCode/SMPLer-X/main/inference.py", line 135, in main out = demoer.model(inputs, targets, meta_info, 'test') File "/home/yeyiqi/.conda/envs/smplerx/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, kwargs) File "/home/yeyiqi/.conda/envs/smplerx/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 166, in forward return self.module(*inputs[0], *kwargs[0]) File "/home/yeyiqi/.conda/envs/smplerx/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(input, kwargs) File "/PaperCode/SMPLer-X/main/SMPLer_X.py", line 179, in forward root_pose = rot6d_to_axis_angle(root_pose) File "/PaperCode/SMPLer-X/common/utils/transforms.py", line 84, in rot6d_to_axis_angle axis_angle = tgm.rotation_matrix_to_angle_axis(rot_mat).reshape(-1, 3) # axis-angle File "/home/yeyiqi/.conda/envs/smplerx/lib/python3.8/site-packages/torchgeometry/core/conversions.py", line 233, in rotation_matrix_to_angle_axis quaternion = rotation_matrix_to_quaternion(rotation_matrix) File "/home/yeyiqi/.conda/envs/smplerx/lib/python3.8/site-packages/torchgeometry/core/conversions.py", line 302, in rotation_matrix_to_quaternion mask_c1 = mask_d2 (1 - mask_d0_d1) File "/home/yeyiqi/.conda/envs/smplerx/lib/python3.8/site-packages/torch/_tensor.py", line 32, in wrapped return f(args, **kwargs) File "/home/yeyiqi/.conda/envs/smplerx/lib/python3.8/site-packages/torch/_tensor.py", line 639, in rsub return _C._VariableFunctions.rsub(self, other) RuntimeError: Subtraction, the - operator, with a bool tensor is not supported. If you are trying to invert a mask, use the ~ or logical_not() operator instead.

chuxiang93 commented 2 months ago

遇到完全一样的问题,前面的版本问题一个一个解决了,卡在了反转操作这。楼主有解决方案吗?

xion-cyber commented 2 months ago

遇到完全一样的问题,前面的版本问题一个一个解决了,卡在了反转操作这。楼主有解决方案吗?

版本问题可以通过搜索报错信息降低版本解决,然后应该是pytorch2.0之后不再支持bool类型的反转操作~了。然后需要你在torchgeometry/core/conversions.py这个文件中手动将mask矩阵的反转操作 ~ 改成 1-mask,之后估计就不会报这个错误了。

wenbc21 commented 2 months ago

遇到完全一样的问题,前面的版本问题一个一个解决了,卡在了反转操作这。楼主有解决方案吗?

版本问题可以通过搜索报错信息降低版本解决,然后应该是pytorch2.0之后不再支持bool类型的反转操作~了。然后需要你在torchgeometry/core/conversions.py这个文件中手动将mask矩阵的反转操作 ~ 改成 1-mask,之后估计就不会报这个错误了。

  1. 要指定yapf==0.40.1
  2. 应该是把1-mask改成~mask