papagina / RotationContinuity

Coder for "On the Continuity of Rotation Representations"
MIT License
328 stars 54 forks source link

About the Geodesic Distance between Rotation Matrices #1

Closed ismarou closed 5 years ago

ismarou commented 5 years ago

Hi! First of all, allow me to congratulate you on the paper. It's one of the best established and most innovative works I have read in the past months! I would like to ask 2 quick questions about the Geodesic Loss function that you are using,if that's convenient:

  1. Why do you constrain the input of torch.arcos between -1 and 1 by hand? Isn't it supposed to lie in that interval anyway? I mean, de facto the trace can't be bigger than 3,for example, because RgtRred^t belongs in SO(3),right? Did you notice it to be arithmetically unstable?

  2. Did you have any problems training any of the Architectures that you used with this loss function? I'm trying to do the same in an Object Pose Estimation problem but the network doesn't learn much both with old the representations and yours. Did you, by any mean, notice any Vanishing Gradient problem using it e.g.?

papagina commented 5 years ago

Hi, thank you for liking our paper!

  1. Because of numerical errors, occasionally the input can be slightly larger or smaller than 1 and -1, in that case, torch.acos will return nan.
  2. When we did this test, we wanted the scenario to be simple without too much disturbance from other problems, so we only trained and tested on one class of objects. We didn't observe vanishing gradient problems in the three tests in our paper. Have you also tried to use the L2 loss instead? L2 loss and geodesic loss had similar performance in our tests, but maybe they will be different in your case
ismarou commented 5 years ago

Wow! That's a quick response! Thank you!

2.You mean the L2 Loss between the output parameters of the Rotation Matrix (i.e. the Frobenius norm)? I have used the L2 Loss between the parameters and my results were meh as the angle errors were significant, so I thought of using that Geodesic distance because of its better geometric interpretation but the network doesn't learn any Rotation at all :(

papagina commented 5 years ago

Yes, the L2 loss between rotation matrices. Maybe it's because of some other problems that lead to the big errors in your network.

ismarou commented 5 years ago

Hmmm, I don't really like it as it doesn't encapsulate the SO(3) manifold Geometry but I guess I have no other choice than to try it. One last notice, in your comments you are stating that that torch.acos returns values from 0 to 180 degrees while in the Pytorch one it says from 0 to pi rad.

papagina commented 5 years ago

Oh sorry for that. I haven't cleaned the comments in this temporally repository.

ismarou commented 5 years ago

It's ok :) It's not profound so I mentioned it so that you could fix it. Anyway, thanks for your help! Very much appreciated :)