-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function optimizer.computeMarginals() #70
Comments
Hi, the function computeMarginals() returns the Hessian matrix associated to the state vertex(0), you have to invert it to get the covariance. |
1)thanks @ferreram for the reply, I tried writing this code: But the matrix seems to be incorrect (values too high?) Did I miss something in the code? 2)This covariance matrix refer only to the last pose, or to the full trajectory? |
1) Well, the values of the Hessian matrix come from this expression: J' W
J, where J is the Jacobian of your optimization problem and W the
information matrix (the inverse of the covariances given to each
measurements).
The resulting Hessian matrix hence depends on the optimization problem you
have defined. The fact that you get high values for the state vertex(0)
means that you have a high confidence in the estimated parameters (if you
invert this Hessian matrix you will get the covariance matrix associated to
the estimated state).
2) I think that in g2o, the computeMarginals() function simply provides the
block in the Hessian matrix associated to the state you require (but I
don't remember well, you should check that). If it is indeed done like
this, then the matrix that you get correspond to the confidence you have in
vertex(0) according to the optimization problem you have defined. Hence,
if you have performed a Global Bundle Adjustment like optimization, the
matrix you have obtained correspond to the information matrix related to
the states vertex(0) over the full trajectory.
…On Fri, Oct 4, 2019 at 1:09 PM Andrea485 ***@***.***> wrote:
1)thanks for the reply, I tried writing this code:
g2o::SparseBlockMatrixXd spinv; optimizer.computeMarginals(spinv,
optimizer.vertex(0)); Eigen::Matrix<double, 6, 6> margCovInv =
Eigen::Matrix<double, 6, 6>::Zero(); margCovInv.topLeftCorner(6,6) =
spinv.block(0, 0)->inverse(); cout<<"Matrix
covariance:\n"<<margCovInv<<endl;
But the matrix seems to be incorrect (values too high?)
[image: Schermata del 2019-10-04 13-04-30]
<https://user-images.githubusercontent.com/7497813/66203033-8cf05b80-e6a7-11e9-87b0-2cb1d64bc863.png>
Did I miss something in the code?
2)This covariance matrix refer only to the last post, or to the full
trajectory?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#70?email_source=notifications&email_token=AEPCATTTSXXLCYP3QT6GOJDQM4P5TA5CNFSM4I5MM4W2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEALKDTA#issuecomment-538354124>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEPCATQGVWUGA43RXUZTKBTQM4P5TANCNFSM4I5MM4WQ>
.
|
hi @ferreram , the matrix of @Andrea485's figure represent covariance not hessian, but is the pose coordinate uncertainty in meters? |
Hi @arianna003 , yes you're right, my bad I read it too fast. In this case @Andrea485 , the uncertainty values of your covariance matrix indeed seems very high. The uncertainty around the translation parts of the matrix are in squared meters if the transnational parts of the states are expressed in meters (it should be the case with a Visual-Inertial method but not with a monocular SLAM) |
@ferreram what's wrong in my code, what can I do? |
@Andrea485 , there is nothing wrong in the code you have used to compute the covariance matrix. But what are you doing? VI-Odometry? If so, is the Bundle Adjustment like optimization is giving you good results? You can also have a look at the information you are setting for your edges. As the Hessian matrix is derived from the Jacobian and the information matrix, high covariances will come from high Jacobians value. Maybe you should verify your Jacobian as well (you can test doing automatic differentiation). |
@Andrea485 I got the same problem, the value of covariance matrix is too high?what wrong with it? |
hi, the result of the optimizer.computeMarginals(), is the covariance matrix about the estimated pose?
LearnVIORB/src/Optimizer.cc
Line 3745 in b9e73ce
The text was updated successfully, but these errors were encountered: