3 # dyncnn is a deep-learning algorithm for the prediction of
4 # interacting object dynamics
6 # Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
7 # Written by Francois Fleuret <francois.fleuret@idiap.ch>
9 # This file is part of dyncnn.
11 # dyncnn is free software: you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License version 3 as
13 # published by the Free Software Foundation.
15 # dyncnn is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with dyncnn. If not, see <http://www.gnu.org/licenses/>.
23 # This script creates the synthetic data-set for shape collision
28 [[ "${TORCH_NB_THREADS}" ]] || echo "You can set \$TORCH_NB_THREADS to the proper value (default 1)."
29 [[ "${TORCH_USE_GPU}" ]] || echo "You can set \$TORCH_USE_GPU to 'yes' or 'no' (default 'no')."
30 [[ "${DYNCNN_DATA_DIR}" ]] || DYNCNN_DATA_DIR="./data/10p-mg"
31 [[ "${DYNCNN_RESULT_DIR}" ]] || DYNCNN_RESULT_DIR="./results"
33 if [[ -d "${DYNCNN_DATA_DIR}" ]]; then
34 echo "Found ${DYNCNN_DATA_DIR}, checking the number of images in there."
35 if [[ $(find "${DYNCNN_DATA_DIR}" -name "dyn_*.png" | wc -l) == 150000 ]]; then
38 echo "I do not find the proper number of images. Please remove the dir and re-run this scripts, or fix manually."
42 # Creating the data-base
44 mkdir -p "${DYNCNN_DATA_DIR}"
46 --every_nth 4 --nb_frames 5 \
47 --multi_grasp --nb_shapes 10 \
48 --dir "${DYNCNN_DATA_DIR}"
51 # Train the model (takes days)
53 if [[ ! -f "${DYNCNN_RESULT_DIR}"/epoch_01000_model ]]; then
54 ./dyncnn.lua --heavy --dataDir="${DYNCNN_DATA_DIR}" \
56 --resultDir "${DYNCNN_RESULT_DIR}" \
60 # Create the images of internal activations
63 ./dyncnn.lua --heavy --dataDir=./data/10p-mg/ \
64 --learningStateFile="${DYNCNN_RESULT_DIR}"/epoch_01000_model \
65 --resultDir="${DYNCNN_RESULT_DIR}" \
67 --exampleInternals=${n}