提交 990b7d7b 编写于 作者: W wanghaoshuang

rename xmap to xmap_readers and remove 'from cv2 import resize' in image.py

上级 e62a4d7a
......@@ -105,7 +105,8 @@ def reader_creator(data_file,
for sample, label in itertools.izip(data, batch['label']):
yield sample, int(label)
return paddle.reader.xmap(mapper, reader, cpu_count(), buffered_size)
return paddle.reader.xmap_readers(mapper, reader,
cpu_count(), buffered_size)
def train(mapper=default_mapper, buffered_size=1024):
......
......@@ -3,8 +3,6 @@ try:
import cv2
except ImportError:
cv2 = None
from cv2 import resize
import os
import tarfile
import cPickle
......@@ -164,7 +162,7 @@ def resize_short(im, size):
h_new = size * h / w
else:
w_new = size * w / h
im = resize(im, (h_new, w_new), interpolation=cv2.INTER_CUBIC)
im = cv2.resize(im, (h_new, w_new), interpolation=cv2.INTER_CUBIC)
return im
......
......@@ -14,7 +14,7 @@
__all__ = [
'map_readers', 'buffered', 'compose', 'chain', 'shuffle',
'ComposeNotAligned', 'firstn', 'xmap'
'ComposeNotAligned', 'firstn', 'xmap_readers'
]
import itertools
......@@ -230,7 +230,7 @@ class XmapEndSignal():
pass
def xmap(mapper, reader, process_num, buffer_size):
def xmap_readers(mapper, reader, process_num, buffer_size):
"""
Use multiprocess to map samples from reader by a mapper defined by user.
And this function contains a buffered decorator.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册