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 as published #
17 # by the Free Software Foundation, either version 3 of the License, #
18 # or (at your option) any later version. #
20 # folded-ctf is distributed in the hope that it will be useful, but #
21 # WITHOUT ANY WARRANTY; without even the implied warranty of #
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
23 # General Public License for more details. #
25 # You should have received a copy of the GNU General Public License #
26 # along with folded-ctf. If not, see <http://www.gnu.org/licenses/>. #
28 ########################################################################
30 MAIN_URL="http://www.idiap.ch/folded-ctf/"
32 #########################################################################
37 if [[ $? != 0 ]]; then
38 echo "Compilation failed." >&2
44 #########################################################################
45 # Generating the pool file
48 POOL_NAME=${DATA_PATH}/rmk.pool
50 if [[ -d ${DATA_PATH} ]]; then
52 if [[ -f ${POOL_NAME} ]]; then
54 echo "The pool file exists."
58 echo "Can not find the pool file, checking the data integrity."
60 md5sum -c ${DATA_PATH}/list.md5
62 if [[ $? != 0 ]]; then
63 echo "The data set is corrupted. You can download it" >&2
64 echo "from ${MAIN_URL}" >&2
68 echo "Generating the pool file."
70 ./list_to_pool ${DATA_PATH}/full.lst ${DATA_PATH} ${POOL_NAME}.wrk
72 if [[ $? == 0 ]]; then
73 mv ${POOL_NAME}.wrk ${POOL_NAME}
75 \rm ${POOL_NAME}.wrk 2> /dev/null
76 echo "Pool generation failed." >&2
84 echo "Can not find the RateMyKitten images in ${DATA_PATH}. You can download" >&2
85 echo "them from ${MAIN_URL}" >&2
94 #####################################################################
95 ## Generate illustrating pictures
101 EXPERIMENT_RESULT_DIR="${RESULT_DIR}/hb-${SEED}"
103 if [[ -d "${EXPERIMENT_RESULT_DIR}" ]]; then
105 # Value of -1 corresponds to saving the images with the
106 # ground-truth or the pi-referentials alone, while other
107 # values show registered pi-feature windows.
109 for npf in -1 0 2500; do
111 ./folding --random-seed=${SEED} \
112 --pool-name=${POOL_NAME} \
113 --result-path=/tmp/ \
114 --detector-name=${EXPERIMENT_RESULT_DIR}/default.det \
116 --material-feature-nb=${npf} \
124 echo "You have to run at least the first round completely to be able" >&2
125 echo "to generate the pictures." >&2
131 #####################################################################
132 ## Run the full computation
136 if [[ ! -d ${RESULT_DIR} ]]; then
140 for SEED in {0..9}; do
142 for MODE in hb h+b; do
144 EXPERIMENT_RESULT_DIR="${RESULT_DIR}/${MODE}-${SEED}"
146 mkdir ${EXPERIMENT_RESULT_DIR} 2> /dev/null
148 if [[ $? == 0 ]]; then
150 if [[ $MODE == "h+b" ]]; then
151 OPTS="--force-head-belly-independence=yes"
156 if [[ $1 == "valgrind" ]]; then
157 # The valgrind operation runs a simpler computation in valgrind
158 OPTS="${OPTS} --nb-classifiers-per-level=1 --nb-weak-learners-per-classifier=10"
159 OPTS="${OPTS} --proportion-for-train=0.1 --proportion-for-validation=0.025 --proportion-for-test=0.01"
160 OPTS="${OPTS} --wanted-true-positive-rate=0.1"
161 DEBUGGER="valgrind --db-attach=yes --leak-check=full --show-reachable=yes"
164 ${DEBUGGER} ./folding \
165 --random-seed=${SEED} \
166 --pool-name=${POOL_NAME} \
167 --result-path=${EXPERIMENT_RESULT_DIR} \
168 --detector-name=${EXPERIMENT_RESULT_DIR}/default.det \
174 sequence-test-detector | tee -a ${EXPERIMENT_RESULT_DIR}/stdout
178 echo "${EXPERIMENT_RESULT_DIR} exists, cancelling that run."