Repository navigation
Reduce graph: added option to remove orphan nodes from WM after reduction - #1735
Merged
Merged
Conversation
matlabbe
marked this pull request as ready for review
July 10, 2026 23:57
…t need the dictionary fully loaded in memory.
… to disable graph reduction when intermediate nodes are detected.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The issue is that the current graph reduction may split the graph and some nodes may get disconnected from the optimized graph. A new option called
--remove_orphan_nodescan trigger a cleanup of the working memory and long-term memory by deleting those nodes from the global optimized graph. This is only done when all nodes from WM and LTM are contained in the global graph. To trigger it even if not all nodes were reviously in the global graph, we can do--remove_all_orphan_nodesat your own peril.Example of a case where it matters:
rtabmap-reduceGraphtool, it is possible that one or more nodes get disconnected from the global graph. The global graph may then be smaller than number of nodes in WM and LTM. The robot can still localize on nodes that are not connected to that graph but still in WM, which would trigger a re-optimization of the full graph. With--remove_orphan_nodes, the graph and memory will be synchronized to avoid this issue.Added features:
Memory::setDummyDictionnary()to avoid populating the dictionary with original descriptors, populate with empty descriptors instead to save RAM and initialization time.VisualWordobjects while not breaking other stuff. EDIT: recheck again if we could pass a nullptr instead of emptyVisualWord. An emptyVisualWordstill include all the overhead of acv::Mat's header. Doublecheck that the signature->word references are still correctly updated. EDIT 2: We cannot use nullptr because the words need to keep track of the signatures they reference. I think the cleanest way would be to create a DummyDictionary class inheriting from VWDictionary and override functions to not use VisualWord objects, but keep track of words references in a simple map. Keeping this for a future PR though, lets merge this one.rtabmap-addMoreLoopClosurestool too.