summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJeff Donahue <jeff.donahue@gmail.com>2014-05-23 14:57:02 -0700
committerJeff Donahue <jeff.donahue@gmail.com>2014-05-23 14:58:45 -0700
commit2e292c44a7a21d301210bcb724cd91e2108d649e (patch)
tree27b583d924d516f1d2268f0ddc6b058db95fae8b /examples
parentf56f86a38bc990119f511a460f1c87bc39146f4c (diff)
downloadcaffeonacl-2e292c44a7a21d301210bcb724cd91e2108d649e.tar.gz
caffeonacl-2e292c44a7a21d301210bcb724cd91e2108d649e.tar.bz2
caffeonacl-2e292c44a7a21d301210bcb724cd91e2108d649e.zip
add convert_imageset option to resize images; use in
convert_imageset.cpp and document
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/imagenet/create_imagenet.sh42
1 files changed, 37 insertions, 5 deletions
diff --git a/examples/imagenet/create_imagenet.sh b/examples/imagenet/create_imagenet.sh
index a1bcb7bf..8767f120 100755
--- a/examples/imagenet/create_imagenet.sh
+++ b/examples/imagenet/create_imagenet.sh
@@ -5,16 +5,48 @@
TOOLS=../../build/tools
DATA=../../data/ilsvrc12
-echo "Creating leveldb..."
+TRAIN_DATA_ROOT=/path/to/imagenet/train/
+VAL_DATA_ROOT=/path/to/imagenet/val/
+
+# Set RESIZE=true to resize the images to 256x256. Leave as false if images have
+# already been resized using another tool.
+RESIZE=false
+if $RESIZE; then
+ RESIZE_HEIGHT=256
+ RESIZE_WIDTH=256
+else
+ RESIZE_HEIGHT=0
+ RESIZE_WIDTH=0
+fi
+
+if [ ! -d "$TRAIN_DATA_ROOT" ]; then
+ echo "Error: TRAIN_DATA_ROOT is not a path to a directory: $TRAIN_DATA_ROOT"
+ echo "Set the TRAIN_DATA_ROOT variable in create_imagenet.sh to the path" \
+ "where the ImageNet training data is stored."
+ exit 1
+fi
+
+if [ ! -d "$VAL_DATA_ROOT" ]; then
+ echo "Error: VAL_DATA_ROOT is not a path to a directory: $VAL_DATA_ROOT"
+ echo "Set the VAL_DATA_ROOT variable in create_imagenet.sh to the path" \
+ "where the ImageNet validation data is stored."
+ exit 1
+fi
+
+echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin \
- /path/to/imagenet/train/ \
+ $TRAIN_DATA_ROOT \
$DATA/train.txt \
- imagenet_train_leveldb 1
+ imagenet_train_leveldb 1 \
+ $RESIZE_HEIGHT $RESIZE_WIDTH
+
+echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin \
- /path/to/imagenet/val/ \
+ $VAL_DATA_ROOT \
$DATA/val.txt \
- imagenet_val_leveldb 1
+ imagenet_val_leveldb 1 \
+ $RESIZE_HEIGHT $RESIZE_WIDTH
echo "Done."