|
|
|
@ -20,9 +20,11 @@ with segmentation has been increased from 7,062 to 9,993.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import tarfile
|
|
|
|
|
import io
|
|
|
|
|
import numpy as np
|
|
|
|
|
from common import download
|
|
|
|
|
from paddle.v2.image import *
|
|
|
|
|
from PIL import Image
|
|
|
|
|
|
|
|
|
|
__all__ = ['train', 'test', 'val']
|
|
|
|
|
|
|
|
|
@ -51,8 +53,10 @@ def reader_creator(filename, sub_name):
|
|
|
|
|
label_file = LABEL_FILE.format(line)
|
|
|
|
|
data = tarobject.extractfile(name2mem[data_file]).read()
|
|
|
|
|
label = tarobject.extractfile(name2mem[label_file]).read()
|
|
|
|
|
data = load_image_bytes(data)
|
|
|
|
|
label = load_image_bytes(label)
|
|
|
|
|
data = Image.open(io.BytesIO(data))
|
|
|
|
|
label = Image.open(io.BytesIO(label))
|
|
|
|
|
data = np.array(data)
|
|
|
|
|
label = np.array(label)
|
|
|
|
|
yield data, label
|
|
|
|
|
|
|
|
|
|
return reader
|
|
|
|
|