Sparse Bayes (#1748)

* Sparse Bayes

* updated perf test

* improved tests with real data

* Making sparse works in incremental mapping

* bookkeeping optimization

* small opt

* refactoring

* splitting dense and sparse in different classes to make the code more lisible

* cleanup comments

* fixing CI

* Making all Bayes tests testing both dense and sparse

* Added multisession_3it integration test (test memory management, multisession and dense/sparse bayes in that settings)

* optimized sparse when transfer/retrieval happens (was slower than dense for that case)

* Testing retrieval param variants

* Updated multisession_3it integration tests to compare loop closure hypotheses

* bump version

* Fixed ui sum of prediction

* adding g2o gtsam to linux ci

* cleanup

* added debug crash log for ci

* Simplified Bayes/SparsePrediction description

* Dont show too dense for sparse on small maps (e.g., when we just started a new map)

* fixing amd64v3 issue with gtsam on ci ubuntu 26

* Dot not auto switch to dense based on map size.

* updating test range

* added coverage tests

* Adressing coverage

* ignore one line in coverage for purpose
This commit is contained in:
matlabbe
2026-08-23 13:21:46 -07:00
committed by GitHub
parent f647014f54
commit 9c1e117384
32 changed files with 82886 additions and 769 deletions
+7 -2
View File
@@ -1132,6 +1132,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
_ui->general_doubleSpinBox_vp->setObjectName(Parameters::kBayesVirtualPlacePriorThr().c_str());
_ui->lineEdit_bayes_predictionLC->setObjectName(Parameters::kBayesPredictionLC().c_str());
_ui->checkBox_bayes_fullPredictionUpdate->setObjectName(Parameters::kBayesFullPredictionUpdate().c_str());
_ui->checkBox_bayes_sparsePrediction->setObjectName(Parameters::kBayesSparsePrediction().c_str());
connect(_ui->lineEdit_bayes_predictionLC, SIGNAL(textChanged(const QString &)), this, SLOT(updatePredictionPlot()));
//Keypoint-based
@@ -5601,7 +5602,11 @@ void PreferencesDialog::updatePredictionPlot()
QVector<qreal> dataX((values.size()-2)*2 + 1);
QVector<qreal> dataY((values.size()-2)*2 + 1);
double value;
double sum = 0;
// Summed as PredictionModel does it, into a float: that is the sum the filter decides on,
// and under 1 of it is what has normalize() spread the difference over every other
// location. A double would land a few 1e-8 from a float on a list like the default one,
// and say 1 where the filter says otherwise.
float sum = 0.0f;
int lvl = 1;
bool ok = false;
bool error = false;
@@ -5639,7 +5644,7 @@ void PreferencesDialog::updatePredictionPlot()
{
_ui->label_prediction_sum->setText(QString("<font color=#FF0000>") + _ui->label_prediction_sum->text() + "</font>");
}
else if(sum == 1.0)
else if(sum == 1.0f)
{
_ui->label_prediction_sum->setText(QString("<font color=#00FF00>") + _ui->label_prediction_sum->text() + "</font>");
}
+36 -13
View File
@@ -63,9 +63,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-1365</y>
<y>0</y>
<width>684</width>
<height>5343</height>
<height>5315</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
@@ -95,7 +95,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>5</number>
<number>11</number>
</property>
<widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,0">
@@ -12591,14 +12591,14 @@ see Sqlite3 doc 'PRAGMA temp_store'.</string>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_22" columnstretch="0,1">
<item row="3" column="0">
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox_rtabmap_loopGPS">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QComboBox" name="comboBox_globalDescriptorExtractor">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
@@ -12628,7 +12628,7 @@ see Sqlite3 doc 'PRAGMA temp_store'.</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QLabel" name="label_502">
<property name="text">
<string>Use GPS to filter likelihood (if GPS is recorded). Only locations inside the Local Radius (see RGBD-SLAM panel) of the current GPS location are considered for loop closure detection.</string>
@@ -12648,7 +12648,30 @@ see Sqlite3 doc 'PRAGMA temp_store'.</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_bayes_sparsePrediction">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_bayes_sparsePrediction">
<property name="text">
<string>Sparse prediction. Use a sparse representation of the prediction instead of a dense matrix, which significantly reduces memory usage and processing time on large maps. Ignored when the values above sum to less than 1, as the prediction is then not sparse.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_kp_tfIdfLikelihoodUsed">
<property name="text">
<string/>
@@ -12658,7 +12681,7 @@ see Sqlite3 doc 'PRAGMA temp_store'.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QDoubleSpinBox" name="general_doubleSpinBox_vp">
<property name="maximum">
<double>1.000000000000000</double>
@@ -12671,7 +12694,7 @@ see Sqlite3 doc 'PRAGMA temp_store'.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QLabel" name="label_113">
<property name="text">
<string>The VP here is the probability to be in a new place since no loop closure was found on the last iteration.</string>
@@ -12684,7 +12707,7 @@ see Sqlite3 doc 'PRAGMA temp_store'.</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLabel" name="label_82">
<property name="text">
<string>Use the tf-idf method to compute the likelihood. Otherwise, images are compared with each other.</string>
@@ -12697,7 +12720,7 @@ see Sqlite3 doc 'PRAGMA temp_store'.</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QLabel" name="label_6031">
<property name="text">
<string>Global descriptor extractor.</string>
@@ -12710,7 +12733,7 @@ see Sqlite3 doc 'PRAGMA temp_store'.</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QLabel" name="label_757">
<property name="text">
<string>Likelihood ratio for VP.</string>
@@ -12723,7 +12746,7 @@ see Sqlite3 doc 'PRAGMA temp_store'.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QComboBox" name="comboBox_virtualPlaceLikelihoodRatio">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>