提交 d8384c8e 编写于 作者: M minqiyang

Polish code

test=develop
上级 5ae34fb9
...@@ -35,7 +35,6 @@ import itertools ...@@ -35,7 +35,6 @@ import itertools
import functools import functools
from .common import download from .common import download
import tarfile import tarfile
import six
import scipy.io as scio import scipy.io as scio
from paddle.dataset.image import * from paddle.dataset.image import *
from paddle.reader import * from paddle.reader import *
...@@ -45,7 +44,6 @@ import numpy as np ...@@ -45,7 +44,6 @@ import numpy as np
from multiprocessing import cpu_count from multiprocessing import cpu_count
import six import six
from six.moves import cPickle as pickle from six.moves import cPickle as pickle
from six.moves import zip
__all__ = ['train', 'test', 'valid'] __all__ = ['train', 'test', 'valid']
DATA_URL = 'http://paddlemodels.cdn.bcebos.com/flowers/102flowers.tgz' DATA_URL = 'http://paddlemodels.cdn.bcebos.com/flowers/102flowers.tgz'
...@@ -127,11 +125,11 @@ def reader_creator(data_file, ...@@ -127,11 +125,11 @@ def reader_creator(data_file,
batch = pickle.load(f) batch = pickle.load(f)
else: else:
batch = pickle.load(f, encoding='bytes') batch = pickle.load(f, encoding='bytes')
if batch is not None: if six.PY3:
batch = cpt.to_text(batch) batch = cpt.to_text(batch)
data = batch['data'] data = batch['data']
labels = batch['label'] labels = batch['label']
for sample, label in zip(data, batch['label']): for sample, label in six.moves.zip(data, batch['label']):
yield sample, int(label) - 1 yield sample, int(label) - 1
if not cycle: if not cycle:
break break
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册