RuntimeError: Subtraction, the `-` operator, with a bool tensor is not supported
RuntimeError: Subtraction, the `-` operator, with a bool tensor is not supported
我正在使用这个 github 存储库:https://github.com/vchoutas/smplify-x 我是 运行 一个脚本。我收到以下错误。我该如何解决?我知道我可能必须将 -
转换为 ~
但不确定它到底在哪里。我不想降级我的 PyTorch。
$ cat fit.sh
export CUDA_VISIBLE_DEVICES=0
python smplifyx/main.py --config cfg_files/fit_smplx.yaml --data_folder ../../data/smplify-x/DATA_FOLDER --output_folder ../../data/smplify-x/RESULTS --visualize="False" --model_folder ../../data/smplify-x/models_smplx_v1_1/models/smplx/SMPLX_NEUTRAL.npz --vposer_ckpt ../../data/smplify-x/vposer_v1_0 --part_segm_fn ../../data/smplify-x/smplx_parts_segm.pkl
--------------------------------------
(smplifyx) mona@ubuntu:~/mona/code/smplify-x$ ./fit.sh
Processing: ../../data/smplify-x/DATA_FOLDER/images/woman_bike.jpg
Found Trained Model: ../../data/smplify-x/vposer_v1_0/snapshots/TR00_E096.pt
Traceback (most recent call last):
File "smplifyx/main.py", line 272, in <module>
main(**args)
File "smplifyx/main.py", line 262, in main
**args)
File "~/mona/code/smplify-x/smplifyx/fit_single_frame.py", line 274, in fit_single_frame
focal_length=focal_length, dtype=dtype)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "~/mona/code/smplify-x/smplifyx/fitting.py", line 75, in guess_init
pose_embedding, output_type='aa').view(1, -1) if use_vposer else None
File "../../data/smplify-x/vposer_v1_0/vposer_smpl.py", line 114, in decode
if output_type == 'aa': return VPoser.matrot2aa(Xout)
File "../../data/smplify-x/vposer_v1_0/vposer_smpl.py", line 152, in matrot2aa
pose = tgm.rotation_matrix_to_angle_axis(homogen_matrot).view(batch_size, 1, -1, 3).contiguous()
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/torchgeometry/core/conversions.py", line 233, in rotation_matrix_to_angle_axis
quaternion = rotation_matrix_to_quaternion(rotation_matrix)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/torchgeometry/core/conversions.py", line 302, in rotation_matrix_to_quaternion
mask_c1 = mask_d2 * (1 - mask_d0_d1)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/tensor.py", line 511, 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.
我还有:
(smplifyx) mona@ubuntu:~/mona/code/smplify-x$ python
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.7.1'
>>> import torchgeometry
>>> torchgeometry.__version__
'0.1.2'
$ vi /home/mona/venv/smplifyx/lib/python3.6/site-packages/torchgeometry/core/conversions.py
并为 PyTorch 1.7.1 中的掩码转换兼容性类似地注释和添加行
mask_c0 = mask_d2 * mask_d0_d1
#mask_c1 = mask_d2 * (1 - mask_d0_d1)
mask_c1 = mask_d2 * ~(mask_d0_d1)
#mask_c2 = (1 - mask_d2) * mask_d0_nd1
mask_c2 = ~(mask_d2) * mask_d0_nd1
#mask_c3 = (1 - mask_d2) * (1 - mask_d0_nd1)
我正在使用这个 github 存储库:https://github.com/vchoutas/smplify-x 我是 运行 一个脚本。我收到以下错误。我该如何解决?我知道我可能必须将 -
转换为 ~
但不确定它到底在哪里。我不想降级我的 PyTorch。
$ cat fit.sh
export CUDA_VISIBLE_DEVICES=0
python smplifyx/main.py --config cfg_files/fit_smplx.yaml --data_folder ../../data/smplify-x/DATA_FOLDER --output_folder ../../data/smplify-x/RESULTS --visualize="False" --model_folder ../../data/smplify-x/models_smplx_v1_1/models/smplx/SMPLX_NEUTRAL.npz --vposer_ckpt ../../data/smplify-x/vposer_v1_0 --part_segm_fn ../../data/smplify-x/smplx_parts_segm.pkl
--------------------------------------
(smplifyx) mona@ubuntu:~/mona/code/smplify-x$ ./fit.sh
Processing: ../../data/smplify-x/DATA_FOLDER/images/woman_bike.jpg
Found Trained Model: ../../data/smplify-x/vposer_v1_0/snapshots/TR00_E096.pt
Traceback (most recent call last):
File "smplifyx/main.py", line 272, in <module>
main(**args)
File "smplifyx/main.py", line 262, in main
**args)
File "~/mona/code/smplify-x/smplifyx/fit_single_frame.py", line 274, in fit_single_frame
focal_length=focal_length, dtype=dtype)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "~/mona/code/smplify-x/smplifyx/fitting.py", line 75, in guess_init
pose_embedding, output_type='aa').view(1, -1) if use_vposer else None
File "../../data/smplify-x/vposer_v1_0/vposer_smpl.py", line 114, in decode
if output_type == 'aa': return VPoser.matrot2aa(Xout)
File "../../data/smplify-x/vposer_v1_0/vposer_smpl.py", line 152, in matrot2aa
pose = tgm.rotation_matrix_to_angle_axis(homogen_matrot).view(batch_size, 1, -1, 3).contiguous()
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/torchgeometry/core/conversions.py", line 233, in rotation_matrix_to_angle_axis
quaternion = rotation_matrix_to_quaternion(rotation_matrix)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/torchgeometry/core/conversions.py", line 302, in rotation_matrix_to_quaternion
mask_c1 = mask_d2 * (1 - mask_d0_d1)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/tensor.py", line 511, 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.
我还有:
(smplifyx) mona@ubuntu:~/mona/code/smplify-x$ python
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.7.1'
>>> import torchgeometry
>>> torchgeometry.__version__
'0.1.2'
$ vi /home/mona/venv/smplifyx/lib/python3.6/site-packages/torchgeometry/core/conversions.py
并为 PyTorch 1.7.1 中的掩码转换兼容性类似地注释和添加行
mask_c0 = mask_d2 * mask_d0_d1
#mask_c1 = mask_d2 * (1 - mask_d0_d1)
mask_c1 = mask_d2 * ~(mask_d0_d1)
#mask_c2 = (1 - mask_d2) * mask_d0_nd1
mask_c2 = ~(mask_d2) * mask_d0_nd1
#mask_c3 = (1 - mask_d2) * (1 - mask_d0_nd1)