vchoutas / smplify-x

Expressive Body Capture: 3D Hands, Face, and Body from a Single Image
https://smpl-x.is.tue.mpg.de/
Other
1.77k stars 340 forks source link

RuntimeError: Subtraction, the `-` operator, with a bool tensor is not supported #39

Closed meetwhom closed 5 years ago

meetwhom commented 5 years ago

With GTX1080Ti GPU and right env setup, I tried several times to run the demo but failed. In case I misuse the wrong input image ,I use the 1st image appear in the paper, but I still get the same error:

(cp36) sam@sam-HP-Z620-Workstation:/home/sdb/ab/MPI_SMPL/smplify-x$ python smplifyx/main.py --config cfg_files/fit_smplx.yaml --data_folder input --output_folder output --visualize="False" --model_folder models --vposer_ckpt vposer_v1_0 --part_segm_fn smplx_parts_segm.pkl --use_cuda=False --interpenetration=False Processing: input/images/1.png Found Trained Model: vposer_v1_0/snapshots/TR00_E096.pt Traceback (most recent call last): File "smplifyx/main.py", line 272, in main(args) File "smplifyx/main.py", line 262, in main args) File "/home/sdb/ab/MPI_SMPL/smplify-x/smplifyx/fit_single_frame.py", line 274, in fit_single_frame focal_length=focal_length, dtype=dtype) File "/home/sam/miniconda3/envs/cp36/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 49, in decorate_no_grad return func(*args, *kwargs) File "/home/sdb/ab/MPI_SMPL/smplify-x/smplifyx/fitting.py", line 75, in guess_init pose_embedding, output_type='aa').view(1, -1) if use_vposer else None File "vposer_v1_0/vposer_smpl.py", line 114, in decode if output_type == 'aa': return VPoser.matrot2aa(Xout) File "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/sam/miniconda3/envs/cp36/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/sam/miniconda3/envs/cp36/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/sam/miniconda3/envs/cp36/lib/python3.6/site-packages/torch/tensor.py", line 325, 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 bitwise_not() operator instead.


It seems some internal calculation problem, but I do not have time to check the code details. Can someone help me? Thanks.

// Sorry I haven't got the redistribution permission of the image in the paper, it has to be removed. So I only put the keypoints result here.

OpenPose keypoint json file content: {"version":1.3,"people":[{"person_id":[-1],"pose_keypoints_2d":[97.9395,59.9321,0.94477,94.6404,121.035,0.904376,48.3801,121.08,0.883265,48.3408,200.294,0.802151,21.9325,269.598,0.842027,139.198,119.412,0.844284,139.249,213.469,0.923468,111.101,160.707,0.907425,73.1316,277.938,0.723224,45.0834,276.284,0.706072,64.8885,403.368,0.796988,81.3546,522.287,0.655121,99.6243,279.561,0.707398,94.5705,398.47,0.805579,112.759,523.927,0.633479,86.4163,48.352,0.959138,109.468,48.3612,0.94057,71.5461,53.3043,0.952888,124.298,53.3778,0.936655,71.5543,545.399,0.102387,79.7951,542.131,0.158925,124.321,537.148,0.508061,33.5219,550.336,0.620125,35.1681,543.788,0.562077,88.0524,538.827,0.25901],"face_keypoints_2d":[72.6313,47.1096,0.759064,73.4384,53.8361,0.793032,75.3219,60.2935,0.799174,76.9362,67.02,0.799732,78.8196,73.7465,0.813515,80.9721,80.2039,0.865062,84.2008,86.1232,0.826529,89.3129,90.6972,0.846112,95.5013,92.5806,0.856205,102.497,90.9662,0.858706,107.609,86.6613,0.850709,112.183,80.742,0.835608,115.412,74.5536,0.835211,117.564,67.5581,0.872575,118.909,60.5626,0.846016,120.524,53.567,0.808359,121.062,46.5715,0.712315,77.4743,45.2262,0.836439,80.9721,43.0737,0.908461,85.008,42.2666,0.90444,89.3129,43.0737,0.925983,93.0797,44.419,0.837476,101.421,44.9572,0.852778,105.456,43.0737,0.900674,109.761,42.2666,0.861295,114.066,43.0737,0.856579,117.564,45.4953,0.85144,97.3847,49.2621,0.8834,97.6537,53.8361,0.9431,97.3847,58.6792,0.939789,97.6537,63.2532,0.902095,92.8107,66.4819,0.850246,94.9632,67.02,0.910726,97.3847,67.8272,0.894393,99.8062,67.289,0.909263,101.69,66.7509,0.895275,82.0483,48.993,0.910519,85.008,47.3787,0.934796,88.5057,47.3787,0.895105,91.4654,49.8002,0.882799,88.2367,50.8765,0.871825,84.7389,50.8765,0.924408,103.304,50.0693,0.892791,106.533,47.6477,0.907411,110.03,47.3787,0.921187,112.99,49.2621,0.940145,110.3,50.8765,0.908453,106.802,50.8765,0.92475,87.6986,73.4774,0.928661,91.1963,71.863,0.882647,94.425,71.3249,0.925195,97.1156,71.863,0.918953,99.8062,71.3249,0.925565,102.766,72.1321,0.964395,105.456,73.7465,0.89528,103.035,79.1276,0.883822,99.5372,81.8182,0.904576,96.3084,82.3563,0.984643,93.6179,81.8182,0.940493,89.851,78.8586,0.91854,89.0439,73.7465,0.95698,94.425,73.4774,0.896883,97.1156,73.4774,0.898466,99.8062,73.4774,0.893764,104.38,74.2846,0.935939,99.5372,78.0514,0.902504,96.5775,78.5895,0.897735,93.8869,78.0514,0.961007,86.6223,48.4549,0.811237,108.147,48.4549,0.846577],"hand_left_keypoints_2d":[103.882,156.753,0.540482,96.9814,150.197,0.242396,84.5597,139.156,0.31344,78.694,133.98,0.645887,76.6237,132.6,0.593826,101.122,128.804,0.466691,101.467,119.143,0.862446,102.502,111.897,0.864072,104.572,105.341,0.856388,106.988,131.564,0.760933,95.6012,129.494,0.845451,87.3201,132.6,0.770535,83.1796,137.775,0.730734,110.093,136.74,0.862037,97.3265,137.775,0.950933,90.4255,142.261,0.686533,85.2498,146.056,0.620184,111.818,142.261,0.794224,102.847,143.296,0.738635,96.9814,145.021,0.708584,94.2211,146.402,0.715982],"hand_right_keypoints_2d":[26.2168,275.841,0.0558444,25.3099,267.982,0.175173,23.7984,265.563,0.300864,24.1007,268.284,0.53134,22.8915,277.958,0.377694,13.5201,283.097,0.850246,22.5892,286.724,0.679191,28.9375,288.538,0.801663,35.5882,291.259,0.797258,12.9155,288.84,0.742155,22.8915,293.073,0.668555,31.0536,294.282,0.747965,36.4951,295.793,0.518082,14.7293,292.77,0.584971,22.5892,297.91,0.607702,29.8444,298.816,0.578564,36.7974,298.212,0.579198,18.0546,295.189,0.430246,22.5892,300.63,0.741699,28.3329,302.444,0.808895,33.7744,303.956,0.835708],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}

meetwhom commented 5 years ago

Problem solved, I downgrade the torch version to 1.1.0, then the demo is ok.

PixelPartner commented 5 years ago

As I cannot find a 1.1.0 for my current win64 environment, please consider a fix.

Elody-07 commented 4 years ago

As I cannot find a 1.1.0 for my current win64 environment, please consider a fix.

This is an error from torchgeometry library. My fix is to clone the torchgeometry repo and modify the code, then build the library.