Skip to content

Commit

Permalink
[image-classification] default use min_random_scale=1, add data/image…
Browse files Browse the repository at this point in the history
…net1k-val.sh (apache#4295)
  • Loading branch information
mli authored Dec 20, 2016
1 parent e62fbe1 commit 1446bfc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions example/image-classification/data/imagenet1k-val.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# This file download the imagnet-1k validation dataset and convert it into a rec
# file. One need to provide the URL for the ILSVRC2012_img_val.tar, which can be
# find at http://www.image-net.org/download-images
#
# Example usage (replace the URL with the correct one):
# ./imagenet1k-val.sh http://xxxxxx/challenges/LSVRC/2012/nnoupb/ILSVRC2012_img_val.tar

if [ ! -e ILSVRC2012_img_val.tar ]; then
wget $1
fi
mkdir -p val
tar -xf ILSVRC2012_img_val.tar -C val
wget http://data.mxnet.io/models/imagenet/resnet/val.lst -O imagenet1k-val.lst

CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MX_DIR=${CUR_DIR}/../../../

python ${CUR_DIR}/../../../tools/im2rec.py --resize 256 --quality 90 --num-thread 16 imagenet1k-val val/

rm -rf val
3 changes: 2 additions & 1 deletion example/image-classification/train_imagenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
num_classes = 1000,
num_examples = 1281167,
image_shape = '3,224,224',
min_random_scale = 0.533, # assume input image has min size 480, 0.533 = 256/480
min_random_scale = 1, # if input image has min size k, suggest to use
# 256.0/x, e.g. 0.533 for 480
# train
num_epochs = 80,
lr_step_epochs = '30,60',
Expand Down

0 comments on commit 1446bfc

Please sign in to comment.