提交 88a7cbd6 编写于 作者: D dangqingqing

Use empty file list for paddle/image.

上级 b1cc9da4
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
......@@ -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)
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册