cvg / pixloc

Back to the Feature: Learning Robust Camera Localization from Pixels to Pose (CVPR 2021)
Apache License 2.0
735 stars 92 forks source link

some questions about your code in base_optimizer.py #46

Open ghoshaw opened 1 year ago

ghoshaw commented 1 year ago

Hi, Thanks for your amazing work. I have some questions about the Levenberg-Marquardt (LM) algorithm. In your code, grad after adding weight is added belong the 3dpoint number axis, I do not understand why and I could not find the corresponding expression in your paper. So can you explain it in detail? Thanks! `

def build_system(self, J: Tensor, res: Tensor, weights: Tensor):
    grad = torch.einsum('...ndi,...nd->...ni', J, res)   # ... x N x 6
    grad = weights[..., None] * grad
    grad = grad.sum(-2)  # ... x 6

    Hess = torch.einsum('...ijk,...ijl->...ikl', J, J)  # ... x N x 6 x 6
    Hess = weights[..., None, None] * Hess
    Hess = Hess.sum(-3)  # ... x 6 x6

    return grad, Hess

`