From b5803c627a4e03d9ecf90b22d4e30d31dd814b7a Mon Sep 17 00:00:00 2001 From: Kai Li Date: Wed, 19 Mar 2014 23:20:09 +0800 Subject: [PATCH 1/3] Fix shell script current dir bad substition errors --- data/cifar10/get_cifar10.sh | 2 +- data/ilsvrc12/get_ilsvrc_aux.sh | 2 +- data/mnist/get_mnist.sh | 2 +- scripts/build_and_deploy_docs.sh | 2 +- tools/extra/parselog.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/data/cifar10/get_cifar10.sh b/data/cifar10/get_cifar10.sh index ac72b1fd62d..ea99893e06b 100755 --- a/data/cifar10/get_cifar10.sh +++ b/data/cifar10/get_cifar10.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh # This scripts downloads the CIFAR10 (binary version) data and unzips it. -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +DIR="$(readlink -f $(dirname "$0"))" cd $DIR echo "Downloading..." diff --git a/data/ilsvrc12/get_ilsvrc_aux.sh b/data/ilsvrc12/get_ilsvrc_aux.sh index 9ba90d8f785..1c6d3e6abd1 100755 --- a/data/ilsvrc12/get_ilsvrc_aux.sh +++ b/data/ilsvrc12/get_ilsvrc_aux.sh @@ -6,7 +6,7 @@ # - synset ids and words # - the training splits with labels -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +DIR="$(readlink -f $(dirname "$0"))" cd $DIR echo "Downloading..." diff --git a/data/mnist/get_mnist.sh b/data/mnist/get_mnist.sh index b119b42e17e..8295acdb91f 100755 --- a/data/mnist/get_mnist.sh +++ b/data/mnist/get_mnist.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh # This scripts downloads the mnist data and unzips it. -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +DIR="$(readlink -f $(dirname "$0"))" cd $DIR echo "Downloading..." diff --git a/scripts/build_and_deploy_docs.sh b/scripts/build_and_deploy_docs.sh index 85121b6e276..fdb75dbf6a4 100755 --- a/scripts/build_and_deploy_docs.sh +++ b/scripts/build_and_deploy_docs.sh @@ -15,7 +15,7 @@ MSG=`git log --oneline -1` if [[ $BRANCH = 'master' ]]; then # Find the docs dir, no matter where the script is called - DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + DIR="$(readlink -f $(dirname "$0"))" DOCS_SITE_DIR=$DIR/../docs/_site # Make sure that docs/_site tracks remote:gh-pages. diff --git a/tools/extra/parselog.sh b/tools/extra/parselog.sh index 39927a64fcc..6d65f48ee34 100755 --- a/tools/extra/parselog.sh +++ b/tools/extra/parselog.sh @@ -4,7 +4,7 @@ # another one caffe.log.loss that contains the loss computed during the training #get the dirname of the script -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +DIR="$(readlink -f $(dirname "$0"))" if [ "$#" -lt 1 ] then From d096d71c97d7d17d1e5745e35821ae9691c58356 Mon Sep 17 00:00:00 2001 From: Kai Li Date: Wed, 19 Mar 2014 23:21:19 +0800 Subject: [PATCH 2/3] Wget should never be quiet --- data/cifar10/get_cifar10.sh | 2 +- data/ilsvrc12/get_ilsvrc_aux.sh | 2 +- data/mnist/get_mnist.sh | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/cifar10/get_cifar10.sh b/data/cifar10/get_cifar10.sh index ea99893e06b..3498117cf92 100755 --- a/data/cifar10/get_cifar10.sh +++ b/data/cifar10/get_cifar10.sh @@ -6,7 +6,7 @@ cd $DIR echo "Downloading..." -wget -q http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz +wget http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz echo "Unzipping..." diff --git a/data/ilsvrc12/get_ilsvrc_aux.sh b/data/ilsvrc12/get_ilsvrc_aux.sh index 1c6d3e6abd1..2c7f48c9080 100755 --- a/data/ilsvrc12/get_ilsvrc_aux.sh +++ b/data/ilsvrc12/get_ilsvrc_aux.sh @@ -11,7 +11,7 @@ cd $DIR echo "Downloading..." -wget -q https://www.dropbox.com/s/g5myor4y2scdv95/caffe_ilsvrc12.tar.gz +wget https://www.dropbox.com/s/g5myor4y2scdv95/caffe_ilsvrc12.tar.gz echo "Unzipping..." diff --git a/data/mnist/get_mnist.sh b/data/mnist/get_mnist.sh index 8295acdb91f..07c017b073f 100755 --- a/data/mnist/get_mnist.sh +++ b/data/mnist/get_mnist.sh @@ -6,10 +6,10 @@ cd $DIR echo "Downloading..." -wget -q http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz -wget -q http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz -wget -q http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz -wget -q http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz +wget http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz +wget http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz +wget http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz +wget http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz echo "Unzipping..." From 2ac5785561246ed99df3e32137257d412b1815bd Mon Sep 17 00:00:00 2001 From: Kai Li Date: Wed, 19 Mar 2014 23:26:14 +0800 Subject: [PATCH 3/3] File naming convention requires that two words be split by a underscore --- tools/extra/{parselog.sh => parse_log.sh} | 4 ++-- tools/extra/plot_log.gnuplot.example | 4 ++-- tools/extra/plot_training_log.py.example | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename tools/extra/{parselog.sh => parse_log.sh} (95%) diff --git a/tools/extra/parselog.sh b/tools/extra/parse_log.sh similarity index 95% rename from tools/extra/parselog.sh rename to tools/extra/parse_log.sh index 6d65f48ee34..998446057e5 100755 --- a/tools/extra/parselog.sh +++ b/tools/extra/parse_log.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Usage parselog.sh caffe.log +# Usage parse_log.sh caffe.log # It creates two files one caffe.log.test that contains the loss and test accuracy of the test and # another one caffe.log.loss that contains the loss computed during the training @@ -8,7 +8,7 @@ DIR="$(readlink -f $(dirname "$0"))" if [ "$#" -lt 1 ] then -echo "Usage parselog.sh /path/to/your.log" +echo "Usage parse_log.sh /path/to/your.log" exit fi LOG=`basename $1` diff --git a/tools/extra/plot_log.gnuplot.example b/tools/extra/plot_log.gnuplot.example index 925d04957c7..76715c589f8 100644 --- a/tools/extra/plot_log.gnuplot.example +++ b/tools/extra/plot_log.gnuplot.example @@ -5,9 +5,9 @@ # You had better check the data files before designing your own plots. # Please generate the neccessary data files with -# /path/to/caffe/scripts/parselog.sh before plotting. +# /path/to/caffe/scripts/parse_log.sh before plotting. # Example usage: -# ./parselog.sh mnist.log +# ./parse_log.sh mnist.log # Now you have mnist.log.train and mnist.log.test. # gnuplot mnist.gnuplot diff --git a/tools/extra/plot_training_log.py.example b/tools/extra/plot_training_log.py.example index a68ab2f6c32..b6fda54e01c 100755 --- a/tools/extra/plot_training_log.py.example +++ b/tools/extra/plot_training_log.py.example @@ -11,7 +11,7 @@ import matplotlib.markers as mks def get_log_parsing_script(): dirname = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) - return dirname + '/parselog.sh' + return dirname + '/parse_log.sh' def get_log_file_suffix(): return '.log'