RainerKuemmerle / g2o

g2o: A General Framework for Graph Optimization
3.06k stars 1.1k forks source link

How to add weights for multi-constraints pose estimation #410

Open LounesDev opened 4 years ago

LounesDev commented 4 years ago

Hello,

I am dealing with a pose estimation problem solved by Levenberg-Marquardt. I tried to integrate an hybrid residual but I cannot find a proper way to weight my constraints. I have a problem like this : Residual = alpha Residual1 + beta Residual2 (with alpha, beta constraint's weights) How can I integrate these weights ? Do I just have to multiply each error with the weight in the computeError() function ?

Regards,

sjulier commented 4 years ago

Is residual the error term or the squared error term?

LounesDev commented 4 years ago

The squared error term.

sjulier commented 4 years ago

Okay... So as I understand it, Residual1 = e1^2 Residual2 = e2^2

where e1 and e2 are errors.

In terms of just getting the squared error terms out, I think there are two ways you could do it:

  1. Redefine your error vector so it has the form [e1;e2]. The information matrix would then be block diagonal with [alpha*sigma1;0;0;beta*sigma2] where sigma1 and sigma2 are the information matrices associated with each term.
  2. Create two separate edges, one for the Residual1 and the other for Residual2. When the objective function is assembled, it would use the weighted residuals

However, are you looking at something more like a mixture model (e.g.,https://april.eecs.umich.edu/pdfs/olson2012rss.pdf)?

songming1995 commented 3 years ago

You can rewrite the residuals to make them be likelihood of the potential matches. In this way, you can sum them up without considering the weighting issue.