-
Notifications
You must be signed in to change notification settings - Fork 768
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
GTSAM on benchmark Pose Graph Optimization datasets #248
Comments
Excellent! |
Thanks! Do you mind if I post this on the google group to see if anyone has figured the "right recipe" for those 3 datasets? |
Of course. |
@dellaert Since ceres-solver could optimize these g2o tasks without any problem I think that's could be something wrong with GTSAM (at least slam examples). |
OK, I will re-open. That is worrisome. Are you using the current develop, and a simple Gaussian noise model? |
I used standart datasets and samples. ceres-solver sample: gtsam sample: |
There is a code snippet:
that I lifted from a test somewhere in GTSAM that has worked great on some huge problems for me in the past where I had not previously had any luck. The quite small epsilons are not values I would have picked. (The choice of QR over Cholesky was mine, in response to some numerical trouble). If Lev-Mar was in the mix, the |
Looks like I copied that from one of the BAL timing tests and this SFM PCG example. |
@yetongumich will post some experiments we did shortly. In the meantime: were you able to converge from the pose initialization in the g2o file, or did you use a different initialization method? |
@dellaert I used provided samples and datasets without any modifications. I did not change initialization. @mikesheffler With |
Frank and I have made a Colab script that run the datasets. You can view and run it through this link https://colab.research.google.com/drive/1TvrrEdyLmLFSJmeLiBWFdDiSUvjwETuR |
Thanks. Original gtsam sample did not use intial values from g2o. I did not expect it) gtsam/examples/Pose3SLAMExample_g2o.cpp Line 50 in b6c5bce
I will recalculate datasets tomorrow. |
ceres results: grid3d torus3d parking-garage sphere_bignoise_vertex3 It's not clear for me why initial error is different? |
Yes, and why it is the same for parking-garage... :-/ @yetongumich any ideas?? |
Indeed. I have a suspicion, which is that the issue is with the retract implementation: we use Cayley retract in Rot3, and a decoupled (translation, Rot3::Cayley) retract in Pose3. This is done for efficiency, but it might reduce the basin of attraction. There are two compilation flags that govern this behavior, so if someone would be so inclined :-) it would be nice to see initial and final errors, convergence curves and total times for the two settings of the POSE3_EXPMAP/ROT3_EXMAP flags, with and without chordal. If they really don’t help efficiency much, even in the chordal case, we might want to change their default or even remove Cayley. |
Ok. I will test. |
@dellaert Frank, what you wrote made me think of a statement that is on the page for the RPGO tool in Kimera from Luca's lab. They use
and comment:
Is this the potential issue you're thinking of? Is there anyone from MIT on here that might have recently gone through this exercise? |
|
It's not. It's deliberate, but we might have to revise this, based on the data @victor1234 will provide :-) |
It is! There is even an open PR about this. This issue could shed a lot of light on how to resolve this :-) |
@dellaert Oh I understand now... |
I got first result with EXPMAP flags. Working on visual representation. |
No, we should really have hooks :-/ but you can call iterate yourself. I.e., roll your own version of NonlinearOptimzer::defaultOptimize, e.g, by subclassing LM. |
I also found the need for this... would you accept proposals on this on a separate PR? |
Of course :-) |
Is this all with the same initial estimate for the first graph? |
First figure without any initialization, second one with chordal |
Great to see these graphs. I think chordal graphs are less of interest, given these. It seems the issue is really convergence far from the minimum, for which our Cayley map is really bad, apparently. And expmap also gets stuck somewhere. Will you post the graphs for the other datasets as well? PS, one way to produce and share graphs is using the really cool site comet.ml, but that only works if your top-level loop is python :-) |
Yes. I could post if its need. Ok. I will check comet.ml. Thanks |
Absolutely, please post. I think you should call error and plot that as iteration “0” before calling iterate the first time. That should match, unless the prior is off. Comet.ml will take some time, so please post from your current pipeline if you can. Comet.ml would be cool to have As a script executed automatically as part of a build. |
ok |
The error metric for Ceres is different, so “better” is not really true per se. Ceres uses a metric derived from the quarternion, whereas we use geodesic error. Cayley is an approximation of that which is only good close to the origin. An interesting experiment would be to use exactly the same factor as in the Ceres code. PS, when you post new graphs, could you make the x-axis time? I suspect Ceres will be faster, too, would be good to know how much faster :-) |
To get iterations timestamps I need to create own solver like you described. WIll do. Is it make sense to use ISAM2 for this task? Will this solver split task on subgraphs? |
If you’re creating your own solver, then definitely do it in python with comet.ml, and it will do the timestamps automatically. PS the work you are doing here is great. If you’re interested we can expand this into a blog post (and even a small paper after that), and in fact provide some options to GTSAM users for pose optimization. There are several different ways to optimize that we have not touched upon yet (Frobenius norm, e.g.) and there really has not been a systematic exploration of the convergence behavior. I suspect that the bottom-line is it won’t matter too much if you use a good initialization strategy, like chordal. |
I need good pgo solver so I ready to any work for that. But I'm new in gtsam and have some questions about how it works. Is it appropriate to ask you? Is the issue tracker format suitable for this? |
Yes, send me an email at dellaert@gmail.com and we'll set up a meeting |
@ProfFan and I did some more work on this, see https://colab.research.google.com/drive/1E9Q-BZAIjL_YPjJbkEPXAresQFwuqcsQ In summary, Cayley overestimates the true angle The objective function we use in GTSAM is half the sum of squares of the error vector, which for the true exponential map corresponds to Ceres uses |
The above is the story for the error, but the compilation flags also interact in perhaps non-trivial ways to decide what
Note Cayley is not available for the Quaternion compilation path, so the setting of ROT3_EXMAP has to be TRUE. GTSAM uses the last row by default. Ceres uses the second row, I believe: quaternion exponential map for rotation, and just vector addition for translation - applied separately. |
Has anyone studied (in a paper) what's the convergence basin of the different options? I've been wondering for years whether the decoupled SE(3) retract (which I feel must be correct as well as the exact log/exp maps), has any negative implications in terms of convergence :-) |
Yes - this is what I’m proposing to examine in a bit more detail here. @victor1234 has not gotten back to me yet by email, though :-) @jlblancoc if you want to be involved let me know? I think we can also compare different Pose3 factor types: there is no reason that we have to use the localCoordinates variant as the error as well: these can be decoupled. Esp. Frobenius norm and (1-cos) error would be interesting to see. |
This is a cost function description and code for ceres-solver: |
If I set
|
I think the plan should be to call iterate in python, and get the error explicitly after each call. Parsing the output seems clunky. |
I splitted optimize() into iterate() |
This is interesting. Based on various comments and observations, I reran levenberg marquardt on these datasets under the following settings (C++): i) pose3exp_map/rot3_expmap compiler flags: OFF , chordal initialization: OFF When I visualize the results at convergence: Thanks |
@ProfFan will take over from me here:
One design: make a colab that runs 6 datasets for one optimizer. |
Excellent.
Perhaps you could organize this on some slides for the meeting?
Make the title slides “tweets"
Frank
… On Jun 12, 2020, at 12:30 PM, Fan Jiang ***@***.***> wrote:
grid3d:
<https://user-images.githubusercontent.com/5358374/84524710-665bd900-aca8-11ea-9488-0f8c13b2e300.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#248 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACQHGSMEVUY4R7GH7UVOOKLRWJJZFANCNFSM4LGUDEVQ>.
|
This will soon be addressed in 4.0.3 blog post on gtsam.org |
Description
I've been playing with GTSAM for doing SE(3) Pose Graph Optimization. As a starting point, I tried GTSAM on some benchmark datasets for PGO from this site: https://lucacarlone.mit.edu/datasets/ Unfortunately, I haven't been able to achieve convergence to any meaningful results on Sphere, Torus and Cube. It works well for Parking Garage and Cubicle. The issue seems to be convergence to a really bad local minimum. I've tried combining various Non Linear Optimizers (Levenberg Marquardt, Gauss-Newton and Dogleg) with linear solver (Cholesky and QR) that come with GTSAM, but the optimizer always converges to a bad minimum in a handful of iterations (typically < 10), either because the absolute or the relative error was less than the threshold (which I believe is around 1e-7). I've also played around with damping strategies for LM to see if that helps (not setting the damping factor to a fixed value, allowing for off-diagonals to also be damped, etc), without any luck.
Has anyone been able to achieve meaningful results on these datasets? If so, would appreciate if you share the relevant code snippet. Thanks.
Steps to reproduce
Expected behavior
Environment
Ubuntu 16.04 LTS
Additional information
The text was updated successfully, but these errors were encountered: