从tensorboard日志目录中提取并保存图像

时间:2018-07-24 14:04:27

标签: python tensorflow

我正尝试从tensorflow日志目录中保存图像,如下所示:

   from tensorboard.backend.event_processing.event_accumulator import EventAccumulator

acc = EventAccumulator("logfile")
acc.Reload()

# Print tags of contained entities, use these names to retrieve entities as below
print(acc.Tags())

# E. g. get all values and steps of a scalar called 'l2_loss'
xy_l2_loss = [(s.step, s.value) for s in acc.Scalars('loss/dis_A')]
#print xy_l2_loss
#print acc.Images()
img = acc.Images('A/A-B-A/image/0')
print img
with open('img_{}.png'.format(img.step), 'wb') as f:
  f.write(img.encoded_image_string)

但是我得到如下错误

回溯(最近通话最近):   在第54行的文件“ save_tfimages.py”     使用open('img _ {}。png'.format(img.step),'wb')为f: AttributeError:“ list”对象没有属性“ step”

有人可以引导我吗?预先感谢

0 个答案:

没有答案