Repository navigation
Fixed some issues related to intermediate nodes and retrieval/immunization - #1733
Conversation
|
What is the use case that is failing for you? I think in #1687 I made sure it was doing Transfer/Retrieval (what is expected from the papers) like if intermediate nodes were not used (the count of retrieved nodes or transferred nodes are based on the non-intermediate nodes). I can doublecheck though. For the recording version with Not convinced we need to change the way working memory size is used (and counting the virtual or not). In particular, for thousands of nodes, we may spend significant time in For |
I tested it using the latest release version of RTAB-Map (v0.23.7), with the following configuration. The statistics show that Immunized locally is 0, but Immunized globally increases, and WM size also increases. Fortunately, they do not appear to grow indefinitely under this configuration, but rather fluctuate within the range of tens to hundreds. Since we set
There should be no problem with counting in Transfer/Retrieval processing. Transfer/Retrieval skips processing intermediate nodes directly and instead processes the intermediate nodes connected to them while processing regular nodes, which is a very good approach. The problem lies in the calculation of rtabmap/corelib/src/Rtabmap.cpp Lines 2249 to 2263 in bc724a2 Since rtabmap/corelib/src/Rtabmap.cpp Lines 2267 to 2294 in bc724a2
This is still due to the reason I mentioned in #1697. Some users are now using RTAB-Map for embodied AI data acquisition. The trajectories they are collecting are getting longer and longer, from tens of seconds at the beginning to tens of minutes now. They even collect tracks from multiple devices simultaneously and then merge them using rtabmap-reprocess. If we treat all nodes as regular nodes, the amount of data will be enormous. This also makes offline loop closure detection and merging much slower. Furthermore, the behavior of Bayesian filtering and loop closure detection can even change due to the high similarity between neighbor nodes. Enabling intermediate nodes simply makes the recorded trajectories more continuous; they participate in graph optimization but not in loop closure detection. I noticed that commit d069bec added the setIMU() method, which may even be used to record higher frequency trajectories in the future. In our custom VIO, although the image data is only 20 Hz, we will provide high-frequency pose output according to the IMU frequency, which is usually 200 Hz. We will obtain neural network features from the OAK camera. Both the front-end and back-end will skip feature detection, so setting
In our current applications, either for general applications where intermediate nodes are disabled and |
Some additional analysis on this: rtabmap/corelib/src/Memory.cpp Lines 6966 to 6985 in bc724a2 |
|
I played with these changes for a while, looks good! I just improved the You may doublecheck if everything is still working for you, then I'll merge. |
… intermediate nodes count. Added two new statistics to track number of intermediate nodes in STM and WM.
|
I have revised the condition for counting intermediate nodes. This code will treat invalid nodes with a weight of -9 as intermediate nodes. This can even cause _stMemIntermediateNodesCount to become negative. The reason is that setWeight(-9) appears not only in Memory::moveToTrash(), but also in Memory::rehearsalMerge(). If rehearsal is enabled, there will already be invalid nodes in the STM before calling Memory::moveToTrash(). rtabmap/corelib/src/Memory.cpp Lines 2759 to 2776 in 531b8a4
|
|
LGTM! |


Hi @matlabbe,
We found that when intermediate node was enabled and data recorder mode was used, WM continued to grow even with Rtabmap/MemoryThr set to 1 or 2. This is mainly because the size of WM was used directly when calculating the number of immunized nodes. Since there are intermediate nodes in WM, the number of maxLocalLocationsImmunized is greatly amplified. When counting the number of immunized nodes later, intermediate nodes are skipped, which results in more nodes being immunized and unable to be transferred to LTM. In the previous fix, the method for calculating the size of WM was not updated, so you also mentioned in the PR #1687 that
Rtabmap/MemoryThrneeds to be manually scaled.I've added two fixes this time: one is the outer layer fix in Rtabmap.cpp, and the other is the inner layer fix in Memory.cpp. When
RGBD/LocalImmunizationRatio,RGBD/MaxLocalRetrieved, andRtabmap/MaxRetrievedare all 0, the retrieval/immunization part can actually be skipped entirely. It is safest for us to skip the outer layer before the inner fix is fully evaluated and validated. Then I added the getWorkingMemSize() method to the Memory class, which allows ignoreIntermediateNodes when calculating the size. The previous code actually contained a comment for getWorkingMemSize(), so adding this method would be the most appropriate solution.rtabmap/corelib/src/Rtabmap.cpp
Line 2229 in e321999
WM contains a virtual node, and after consideration, I think it should not be included when calculating the size. This will make subsequent processing simpler. The only virtual node is inserted at the end of Memory::loadDataFromDb(), which is inside Memory::init(). Therefore, during system operation, WM should always contain a unique virtual node. This implementation should be safe. If you feel there is a risk, we can add some assertions. I have carefully considered whether intermediate nodes should be ignored when obtaining the size of WM in various places, but I may still make some mistakes, so please confirm during the review.
Additionally, there may be an issue with the following call to Memory::reactivateSignatures().
rtabmap/corelib/src/Rtabmap.cpp
Lines 2630 to 2640 in e321999
When the second parameter of Memory::reactivateSignatures() is 0, it does not mean that there is no reactivation, but rather that there is unlimited reactivation. Since reactivatedIds is empty in our configuration, RETRIEVAL 3/3 will be skipped, so this method will not be called. However, this part may need to be checked and fixed later.
I need to submit a PR with existing modifications first, because I see that you are adding support for OpenCV 5, and the modifications also involve this part of the code. Submitting earlier allows for earlier review and merging, reducing the workload of handling conflicts later.