Inspecting differences in performance between `raulmur/ORBSLAM2` and `jingpang/LearnVIORB`

The canonical implementation of ORB-SLAM2 by Raúl Mur-Artal seems to perform better than the (non-visual-inertial) binaries generated by the code of Jing Wang. I’m looking into why, so Wang’s code can be improved, and perhaps some bugs for the stereo case may be squashed.

The situation

Both repositories can generate executables that test the mono and stereo implementations on the EuRoC dataset. These executables are mono_euroc and stereo_euroc, respectively for monocular and stereo vision datasets. Given the same settings and dataset, the binaries of Wang should demonstrate comparable behavior to the ones of Mur-Artal. This is not the case.

In the tests below, EuRoC V1-02 has been used. The configuration file for Mur-Artal’s code can be found in ORB_SLAM2/Examples/{Monocular,Stereo}/EuRoC.yaml. The configuration file for Wang’s code is located in LearnVIORB/config/euroc.yaml, extended with the missing fields from the ORB_SLAM2 config file. The vocabulary used is ORB_SLAM2/Vocabulary/ORBvoc.txt for both; Wang packed a binary version of the vocabulary with their code, which loads faster. However, Mur-Artal’s version does not support loading that binary. Just to be sure that there is no difference between the two vocabularies, I have used the text-version.

I have compared the most recent commit of LearnVIOS to the most recent commit of ORB_SLAM2.

Problem

Wang’s binaries show multiple differences in behavior:

Approach in finding the problems

I will first identify the differences in the files, and inspect each. Then I will merge the most recent commit of ORB_SLAM2 into LearnVIOS. Then I will inspect if there are any changes in behavior. Then I will again run a diff along the two repos.

Differences in implementation

As noted above, Wang’s code can load binary and plain-text files for the vocabulary, while Mur-Artal can only load plain-text files. To eliminate any differences, I fed them both the plain-text vocabulary that was packaged with Mur-Artal’s code.

Configuration files

There were small differences and missing parameters in the configuration file of LearnVIOS. Where ORB_SLAM2’s config has the same parameters, I have used those.

C++ files

In all files, std::map<KeyFrame*, size_t> has been replaced with mapMapPointObs = std::map<KeyFrame*,size_t,cmpKeyFrameId>; bool cmpKeyFrameId(KeyFrame* a, KeyFrame* b) compares the mnId fields of both KeyFrames, so that the map can be sorted.

The following C++ classes, functions and types from LearnVIORB are changed wrt the ORB_SLAM2 repository (let’s assume I’m using namespace ORB_SLAM2; for brevity and readability):

Merging

The two repositories are merged; I have created pull requests for both branches ( master and RT ). I didn’t have time for a full test yet.