Skip to content

Commit

Permalink
Updated loop closure benchmark scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
matlabbe committed Aug 31, 2024
1 parent 94e0465 commit 01e11f1
Show file tree
Hide file tree
Showing 13 changed files with 151 additions and 101 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
86 changes: 0 additions & 86 deletions archive/2010-LoopClosure/DumpMemorySign.txt

This file was deleted.

56 changes: 56 additions & 0 deletions archive/2010-LoopClosure/ShowLogs/precisionRecallAllDetectors.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

#set(0,'defaultAxesFontName', 'Times')
#set(0,'defaultTextFontName', 'Times')

Prefix = 'loop_closure_detection_datasets';
Dataset= 'CityCentre'
Detectors = {'Surf'; 'Sift'; 'CudaSift'; 'GfttBrief'};

% The Ground Truth is a squared bmp file (size must match the log files
% length) where white dots mean loop closures.
% Grey dots mean 'loop closures to ignore', this happens when the rehearsal
% doesn't match consecutive images together.
GroundTruthFile = [Prefix '/' Dataset '.png'];

colors = 'kbgrcm';
figure
xlabel('Recall (%)')
ylabel('Precision (%)')
hold on;

Results = {};
TimeResults = {};

for i=1:length(Detectors)
LogI = importfile([Prefix '/' Dataset '/' Detectors{i} 'LogI.txt']);
LogF = importfile([Prefix '/' Dataset '/' Detectors{i} 'LogF.txt']);

PR = getPrecisionRecall(LogI, LogF, GroundTruthFile, 0.07);
plot(100*PR(:,2), 100*PR(:,1), colors(mod(i,6)+1));
% hold on;
Results{i} = PR;
time = sum(LogF(:,2:7),2)+LogF(:,17);%LogF(:,1)
TimeResults{i} = time;
meanTime = mean(time)
meanWm = mean(LogI(:,7))
meanDict = mean(LogI(:,6))
maxTime = max(time)
maxWm = max(LogI(:,7))
maxDict = max(LogI(:,6))

%figure(2)
%plot(PR(:,4), PR(:,3), colors(mod(i,6)+1));
%hold on;
end
legend(Detectors)
title(Dataset)

figure
rows=floor(length(Detectors)/2 )+ mod(length(Detectors), 2)
for i=1:length(TimeResults)
subplot(rows, 2, i)
plot(TimeResults{i})
ylabel('Time (s)')
title([Detectors{i} ' (' num2str(mean(TimeResults{i})) 's)'])
end
xlabel('Location indexes')
7 changes: 4 additions & 3 deletions archive/2010-LoopClosure/ShowLogs/showlogs.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [LogF LogI] = showlogs(PathPrefix, GT_file)
function [LogF LogI] = showlogs(PathPrefix, GT_file, LogPrefix)
% [LogF LogI] = showlogs(PathPrefix, GT_file)
% SHOWLOGS Plot a RTAB-Map results (LogI.txt, LogF.txt). Just put this
% file in the same directory as LogF.txt and LogI.txt files
Expand All @@ -24,14 +24,15 @@

close all

if nargin < 3, LogPrefix = ''; end
if nargin < 2, GT_file = ''; end
if nargin < 1, PathPrefix = '.'; end

%---------------------------------------------------------

display(' ');
display('Loading log files...');
LogF = importfile([PathPrefix '/' 'LogF.txt']);
LogF = importfile([PathPrefix '/' LogPrefix 'LogF.txt']);
% COLUMN HEADERS :
% 1 totalTime
% 2 timeMemoryUpdate,
Expand All @@ -54,7 +55,7 @@
% 19 timeEmptyingTrash
% 20 timeRetrievalDbAccess

LogI = importfile([PathPrefix '/' 'LogI.txt']);
LogI = importfile([PathPrefix '/' LogPrefix 'LogI.txt']);
% COLUMN HEADERS :
% 1 lcHypothesisId,
% 2 highestHypothesisId,
Expand Down
8 changes: 0 additions & 8 deletions archive/2010-LoopClosure/run_all.sh

This file was deleted.

29 changes: 29 additions & 0 deletions archive/2010-LoopClosure/run_all_datasets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

DATASETS_FOLDER=""
if [ $# -eq 1 ]
then
DATASETS_FOLDER=$1
else
echo "Usage: run_all_datasets.sh \"datasets folder\" "
exit
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

$SCRIPT_DIR/run_bow.sh $DATASETS_FOLDER/NewCollege $DATASETS_FOLDER/NewCollege.png
if [ -s LogF.txt ]; then
mv LogF.txt $DATASETS_FOLDER/NewCollege/LogF.txt
mv LogI.txt $DATASETS_FOLDER/NewCollege/LogI.txt
fi
$SCRIPT_DIR/run_bow.sh $DATASETS_FOLDER/CityCentre $DATASETS_FOLDER/CityCentre.png
if [ -s LogF.txt ]; then
mv LogF.txt $DATASETS_FOLDER/CityCentre/LogF.txt
mv LogI.txt $DATASETS_FOLDER/CityCentre/LogI.txt
fi
$SCRIPT_DIR/run_bow.sh $DATASETS_FOLDER/UdeS_1Hz $DATASETS_FOLDER/UdeS_1Hz.png
if [ -s LogF.txt ]; then
mv LogF.txt $DATASETS_FOLDER/UdeS_1Hz/LogF.txt
mv LogI.txt $DATASETS_FOLDER/UdeS_1Hz/LogI.txt
fi

37 changes: 37 additions & 0 deletions archive/2010-LoopClosure/run_all_detectors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

DATASET_FOLDER=""
GT_FILE=""
MEMORY_THR=0
if [ $# -ge 2 ]
then
DATASET_FOLDER=$1
GT_FILE=$2
else
echo "Usage: run_all_detectors.sh \"dataset folder\" \"ground truth file\" [\"Rtabmap/MemoryThr=0\"]"
exit
fi

if [ $# -ge 3 ]
then
MEMORY_THR=$3
fi

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

$SCRIPT_DIR/run_bow.sh $DATASET_FOLDER $GT_FILE $MEMORY_THR 0 false
mv LogF.txt $DATASET_FOLDER/SurfLogF.txt
mv LogI.txt $DATASET_FOLDER/SurfLogI.txt
$SCRIPT_DIR/run_bow.sh $DATASET_FOLDER $GT_FILE $MEMORY_THR 1 false
mv LogF.txt $DATASET_FOLDER/SiftLogF.txt
mv LogI.txt $DATASET_FOLDER/SiftLogI.txt
$SCRIPT_DIR/run_bow.sh $DATASET_FOLDER $GT_FILE $MEMORY_THR 1 true
mv LogF.txt $DATASET_FOLDER/CudaSiftLogF.txt
mv LogI.txt $DATASET_FOLDER/CudaSiftLogI.txt
$SCRIPT_DIR/run_bow.sh $DATASET_FOLDER $GT_FILE $MEMORY_THR 6 false
mv LogF.txt $DATASET_FOLDER/GfttBriefLogF.txt
mv LogI.txt $DATASET_FOLDER/GfttBriefLogI.txt
#$SCRIPT_DIR/run_bow.sh $DATASET_FOLDER $GT_FILE $MEMORY_THR 11 false
#mv LogF.txt $DATASET_FOLDER/SuperPointLogF.txt
#mv LogI.txt $DATASET_FOLDER/SuperPointLogI.txt

29 changes: 25 additions & 4 deletions archive/2010-LoopClosure/run_bow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,38 @@

DATASET_FOLDER=""
GT_FILE=""
if [ $# -eq 2 ]
MEMORY_THR=300
DETECTOR=0
GPU=false
if [ $# -ge 2 ]
then
DATASET_FOLDER=$1
GT_FILE=$2
else
echo "Usage: run_bow.sh \"dataset folder\" \"ground truth file\""
echo "Usage: run_bow.sh \"dataset folder\" \"ground truth file\" [\"Rtabmap/MemoryThr=300\"] [\"Kp/DetectorStrategy=0\"] [\"GPU=false\"]"
exit
fi

if [ $# -ge 3 ]
then
MEMORY_THR=$3
fi
if [ $# -ge 4 ]
then
DETECTOR=$4
fi
if [ $# -ge 5 ]
then
GPU=$5
fi

rtabmap-console \
-quiet \
--Rtabmap/StatisticLogged true\
--Rtabmap/StatisticLoggedHeaders false\
--Kp/DetectorStrategy 0\
--Kp/DetectorStrategy $DETECTOR\
--SURF/HessianThreshold 150\
--Rtabmap/MemoryThr 300\
--Rtabmap/MemoryThr $MEMORY_THR\
--Rtabmap/LoopRatio 0.9\
--Mem/STMSize 30\
--Vis/MaxFeatures 400\
Expand All @@ -27,6 +43,11 @@ rtabmap-console \
--Mem/BadSignaturesIgnored true\
--Mem/RehearsalSimilarity 0.20\
--Mem/RecentWmRatio 0.20\
--FAST/Gpu $GPU\
--GFTT/Gpu $GPU\
--ORB/Gpu $GPU\
--SIFT/Gpu $GPU\
--SURF/GpuVersion $GPU\
-gt "$GT_FILE"\
"$DATASET_FOLDER"

0 comments on commit 01e11f1

Please sign in to comment.