Closed Cursky closed 3 months ago
def normalize_and_concat(glb_acc, glb_rot): glb_acc = glb_acc.view(-1, 6, 3) glb_rot = glb_rot.view(-1, 6, 3, 3) print('glbacc glbrot shape',glb_acc.shape, glb_rot.shape) print('glbacc - glbacc :',glb_acc[:, :5] - glb_acc[:, 5:]) print('glbacc - glbacc shape:',(glb_acc[:, :5] - glb_acc[:, 5:]).shape) print('cat',torch.cat((glb_acc[:, :5] - glb_acc[:, 5:], glb_acc[:, 5:]), dim=1)) print('cat shape:',torch.cat((glb_acc[:, :5] - glb_acc[:, 5:], glb_acc[:, 5:]), dim=1).shape) print('glb_rot:',glb_rot[:, -1]) print('glb_rotshape',glb_rot[:, -1].shape) acc = torch.cat((glb_acc[:, :5] - glb_acc[:, 5:], glb_acc[:, 5:]), dim=1).bmm(glb_rot[:, -1]) ori = torch.cat((glb_rot[:, 5:].transpose(2, 3).matmul(glb_rot[:, :5]), glb_rot[:, 5:]), dim=1) data = torch.cat((acc.flatten(1), ori.flatten(1)), dim=1) return data
just: glb_acc = glb_acc.float() # 转换为float glb_rot = glb_rot.float() # 转换为float can fix this error
Please help the author. I want to know what the normalization in utils does. I get an error here when using my own imu data. I found that my shape is exactly the same as dip imu, but I encounter a problem at this position. I hope someone who has encountered this problem can discuss it with me. error: Traceback (most recent call last): File "d:\pip_package\PIP-main\evaluate.py", line 215, in
evaluate(net, paths.dipimu_dir, pose_evaluator=reduced_pose_evaluator, evaluate_pose=False, evaluate_zmp=False, flush_cache=True)
File "d:\pip_package\PIP-main\evaluate.py", line 148, in evaluate
run_pipeline(net, data_dir, missing_ids)
File "d:\pip_package\PIP-main\evaluate.py", line 120, in run_pipeline
result_net = net.predict(accs[i], rots[i], init_poses[i])
File "C:\Users\godof\anaconda3\envs\pipenv\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
File "d:\pip_package\PIP-main\net.py", line 99, in predict
x = (normalize_and_concat(glb_acc, glb_rot), lj_init, jvel_init)
File "d:\pip_package\PIP-main\utils.py", line 77, in normalize_and_concat
acc = torch.cat((glb_acc[:, :5] - glb_acc[:, 5:], glb_acc[:, 5:]), dim=1).bmm(glb_rot[:, -1])
RuntimeError: expected scalar type Double but found Float
def normalize_and_concat(glb_acc, glb_rot): glb_acc = glb_acc.view(-1, 6, 3) glb_rot = glb_rot.view(-1, 6, 3, 3) print('glbacc glbrot shape',glb_acc.shape, glb_rot.shape) print('glbacc - glbacc :',glb_acc[:, :5] - glb_acc[:, 5:]) print('glbacc - glbacc shape:',(glb_acc[:, :5] - glb_acc[:, 5:]).shape) print('cat',torch.cat((glb_acc[:, :5] - glb_acc[:, 5:], glb_acc[:, 5:]), dim=1)) print('cat shape:',torch.cat((glb_acc[:, :5] - glb_acc[:, 5:], glb_acc[:, 5:]), dim=1).shape) print('glb_rot:',glb_rot[:, -1]) print('glb_rotshape',glb_rot[:, -1].shape) acc = torch.cat((glb_acc[:, :5] - glb_acc[:, 5:], glb_acc[:, 5:]), dim=1).bmm(glb_rot[:, -1]) ori = torch.cat((glb_rot[:, 5:].transpose(2, 3).matmul(glb_rot[:, :5]), glb_rot[:, 5:]), dim=1) data = torch.cat((acc.flatten(1), ori.flatten(1)), dim=1) return data
Successful cases: glb_acc shape: torch.Size([5597, 6, 3]) glb_rot shape: torch.Size([5597, 6, 3, 3]) glbacc glbrot shape torch.Size([5597, 6, 3]) torch.Size([5597, 6, 3, 3]) glbacc - glbacc : tensor([[[ 0.1716, -0.0427, 0.0123], [ 0.1127, 0.0363, -0.0605], [ 0.1442, -0.0574, -0.0261], [ 0.2186, -0.0153, 0.0402], [ 0.1563, -0.0633, 0.0527]],
glbacc - glbacc shape: torch.Size([5597, 5, 3]) cat tensor([[[ 0.1716, -0.0427, 0.0123], [ 0.1127, 0.0363, -0.0605], [ 0.1442, -0.0574, -0.0261], [ 0.2186, -0.0153, 0.0402], [ 0.1563, -0.0633, 0.0527], [ -0.0466, -0.0131, -0.0218]],
cat shape: torch.Size([5597, 6, 3]) glb_rot: tensor([[[ 0.9999, -0.0115, 0.0024], [ 0.0115, 0.9999, 0.0090], [-0.0025, -0.0089, 1.0000]],
glb_rotshape torch.Size([5597, 3, 3]
Error running case: glb_acc shape: torch.Size([4000, 6, 3]) glb_rot shape: torch.Size([4000, 6, 3, 3]) glbacc glbrot shape torch.Size([4000, 6, 3]) torch.Size([4000, 6, 3, 3]) glbacc - glbacc : tensor([[[-0.8113, -1.5080, -2.9102], [ 0.3013, 2.4700, 0.4967], [ 2.5531, 1.2118, -1.6512], [ 0.8056, 0.4869, -1.0739], [-1.2351, 0.1362, -0.9225]],
glbacc - glbacc shape: torch.Size([4000, 5, 3]) cat tensor([[[-0.8113, -1.5080, -2.9102], [ 0.3013, 2.4700, 0.4967], [ 2.5531, 1.2118, -1.6512], [ 0.8056, 0.4869, -1.0739], [-1.2351, 0.1362, -0.9225], [ 0.3097, 0.8494, 0.7879]],
cat shape: torch.Size([4000, 6, 3]) glb_rot: tensor([[[ 0.1554, -0.1249, 0.9799], [ 0.9853, 0.0903, -0.1448], [-0.0704, 0.9881, 0.1371]],
glb_rotshape torch.Size([4000, 3, 3]) 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "d:\pip_package\PIP-main\evaluate.py", line 215, in
evaluate(net, paths.dipimu_dir, pose_evaluator=reduced_pose_evaluator, evaluate_pose=False, evaluate_zmp=False, flush_cache=True)
File "d:\pip_package\PIP-main\evaluate.py", line 148, in evaluate
run_pipeline(net, data_dir, missing_ids)
File "d:\pip_package\PIP-main\evaluate.py", line 120, in run_pipeline
result_net = net.predict(accs[i], rots[i], init_poses[i])
File "C:\Users\godof\anaconda3\envs\pipenv\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
File "d:\pip_package\PIP-main\net.py", line 99, in predict
x = (normalize_and_concat(glb_acc, glb_rot), lj_init, jvel_init)
File "d:\pip_package\PIP-main\utils.py", line 77, in normalize_and_concat
acc = torch.cat((glb_acc[:, :5] - glb_acc[:, 5:], glb_acc[:, 5:]), dim=1).bmm(glb_rot[:, -1])
RuntimeError: expected scalar type Double but found Float