X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=run.sh;h=cf4fe33d969436a246fdd92b033954b802b9c608;hb=refs%2Fheads%2Fmaster;hp=bd12a3743bbca4fac42fd079696a899c41482b7d;hpb=3cfcb2525810c5189919bd3507e32e515635c09e;p=folded-ctf.git
diff --git a/run.sh b/run.sh
index bd12a37..cf4fe33 100755
--- a/run.sh
+++ b/run.sh
@@ -1,24 +1,34 @@
#!/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 . #
-# #
-# Written by Francois Fleuret, (C) IDIAP #
-# Contact for comments & bug reports #
-#########################################################################
-MAIN_URL="http://www.idiap.ch/folded-ctf"
+########################################################################
+# #
+# 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 #
+# #
+# 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 . #
+# #
+########################################################################
+
+MAIN_URL="http://www.idiap.ch/folded-ctf/"
+#########################################################################
# Compiling
make -j -k
@@ -30,6 +40,7 @@ fi
echo
+#########################################################################
# Generating the pool file
DATA_PATH=./rmk-data
@@ -69,61 +80,106 @@ if [[ -d ${DATA_PATH} ]]; then
else
- echo "Can not find the RateMyKitten images in ${DATA_PATH}. You can" >&2
- echo "download them from ${MAIN_URL}" >&2
+ echo "Can not find the RateMyKitten images in ${DATA_PATH}. You can download" >&2
+ echo "them from ${MAIN_URL}" >&2
exit 1
fi
-# Running the computation per se
-
RESULT_DIR=./results
-if [[ ! -d ${RESULT_DIR} ]]; then
- mkdir ${RESULT_DIR}
-fi
+case $1 in
-for SEED in {0..9}; do
+ #####################################################################
+ ## Generate illustrating pictures
- for MODE in hb h+b; do
+ pics)
- EXPERIMENT_RESULT_DIR="${RESULT_DIR}/${MODE}-${SEED}"
+ SEED=0
- mkdir ${EXPERIMENT_RESULT_DIR} 2> /dev/null
+ EXPERIMENT_RESULT_DIR="${RESULT_DIR}/hb-${SEED}"
- if [[ $? == 0 ]]; then
+ if [[ -d "${EXPERIMENT_RESULT_DIR}" ]]; then
- OPTS="--random-seed=${SEED} --wanted-true-positive-rate=0.75"
-
- if [[ $MODE == "h+b" ]]; then
- OPTS="${OPTS} --force-head-belly-independence=yes"
- fi
-
- if [[ $1 == "light" ]]; then
- OPTS="${OPTS} --nb-classifiers-per-level=1 --nb-weak-learners-per-classifier=10"
- OPTS="${OPTS} --proportion-for-train=0.1 --proportion-for-validation=0.1 --proportion-for-test=0.1"
- fi
-
- ./folding \
- --niceness=15 \
- --pool-name=${POOL_NAME} \
- --nb-levels=2 \
- --nb-classifiers-per-level=25 --nb-weak-learners-per-classifier=100 \
- --result-path=${EXPERIMENT_RESULT_DIR} \
- --detector-name=${EXPERIMENT_RESULT_DIR}/default.det \
- ${OPTS} \
- open-pool \
- train-detector \
- compute-thresholds \
- write-detector \
- sequence-test-detector | tee -a ${EXPERIMENT_RESULT_DIR}/stdout
+ # Value of -1 corresponds to saving the images with the
+ # ground-truth or the pi-referentials alone, while other
+ # values show registered pi-feature windows.
+
+ for npf in -1 0 2500; do
+
+ ./folding --random-seed=${SEED} \
+ --pool-name=${POOL_NAME} \
+ --result-path=/tmp/ \
+ --detector-name=${EXPERIMENT_RESULT_DIR}/default.det \
+ --nb-images=63 \
+ --material-feature-nb=${npf} \
+ open-pool \
+ read-detector \
+ write-pool-images
+
+ done
else
+ echo "You have to run at least the first round completely to be able" >&2
+ echo "to generate the pictures." >&2
+ exit 1
+ fi
+
+ ;;
- echo "${EXPERIMENT_RESULT_DIR} exists, aborting experiment."
+ #####################################################################
+ ## Run the full computation
+ valgrind|"")
+
+ if [[ ! -d ${RESULT_DIR} ]]; then
+ mkdir ${RESULT_DIR}
fi
- done
+ for SEED in {0..9}; do
+
+ for MODE in hb h+b; do
+
+ EXPERIMENT_RESULT_DIR="${RESULT_DIR}/${MODE}-${SEED}"
+
+ mkdir ${EXPERIMENT_RESULT_DIR} 2> /dev/null
+
+ if [[ $? == 0 ]]; then
+
+ if [[ $MODE == "h+b" ]]; then
+ OPTS="--force-head-belly-independence=yes"
+ else
+ OPTS=""
+ fi
+
+ if [[ $1 == "valgrind" ]]; then
+ # The valgrind operation runs a simpler computation in valgrind
+ OPTS="${OPTS} --nb-classifiers-per-level=1 --nb-weak-learners-per-classifier=10"
+ OPTS="${OPTS} --proportion-for-train=0.1 --proportion-for-validation=0.025 --proportion-for-test=0.01"
+ OPTS="${OPTS} --wanted-true-positive-rate=0.1"
+ DEBUGGER="valgrind --db-attach=yes --leak-check=full --show-reachable=yes"
+ fi
+
+ ${DEBUGGER} ./folding \
+ --random-seed=${SEED} \
+ --pool-name=${POOL_NAME} \
+ --result-path=${EXPERIMENT_RESULT_DIR} \
+ --detector-name=${EXPERIMENT_RESULT_DIR}/default.det \
+ ${OPTS} \
+ open-pool \
+ train-detector \
+ compute-thresholds \
+ write-detector \
+ sequence-test-detector | tee -a ${EXPERIMENT_RESULT_DIR}/stdout
+
+ else
+
+ echo "${EXPERIMENT_RESULT_DIR} exists, cancelling that run."
+
+ fi
+
+ done
+
+ done
-done
+esac