Project

General

Profile

Statistics
| Branch: | Revision:

root / rgbdslam / rgbd_benchmark / summarize_evaluation.sh @ 9240aaa3

History | View | Annotate | Download (3.27 KB)

1
#!/bin/bash
2

    
3
DIR=`readlink -f $1`
4
if  test ! -d "$DIR"; then  
5
  echo "'$DIR' is not a directory" 
6
  echo "Usage: $0 <directory-where-results-are>"
7
  echo "e.g., $0 some/path/to/SURF/"
8
  exit
9
fi
10
pushd $DIR > /dev/null
11
for num in 1 2; do 
12
  rm -f eval_translational.txt eval_rotational.txt eval_runtime.txt 
13
  for BASENAME in `ls -d rgbd_dataset_freiburg1*`; do
14
    echo $BASENAME
15
    if test ! -d $BASENAME;then
16
      echo "Not ready yet"
17
      break;
18
    fi
19
    ESTIMATE_FILE=$BASENAME/${BASENAME}.bagafter${num}_optimization_estimate.txt
20
    if test ! -f $ESTIMATE_FILE;then
21
      echo "No estimate at level " $num 
22
      continue;
23
    fi
24
    EVAL_FILE=$ESTIMATE_FILE.evaluation
25
    if rosrun rgbd_benchmark_tools evaluate_rpe.py --verbose $BASENAME/${BASENAME}-groundtruth.txt $ESTIMATE_FILE > $EVAL_FILE; then
26
      rosrun rgbd_benchmark_tools evaluate_ate.py --plot $BASENAME/$BASENAME.difference_plot$num.png --verbose $BASENAME/${BASENAME}-groundtruth.txt $ESTIMATE_FILE > $EVAL_FILE.ate; then
27
      #rosrun rgbd_benchmark_tools align_and_plot.py --plot $BASENAME/$BASENAME.alignment_plot$num.png --verbose $BASENAME/${BASENAME}-groundtruth.txt $ESTIMATE_FILE > /dev/null
28

    
29
      #RMSE
30
      echo -n "FR${BASENAME#rgbd_dataset_freiburg}; " >> eval_translational.txt
31
      echo -n "FR${BASENAME#rgbd_dataset_freiburg}; " >> eval_rotational.txt
32
      grep translational_error.rmse $EVAL_FILE |sed "s#$DIR##g" | sed 's/ /; /g' >> eval_translational.txt
33
      grep rotational_error.rmse $EVAL_FILE |sed "s#$DIR##g" | sed 's/ /; /g' >> eval_rotational.txt
34

    
35
      #OVERALL RUNTIME
36
      STARTTIME=`grep -B1 createXYZ $BASENAME/logfile |head -n1|grep -o '13[0-9]*\.'` #timestamp first relevant action
37
      ENDTIME=`grep "Finished process" $BASENAME/logfile |grep -o '13[0-9]*\.'` #timestamp first relevant action
38
      STARTTIME_NSEC=`grep -B1 createXYZ $BASENAME/logfile |head -n1|grep -o '\.[0-9]*'` #timestamp first relevant action
39
      ENDTIME_NSEC=`grep "Finished with $num" $BASENAME/logfile |grep -o '\.[0-9]*'` #timestamp first relevant action
40
      echo -n "Start; ${STARTTIME%.}.${STARTTIME_NSEC#.};s; End; ${ENDTIME%.}.${ENDTIME_NSEC#.};s;" >> eval_runtime.txt
41

    
42
      #OPTIMIZER RUNTIME
43
      OPT_TIME=`grep -B1 "Finished with $num" $BASENAME/logfile |head -n1|grep -o '[0-9.]* s'` #timestamp first relevant action
44
      echo -n "Optimizer Time; ${OPT_TIME% s};s;" >> eval_runtime.txt
45

    
46

    
47
      #NUMBER OF NODES
48
      NODE_NUM=`grep -B4 "Finished with $num" $BASENAME/logfile |head -n1|grep -o '[0-9]* nodes'` #timestamp first relevant action
49
      EDGE_NUM=`grep -B4 "Finished with $num" $BASENAME/logfile |head -n1|grep -o '[0-9]* edges'` #timestamp first relevant action
50
      echo -n "Number of Nodes/Edges; ${NODE_NUM% nodes};${EDGE_NUM% edges};" >> eval_runtime.txt
51

    
52

    
53
      echo >> eval_runtime.txt
54

    
55
      paste "-d;" eval_rotational.txt eval_translational.txt eval_runtime.txt |sed "s#$DIR/##g" | sed 's/rgbd_dataset_freiburg/FR/g' |sed 's/.evaluation//g' |sed 's/.bagafter._optimization_estimate.txt//g'|sed 's/.bag//g'|sed 's/flowerbouquet/flwrbqt/g' |sed 's/background/bg/g'|sed 's#/FR[^/]*/##g'|sed 's/_/ /g' > evaluation_$num.csv
56
    else
57
      echo "Evaluation Failed"
58
    fi
59
  done
60
  echo Results stored in $DIR/evaluation_$num.csv
61
done
62

    
63
rm -f eval_translational.txt eval_rotational.txt eval_runtime.txt 
64

    
65
popd > /dev/null