未验证 提交 617c2dec 编写于 作者: Y Yan Chunwei 提交者: GitHub

bugfix/image get sample out of range (#136)

上级 971578c6
...@@ -6,6 +6,7 @@ from tempfile import NamedTemporaryFile ...@@ -6,6 +6,7 @@ from tempfile import NamedTemporaryFile
import numpy as np import numpy as np
from PIL import Image from PIL import Image
from log import logger
def get_modes(storage): def get_modes(storage):
...@@ -102,20 +103,23 @@ def get_image_tag_steps(storage, mode, tag): ...@@ -102,20 +103,23 @@ def get_image_tag_steps(storage, mode, tag):
shape = record.shape() shape = record.shape()
# TODO(ChunweiYan) remove this trick, some shape will be empty # TODO(ChunweiYan) remove this trick, some shape will be empty
if not shape: continue if not shape: continue
# assert shape, "%s,%s" % (mode, tag) try:
query = urllib.urlencode({ query = urllib.urlencode({
'sample': 0, 'sample': 0,
'index': step_index, 'index': step_index,
'tag': origin_tag, 'tag': origin_tag,
'run': mode, 'run': mode,
}) })
res.append({ res.append({
'height': shape[0], 'height': shape[0],
'width': shape[1], 'width': shape[1],
'step': record.step_id(), 'step': record.step_id(),
'wall_time': image.timestamp(step_index), 'wall_time': image.timestamp(step_index),
'query': query, 'query': query,
}) })
except:
logger.error("image sample out of range")
return res return res
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册