提交 05740c6b 编写于 作者: S superjom

updte image

上级 64f2816c
...@@ -118,10 +118,12 @@ def get_invididual_image(storage, mode, tag, step_index, max_size=80): ...@@ -118,10 +118,12 @@ def get_invididual_image(storage, mode, tag, step_index, max_size=80):
image = reader.image(tag) image = reader.image(tag)
record = image.record(step_index, offset) record = image.record(step_index, offset)
shape = record.shape()
data = np.array(record.data(), dtype='uint8').reshape(record.shape()) data = np.array(record.data(), dtype='uint8').reshape(record.shape())
tempfile = NamedTemporaryFile(mode='w+b', suffix='.png') tempfile = NamedTemporaryFile(mode='w+b', suffix='.png')
with Image.fromarray(data) as im: with Image.fromarray(data) as im:
size = max(record.shape[0], record.shape[1]) size = max(shape[0], shape[1])
if size > max_size: if size > max_size:
scale = max_size * 1. / size scale = max_size * 1. / size
im = im.resize(shape[:2]) im = im.resize(shape[:2])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册