Removed the definition of basename, which confuses an existing system one.
[folded-ctf.git] / graph.sh
index c1beaee..23767d6 100755 (executable)
--- a/graph.sh
+++ b/graph.sh
@@ -1,47 +1,55 @@
 #!/bin/bash
 
-#########################################################################
-# This program is free software: you can redistribute it and/or modify  #
-# it under the terms of the version 3 of the GNU General Public License #
-# as published by the Free Software Foundation.                         #
-#                                                                       #
-# This program is distributed in the hope that it will be useful, but   #
-# WITHOUT ANY WARRANTY; without even the implied warranty of            #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      #
-# General Public License for more details.                              #
-#                                                                       #
-# You should have received a copy of the GNU General Public License     #
-# along with this program. If not, see <http://www.gnu.org/licenses/>.  #
-#                                                                       #
-# Written and (C) by Francois Fleuret                                   #
-# Contact <francois.fleuret@idiap.ch> for comments & bug reports        #
+########################################################################
+#                                                                      #
+#  folded-ctf is an implementation of the folded hierarchy of         #
+#  classifiers for object detection, developed by Francois Fleuret     #
+#  and Donald Geman.                                                  #
+#                                                                     #
+#  Copyright (c) 2008 Idiap Research Institute, http://www.idiap.ch/   #
+#  Written by Francois Fleuret <francois.fleuret@idiap.ch>            #
+#                                                                     #
+#  This file is part of folded-ctf.                                   #
+#                                                                     #
+#  folded-ctf is free software: you can redistribute it and/or modify  #
+#  it under the terms of the GNU General Public License version 3 as   #
+#  published by the Free Software Foundation.                          #
+#                                                                     #
+#  folded-ctf is distributed in the hope that it will be useful, but   #
+#  WITHOUT ANY WARRANTY; without even the implied warranty of         #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   #
+#  General Public License for more details.                           #
+#                                                                     #
+#  You should have received a copy of the GNU General Public License   #
+#  along with folded-ctf.  If not, see <http://www.gnu.org/licenses/>. #
+#                                                                     #
+########################################################################
+
+GRAPH_NAME="/tmp/roc.eps"
+
 #########################################################################
 
-echo "Parsing the log files"
+echo "Parsing the log files."
 
 for p in hb h+b; do
-    grep ^INFO results/${p}-*/log  | grep "DECIMATED_FALSE_NEGATIVE_RATE\|DECIMATED_NB_FALSE_POSITIVES_PER_VGA" | \
-        sed -e "s/[^0-9A-Z_ .]//g" | \
+    grep ^INFO results/${p}-*/log  | \
         awk '{
                if($2 == "DECIMATED_FALSE_NEGATIVE_RATE") {
                  printf(1-$3)
-               } else {
+               } else if($2 == "DECIMATED_NB_FALSE_POSITIVES_PER_VGA") {
                  printf(" "$3"\n")
                }
              }' | sort -g > /tmp/${p}
 
+    if [[ ! -s /tmp/${p} ]]; then
+        echo "Not enough data points for ${p}." >&2
+        exit 1
+    fi
 done
 
-if [[ ! -s /tmp/hb ]] || [[ ! -s /tmp/h+b ]]; then
-    echo "Not enough data points." >&2
-    exit 1
-fi
-
 ######################################################################
 
-echo "Generating the graph per se"
-
-GRAPH_NAME="/tmp/roc.eps"
+echo "Generating the graph per se."
 
 gnuplot<<EOF
   set terminal postscript enhanced eps "Helvetica" 20