Poor results of loop closurse detection rtabmap_ros.
Hello,
I was trying to map hallway and passed it twice, during mapping i got almost zero loop closures and my second pass is seen under another angle. Result is that i got two connected hallways: http://i.imgur.com/yJkODMn.png.
I'm using Xtion Live Pro with configuration:
<param name="Kp/DetectorStrategy" type="string" value="5"/> <!-- GFFT+FREAK -->
<param name="Kp/MaxDepth" type="string" value="3.5"/> <!-- Max distance -->
<param name="Vis/MaxDepth" type="string" value="3.5"/>
<param name="Vis/MinDepth" type="string" value="0.8"/> <!-- Min distance -->
<param name="Kp/MinDepth" type="string" value="0.8"/>
<param name="Kp/NNStrategy" type="string" value="3"/> <!-- BruteForce -->
<param name="Vis/CorNNType" type="string" value="3"/> <!-- BruteForce -->
Do you have any ideas how i can get better results? Also I'm not sure about those Brute Forces. I decided to use GFFT+FREAK because i read they give good results, should I try another algorithm?
Thanks for answers.
[EDIT]
I realized that using GFFT+FREAK (which i read are slow) i got 440 frames in 30 minutes which gives only 14,(6) frames per minute which is 0,2(4)FPS, with this i scanned 2 floors + stairs few times.
Next i decided to use ORB algorithm which gives me 330 frames in 6 minutes ~0,91FPS.
Can I record with high framerate and them make GFFT+FREAK algorithm work? To make sure, algorithms use most of my CPU not GPU or RAM? In comments there are few questions please answer as much as you can. I will make more algorithm tests but my battery is empty i need to wait for charge ;)
Asked by necro on 2016-08-03 12:38:19 UTC
Answers
Don't use BruteForce matching for the vocabulary (Kp
group), use KDTree (default). I tested both databases (see in comments) and ORB seems to find most of the loop closures. The database with ORB seems to be already ok. Note that I have a better global optimized graph using TORO or GTSAM on this database (well g2o with GaussNewton optimizer seems better too g2o/Optimizer=1
). For features, I personally prefer SURF for loop closure detection but it is just I've never did an exhaustive comparison of ORB and SURF, just did SURF benchmark for loop closure detection and it works well most of the time.
Here some parameters I changed:
<param name="Kp/DetectorStrategy" type="string" value="0"/> <!-- SURF -->
<param name="Kp/MaxDepth" type="string" value="0"/> <!-- unlimited distance for the vocabulary -->
<param name="Kp/NNStrategy" type="string" value="1"/> <!-- KdTree -->
<param name="Vis/CorNNType" type="string" value="1"/> <!-- KdTree -->
<param name="Optimizer/Strategy" type="string" value="2"/> <!-- GTSAM global optimization -->
<param name="RGBD/LoopClosureReextractFeatures" type="string" value="true"/> <!-- optional but more loop closures would be accepted -->
<!-- optional for odometry and rtabmap node -->
<param name="Vis/EstimationType" type="string" value="1"/> <!-- use 2D to 3D estimation -->
<param name="Vis/MaxDepth" type="string" value="5"/> <!-- max depth can be higher with 2D to 3D estimation -->
In the database where you traverse two floors, most loop closures are detected with SURF or ORB. You may want to close the loop between the two floors by taking the stairs at the other side, this may reduce the "bending" map effect between the two floors. Well, the visual odometry could be also better, to reduce the drift. Also, be careful when you pass a door so that visual odometry can keep a high number of features to track, otherwise large drifts would happen.
cheers
Asked by matlabbe on 2016-08-04 11:36:51 UTC
Comments
Thanks, I will check Your configuration now. I am able to record data with rtabmap-dataRecorder and then analyze it with one of algorithms? Already i got problem which says there is no graph, it's no odometry fault? How i can add graph and analyze database.
Asked by necro on 2016-08-05 02:57:22 UTC
I'm trying to re-compute my odometry but it's lost almost every step, how should i confiugurate it?
During re-computing my clouds are still "bending" at the end of hallway (i make U turn).
Can i save and load parameters from file somehow without reset rtabmap?
Also i can't check FLANN KdTree.
Asked by necro on 2016-08-05 03:44:32 UTC
I made it ;) Successfully opened database saved with rtabmap-Datarecorder. But i want to check odometry/depth for each frame, now it's scans at about 1hz when "movie" is played at 100% speed, can I slow down that record? In next comment i will put link to download my "movie" and my result.
Asked by necro on 2016-08-05 06:30:50 UTC
Ok, here's my record: https://drive.google.com/file/d/0BwBc0TJNW-utNnJNanBkdHJNZ0U/view?usp=sharing
And here is my database after running it in Rtabmap stand-alone app: https://drive.google.com/file/d/0BwBc0TJNW-utSU1EdHo5X3p4Skk/view?usp=sharing
Asked by necro on 2016-08-05 06:38:01 UTC
Propably got it. I changed detection rate and data buffer size to 0 (infinity). Should i change something in odometry? Other thing is that i can't check FLANN KdTree (non-commercial OpenCV without SIFT/SURF i want to use BSD licenses), and last thing is that there is no 2D to 3D but 3D to 2D (PnP).
Asked by necro on 2016-08-05 07:03:22 UTC
To make sure here is my configuration http://pastebin.com/AR3zn1Cj. I changed FLANN to Linear (KdTree not available) How I am able to load it to standalone app?
Asked by necro on 2016-08-05 07:12:29 UTC
With rtabmap-dataRecorder, there is no graph saved, only raw data. You may use this kind of database as input source. I fixed kdTree not available bug (as it should be always be available). It was a bug in rtabmapviz only, rtabmap node should be ok.
Asked by matlabbe on 2016-08-05 15:58:51 UTC
2D to 3D or 3D to 2D is the same, just a typo
Asked by matlabbe on 2016-08-05 16:00:15 UTC
Remove
<param name="Kp/NNStrategy" type="string" value="0"/> <!-- KdTree Linear -->
<param name="Vis/CorNNType" type="string" value="0"/> <!-- KdTree Linear -->
to use default flann KdTree.
Asked by matlabbe on 2016-08-05 16:01:42 UTC
Comments
Did you save the database somewhere and can you share it? (the one created in
~/.ros/rtabmap.db
)Asked by matlabbe on 2016-08-03 18:26:47 UTC
Clouds are saved in database only if I download them all from cache? I few scans today but my database files are very small... Now I'm in office i looked around, downloaded clouds and my database is much bigger.
Asked by necro on 2016-08-04 06:54:02 UTC
Also i realized that after first pass i got about 100 new pictures (IDs counter), second pass ~80, thid ~60 and so on... After 8 passes through hall i got 367 entries which give me about 45 per walk. Today first floor was ok (4passes) when staris are curved and another floor (4passes) looks bad.
Asked by necro on 2016-08-04 06:57:17 UTC
The database contains all data in the map automatically added to it. Make sure to kill rtabmap before copying the database (to make sure everything is saved in it). You can browse data in the database with
rtabmap-databaseViewer
.Asked by matlabbe on 2016-08-04 08:18:50 UTC
My bad. In a while I'm going for another scan. Can i record database with data recorder and then process it? Already i recorded DB but it says there is no graph when i try to make pointcloud from databaseViewer, i generated it but viewer still don't see it. How can i export pcl from Data recorder?
Asked by necro on 2016-08-04 08:43:04 UTC
I want to make it this way because my laptop is slow and I'm not in hurry so my idea is to record big amount of pictures and then process them (already all is made "live" which i don't need). In short i have a lot of time and i want to process record with high accuray.
Asked by necro on 2016-08-04 08:45:09 UTC
I'm back. I realized that using GFFT+FREAK (which i read are slow) i got 440 frames in 30 minutes which gives only 14,(6) frames per minute which is 0,2(4)FPS, with this i scanned 2 floors + stairs few times.
Next i decided to use ORB algorithm which gives me 330 frames in 6 minutes ~0,91FPS.
Asked by necro on 2016-08-04 09:55:12 UTC
Can I record with high framerate and them make GFFT+FREAK algorithm work? To make sure, algorithms use most of my CPU not GPU or RAM?
In comments there are few questions please answer as much as you can. I will make more algorithm tests but my battery is empty i need to wait for charge ;)
Asked by necro on 2016-08-04 09:59:43 UTC
GFFT+FREAK: https://drive.google.com/file/d/0BwBc0TJNW-utZXE2NmJtM21HRk0/view?usp=sharing
ORB: https://drive.google.com/file/d/0BwBc0TJNW-utT3VVQjBhQ0RUazg/view?usp=sharing
Tomorrow i will put those comments in question so it will be more clear for others with same problem.
Asked by necro on 2016-08-04 10:01:14 UTC
Normally when mapping, the resulting database would have 1 image / second. To replay the database to test loop closure detection, using the one saved when mapping is fine. You only have to map as usual, then send the generated database. I'll check your databases above...
Asked by matlabbe on 2016-08-04 10:28:27 UTC