--- /dev/null
+#!/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 by Francois Fleuret, (C) IDIAP #
+# Contact <francois.fleuret@idiap.ch> for comments & bug reports #
+#########################################################################
+
+MAIN_URL="http://www.idiap.ch/folded-ctf"
+
+# Compiling
+
+make -j -k
+
+echo
+
+# Generating the pool file
+
+DATA_PATH=./rmk-data
+POOL_NAME=${DATA_PATH}/rmk.pool
+
+if [[ -d ${DATA_PATH} ]]; then
+
+ if [[ -f ${POOL_NAME} ]]; then
+
+ echo "The pool file exists."
+
+ else
+
+ echo "Can not find the pool file, checking the data integrity."
+
+ md5sum -c ${DATA_PATH}/list.md5
+
+ if [[ $? != 0 ]]; then
+ echo "The data set is corrupted. You can download it" >&2
+ echo "from ${MAIN_URL}" >&2
+ exit 1
+ fi
+
+ echo "Generating the pool file."
+
+ ./list_to_pool ${DATA_PATH}/full.lst ${DATA_PATH} ${POOL_NAME}.wrk
+
+ if [[ $? == 0 ]]; then
+ mv ${POOL_NAME}.wrk ${POOL_NAME}
+ else
+ \rm ${POOL_NAME}.wrk 2> /dev/null
+ echo "Pool generation failed." >&2
+ exit 1
+ fi
+
+ fi
+
+else
+
+ echo "Can not find the RateMyKitten images in ${DATA_PATH}. You can" >&2
+ echo "download 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
+
+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
+
+ 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
+
+ else
+
+ echo "${EXPERIMENT_RESULT_DIR} exists, aborting experiment."
+
+ fi
+
+ done
+
+done