[[ "${DYNCNN_DATA_DIR}" ]] || DYNCNN_DATA_DIR="./data/10p-mg"
[[ "${DYNCNN_RESULT_DIR}" ]] || DYNCNN_RESULT_DIR="./results"
+######################################################################
+# Create the data-set if needed
+
if [[ -d "${DYNCNN_DATA_DIR}" ]]; then
echo "Found ${DYNCNN_DATA_DIR}, checking the number of images in there."
if [[ $(find "${DYNCNN_DATA_DIR}" -name "dyn_*.png" | wc -l) == 150000 ]]; then
--dir "${DYNCNN_DATA_DIR}"
fi
-# Train the model (takes days)
+######################################################################
+# Train the model (~30h on a GTX1080)
if [[ ! -f "${DYNCNN_RESULT_DIR}"/epoch_01000_model ]]; then
./dyncnn.lua --heavy --dataDir="${DYNCNN_DATA_DIR}" \
--nbEpochs 1000
fi
+######################################################################
# Create the images of internal activations
for n in 2 12; do
--noLog \
--exampleInternals=${n}
done
+
+######################################################################
+# Plot the loss curves if gnuplot is here
+
+if [[ $(which gnuplot) ]]; then
+ echo "Plotting losses.pdf."
+
+ TERMINAL="pdfcairo color transparent enhanced font \"Times,14\""
+ EXTENSION="pdf"
+
+ gnuplot <<EOF
+set terminal ${TERMINAL}
+set output "${DYNCNN_RESULT_DIR}/losses.${EXTENSION}"
+set logscale x
+set logscale y
+set size ratio 0.75
+set xlabel "Number of epochs"
+set ylabel "Loss"
+plot '< grep "LOSS " "${DYNCNN_RESULT_DIR}"/log' using 2:4 with l lw 3 lc rgb '#c0c0ff' title 'Validation loss',\
+ '< grep "LOSS " "${DYNCNN_RESULT_DIR}"/log' using 2:3 with l lw 1 lc rgb '#000000' title 'Train loss'
+
+EOF
+
+fi
+
+######################################################################