Skip to content
Snippets Groups Projects
Commit 5878e035 authored by Anjith GEORGE's avatar Anjith GEORGE
Browse files

Merge branch 'fixes_plot' into 'master'

Use matplotlib to save images

See merge request !37
parents d25aaf5f 40c5f1dc
No related branches found
No related tags found
1 merge request!37Use matplotlib to save images
Pipeline #32773 passed
# Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514 # Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
import tensorflow as tf import tensorflow as tf
import numpy as np import numpy as np
import scipy.misc import matplotlib.pyplot as plt
try: try:
from StringIO import StringIO # Python 2.7 from StringIO import StringIO # Python 2.7
except ImportError: except ImportError:
...@@ -29,7 +29,7 @@ class Logger(object): ...@@ -29,7 +29,7 @@ class Logger(object):
s = StringIO() s = StringIO()
except: except:
s = BytesIO() s = BytesIO()
scipy.misc.toimage(img).save(s, format="png") plt.imsave(s, img, format='png')
# Create an Image object # Create an Image object
img_sum = tf.Summary.Image(encoded_image_string=s.getvalue(), img_sum = tf.Summary.Image(encoded_image_string=s.getvalue(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment