(Rgts, Rps)
| 44 | |
| 45 | |
| 46 | def bgdR(Rgts, Rps): |
| 47 | Rds = torch.bmm(Rgts.permute(0, 2, 1), Rps) |
| 48 | Rt = torch.sum(Rds[:, torch.eye(3).bool()], 1) #batch trace |
| 49 | # necessary or it might lead to nans and the likes |
| 50 | theta = torch.clamp(0.5 * (Rt - 1), -1 + 1e-6, 1 - 1e-6) |
| 51 | # print("\033[33m the theta in bgdR is", theta,"\033[0m") |
| 52 | return torch.acos(theta) |
| 53 | |
| 54 | def get_6d_rot_loss(gt_6d, pred_6d): |
| 55 | #input pred_6d , gt_6d : batch * 2 * 3 |