4 ########################################################################
6 # folded-ctf is an implementation of the folded hierarchy of #
7 # classifiers for object detection, developed by Francois Fleuret #
10 # Copyright (c) 2008 Idiap Research Institute, http://www.idiap.ch/ #
11 # Written by Francois Fleuret <francois.fleuret@idiap.ch> #
13 # This file is part of folded-ctf. #
15 # folded-ctf is free software: you can redistribute it and/or modify #
16 # it under the terms of the GNU General Public License version 3 as #
17 # published by the Free Software Foundation. #
19 # folded-ctf is distributed in the hope that it will be useful, but #
20 # WITHOUT ANY WARRANTY; without even the implied warranty of #
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
22 # General Public License for more details. #
24 # You should have received a copy of the GNU General Public License #
25 # along with folded-ctf. If not, see <http://www.gnu.org/licenses/>. #
27 ########################################################################
29 MAIN_URL="http://www.idiap.ch/folded-ctf/"
31 #########################################################################
36 if [[ $? != 0 ]]; then
37 echo "Compilation failed." >&2
43 #########################################################################
44 # Generating the pool file
47 POOL_NAME=${DATA_PATH}/rmk.pool
49 if [[ -d ${DATA_PATH} ]]; then
51 if [[ -f ${POOL_NAME} ]]; then
53 echo "The pool file exists."
57 echo "Can not find the pool file, checking the data integrity."
59 md5sum -c ${DATA_PATH}/list.md5
61 if [[ $? != 0 ]]; then
62 echo "The data set is corrupted. You can download it" >&2
63 echo "from ${MAIN_URL}" >&2
67 echo "Generating the pool file."
69 ./list_to_pool ${DATA_PATH}/full.lst ${DATA_PATH} ${POOL_NAME}.wrk
71 if [[ $? == 0 ]]; then
72 mv ${POOL_NAME}.wrk ${POOL_NAME}
74 \rm ${POOL_NAME}.wrk 2> /dev/null
75 echo "Pool generation failed." >&2
83 echo "Can not find the RateMyKitten images in ${DATA_PATH}. You can download" >&2
84 echo "them from ${MAIN_URL}" >&2
93 #####################################################################
94 ## Generate illustrating pictures
100 EXPERIMENT_RESULT_DIR="${RESULT_DIR}/hb-${SEED}"
102 if [[ -d "${EXPERIMENT_RESULT_DIR}" ]]; then
104 # Value of -1 corresponds to saving the images with the
105 # ground-truth or the pi-referentials alone, while other
106 # values show registered pi-feature windows.
108 for npf in -1 0 2500; do
110 ./folding --random-seed=${SEED} \
111 --pool-name=${POOL_NAME} \
112 --result-path=/tmp/ \
113 --detector-name=${EXPERIMENT_RESULT_DIR}/default.det \
115 --material-feature-nb=${npf} \
123 echo "You have to run at least the first round completely to be able" >&2
124 echo "to generate the pictures." >&2
130 #####################################################################
131 ## Run the full computation
135 if [[ ! -d ${RESULT_DIR} ]]; then
139 for SEED in {0..9}; do
141 for MODE in hb h+b; do
143 EXPERIMENT_RESULT_DIR="${RESULT_DIR}/${MODE}-${SEED}"
145 mkdir ${EXPERIMENT_RESULT_DIR} 2> /dev/null
147 if [[ $? == 0 ]]; then
149 if [[ $MODE == "h+b" ]]; then
150 OPTS="--force-head-belly-independence=yes"
155 if [[ $1 == "valgrind" ]]; then
156 # The valgrind operation runs a simpler computation in valgrind
157 OPTS="${OPTS} --nb-classifiers-per-level=1 --nb-weak-learners-per-classifier=10"
158 OPTS="${OPTS} --proportion-for-train=0.1 --proportion-for-validation=0.025 --proportion-for-test=0.01"
159 OPTS="${OPTS} --wanted-true-positive-rate=0.1"
160 DEBUGGER="valgrind --db-attach=yes --leak-check=full --show-reachable=yes"
163 ${DEBUGGER} ./folding \
164 --random-seed=${SEED} \
165 --pool-name=${POOL_NAME} \
166 --result-path=${EXPERIMENT_RESULT_DIR} \
167 --detector-name=${EXPERIMENT_RESULT_DIR}/default.det \
173 sequence-test-detector | tee -a ${EXPERIMENT_RESULT_DIR}/stdout
177 echo "${EXPERIMENT_RESULT_DIR} exists, cancelling that run."