-
Notifications
You must be signed in to change notification settings - Fork 923
Robust Incremental Smoothing and Mapping (riSAM) #2409
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
Open
DanMcGann
wants to merge
21
commits into
borglab:develop
Choose a base branch
from
DanMcGann:feature/risam
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f426d2e
Copy IMPL from risam-v2
DanMcGann 5f49b88
Reformat initial riSAM code.
DanMcGann 1ed4be2
Format + Fix Compilation
DanMcGann f5574ab
Update docs for new formatting
DanMcGann b674f01
Cleanup Grad Factor+Kernel and Test
DanMcGann 64227f8
Add riSAM test
DanMcGann 8ba9cdc
Clean riSAM tests and Param constructor
DanMcGann fcec2c5
Update chi2 naming convention
DanMcGann ea4633f
Fix formating in risam additions
DanMcGann 71bdf37
Updates for review changes to isam2 updates
DanMcGann 7e7155d
Address co-pilot review
DanMcGann 695168e
Fix shared_ptr compile issue
DanMcGann 5a86d3b
Add RISAM notebook docs
DanMcGann 86c9099
Update Doxygen Regions
DanMcGann 64ce754
Add graduated weight/loss to robust lost functions
DanMcGann b9d8fff
Refactor GradKernel into Robust Loss + Scheduler
DanMcGann 4630c19
Remove Graduated Kernel + Add Tests
DanMcGann 8752f1e
Remove deprecated graduated kernel header
DanMcGann 9558ca4
Add tests for complete Graduated Robust Loss
DanMcGann 315424b
Add TLS Graduation Schemes, complete test coverage
DanMcGann 21cf9f6
Fix Dependency Structure and TLS transition loss
DanMcGann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "c950beef", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "# RISAM - Robust Incremental Smoothing and Mapping\n", | ||
| "\n", | ||
| "## Overview\n", | ||
| "\n", | ||
| "The `RISAM` class in GTSAM is designed to perform online robust optimization using an incrementalized version of [Graduated Non-Convexity](GNCOptimizer.ipynb) built on the [ISAM2](ISAM2.ipynb) algorithm. This method is intended for scenarios where the incremental optimization problem is affected by outliers. In cases where all measurements are known to be inliers `RISAM` functions identically to `ISAM2`, however, when potential outliers are incorporated `RISAM` applies an incremental GNC step to the effected problem improving robustness over standard ISAM2 but preventing sensitivity to initialization found in M-Estimation approaches.\n", | ||
| "\n", | ||
| "Like the `GNCOptimizer`, `RISAM` leverages a robust cost function $\\rho(e)$, where $e$ is the error term. The goal is to minimize the sum of these robust costs over all measurements:\n", | ||
| "\n", | ||
| "$$\n", | ||
| "\\min_x \\sum_i \\rho(e_i(x))\n", | ||
| "$$\n", | ||
| "\n", | ||
| "Unlike the batch setting that `GNCOptimzier` is used for, `RISAM` targets the incremental problem where we incrementally incorporate measurements online.\n", | ||
| "\n", | ||
| "$$\n", | ||
| "\\min_{x^t} \\sum_i \\rho(e_i(x^t))\n", | ||
| "$$\n", | ||
| "\n", | ||
| "Where we re-solve only a small subproblem at each step that is affected by the new measurements. `RISAM` solves this sub-problem robustly by solving a continuation of problems defined by graduated robust kernel $\\rho(e, \\mu)$ where the control parameter $\\mu$ smoothly transitions the kernel from quadratic ($x^2$) to a robust loss.\n", | ||
| "\n", | ||
| "$$\n", | ||
| "\\rho(e^t, \\mu)\n", | ||
| "$$\n", | ||
| "\n", | ||
| "By starting with non-robust error `RISAM` better handles poor-initialization, and by transitioning to the final robust loss `RISAM` removes the influence of outliers.\n", | ||
| "\n", | ||
| "Key features:\n", | ||
| "\n", | ||
| "- **Online Robust Optimization**: `RISAM` is designed to support incremental optimization problems with outliers, using a robust cost function that can mitigate their effects.\n", | ||
| "- **Incremental Graduated Non-Convexity**: This technique allows the optimizer to solve each incremental subproblem with a convex problem and gradually transform it into the original non-convex problem, which helps in avoiding local minima.\n", | ||
| "\n", | ||
| "## Key Methods + Classes\n", | ||
| "\n", | ||
| "`RISAM` is designed to be a drop-in replacement for ISAM2. To see details on its key methods see [ISAM2.ipynb](ISAM2.ipynb).\n", | ||
| "\n", | ||
| "Additional Key Methods:\n", | ||
| "* `getOutliers`: Returns the set of measurements currently classified as outliers.\n", | ||
| "\n", | ||
| "Additional Key Helpers + Classes\n", | ||
| "* `make_graduated`: Constructs any factor as a `GraduatedFactor` which identifies factors as possible outliers to `RISAM`. All other factors are treated as known inliers.\n", | ||
| "* `SIGKernel`: The suggested kernel to use with `GraduatedFactors` provides stable optimization performance.\n", | ||
| "\n", | ||
| "## Parameters\n", | ||
| "\n", | ||
| "The `RISAM::Parameters` class defines parameters specific to `RISAM`:\n", | ||
| "\n", | ||
| "| Parameter | Type | Default Value | Description |\n", | ||
| "|-----------|------|---------------|-------------|\n", | ||
| "| isam2_params | ISAM2Params | ISAM2Params() | The parameters for the encapsulated ISAM2 optimizer. It is recommended to use DogLegLineSearch for optimization. |\n", | ||
| "| increment_outlier_mu | bool | true | Whether to increment the initial value of $\\mu$ used for each incremental GNC update over time as certainty of their inlier/outlier status increases. |\n", | ||
| "| outlier_mu_chisq_upper_bound | double | 0.95 | The $\\chi^2$ threshold for factor residual to consider it an outlier for $\\mu_{init}$ updates.. |\n", | ||
| "| outlier_mu_chisq_lower_bound | double | 0.25| The $\\chi^2$ threshold for factor residual to consider it strong inlier for $\\mu_{init}$ updates. |\n", | ||
| "| outlier_mu_avg_var_convergence_thresh | double | 0.01 | The threshold average variable delta to initiate $\\mu_{init}$ updates. |\n", | ||
| "| number_extra_iters | size_t | 1 | The number of extra `ISAM2::updates` called internally at each iteration after converging to the fully robust problem. |\n", | ||
| "\n", | ||
| "## Usage Considerations\n", | ||
| "\n", | ||
| "- **Outlier Rejection**: `RISAM` is particularly effective in online scenarios with significant outlier presence, such as online SLAM.\n", | ||
| "- **Trust Region Optimization**: While `RISAM` can use any underlying optimization step methods supported by ISAM2 it is strongly recommended to use `DoglegLineSearch` as it accounts for the changes in problem structure (convexity changes) and prevents divergence through trust region steps.\n", | ||
| "\n", | ||
| "## Files\n", | ||
| "\n", | ||
| "- [RISAM.h](https://github.com/borglab/gtsam/blob/develop/gtsam/sam/RISAM.h)\n", | ||
| "- [RISAMGraduatedFactor.h](https://github.com/borglab/gtsam/blob/develop/gtsam/sam/RISAMGraduatedFactor.h)\n", | ||
| "- [RISAMGraduatedKernel.h](https://github.com/borglab/gtsam/blob/develop/gtsam/sam/RISAMGraduatedKernel.h)" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "colab_button", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "<a href=\"https://colab.research.google.com/github/borglab/gtsam/blob/develop/gtsam/nonlinear/doc/GncOptimizer.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "license_cell", | ||
| "metadata": { | ||
| "tags": [ | ||
| "remove-cell" | ||
| ] | ||
| }, | ||
| "source": [ | ||
| "GTSAM Copyright 2010-2022, Georgia Tech Research Corporation,\n", | ||
| "Atlanta, Georgia 30332-0415\n", | ||
| "All Rights Reserved\n", | ||
| "\n", | ||
| "Authors: Frank Dellaert, et al. (see THANKS for the full author list)\n", | ||
| "\n", | ||
| "See LICENSE for the license information" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "colab_import", | ||
| "metadata": { | ||
| "tags": [ | ||
| "remove-cell" | ||
| ] | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "try:\n", | ||
| " import google.colab\n", | ||
| " %pip install --quiet gtsam-develop\n", | ||
| "except ImportError:\n", | ||
| " pass" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "language_info": { | ||
| "name": "python" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 5 | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The notebook preamble order does not match our documented standard (title/introduction, then copyright remove-cell, then Colab badge, then Colab install remove-cell, then imports/setup code). Current order has badge before copyright and no dedicated imports/setup cell.
See copilot-instructions.md