From 88a7cbd6392540dcef4d84fef1324c0b33c62b0c Mon Sep 17 00:00:00 2001 From: dangqingqing Date: Wed, 23 Nov 2016 21:02:00 +0800 Subject: [PATCH] Use empty file list for paddle/image. --- benchmark/.gitignore | 9 +++++++++ benchmark/paddle/image/provider.py | 9 ++++----- benchmark/paddle/image/run.sh | 20 +++----------------- 3 files changed, 16 insertions(+), 22 deletions(-) create mode 100644 benchmark/.gitignore diff --git a/benchmark/.gitignore b/benchmark/.gitignore new file mode 100644 index 0000000000..7b66e8a5b5 --- /dev/null +++ b/benchmark/.gitignore @@ -0,0 +1,9 @@ +paddle/image/logs +paddle/image/*.pyc +paddle/image/train.list +paddle/rnn/logs +paddle/rnn/*.pyc +paddle/rnn/imdb.pkl +caffe/image/logs +tensorflow/image/logs +tensorflow/rnn/logs diff --git a/benchmark/paddle/image/provider.py b/benchmark/paddle/image/provider.py index b6bc0e9aa2..1ac47212b5 100644 --- a/benchmark/paddle/image/provider.py +++ b/benchmark/paddle/image/provider.py @@ -20,8 +20,7 @@ def initHook(settings, height, width, color, num_class, **kwargs): @provider( init_hook=initHook, min_pool_size=-1, cache=CacheType.CACHE_PASS_IN_MEM) def process(settings, file_list): - with open(file_list, 'r') as fdata: - for line in fdata: - img = np.random.rand(1, settings.data_size).reshape(-1, 1).flatten() - lab = random.randint(0, settings.num_class) - yield img.tolist(), int(lab) + for i in xrange(1024): + img = np.random.rand(1, settings.data_size).reshape(-1, 1).flatten() + lab = random.randint(0, settings.num_class) + yield img.astype('float32'), int(lab) diff --git a/benchmark/paddle/image/run.sh b/benchmark/paddle/image/run.sh index a216928835..717ed487ba 100755 --- a/benchmark/paddle/image/run.sh +++ b/benchmark/paddle/image/run.sh @@ -1,21 +1,5 @@ set -e -# If use `paddle train` to run, it must use DataProvider to -# pass the data type to PaddlePaddle system. -# And PaddlePaddle requires training set list (train.list), -function gen_file() { - if [ ! -d "train.txt" ]; then - for ((i=1;i<=1024;i++)) - do - echo "train/n09246464/n09246464_38735.jpeg 972" >> train.txt - done - fi - - if [ ! -d "train.list" ]; then - echo "train.txt" > train.list - fi -} - function train() { cfg=$1 thread=$2 @@ -32,7 +16,9 @@ function train() { > logs/$prefix-${thread}gpu-$bz.log 2>&1 } -gen_file +if [ ! -d "train.list" ]; then + echo " " > train.list +fi if [ ! -d "logs" ]; then mkdir logs fi -- GitLab