Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.learn.pytorch
Commits
40c5f1dc
Commit
40c5f1dc
authored
Aug 26, 2019
by
Anjith GEORGE
Browse files
Use matplotlib to save images
parent
d25aaf5f
Pipeline
#32742
passed with stage
in 56 minutes and 1 second
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
bob/learn/pytorch/trainers/tflog.py
View file @
40c5f1dc
# Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
import
tensorflow
as
tf
import
numpy
as
np
import
scipy.misc
import
matplotlib.pyplot
as
plt
try
:
from
StringIO
import
StringIO
# Python 2.7
except
ImportError
:
...
...
@@ -29,7 +29,7 @@ class Logger(object):
s
=
StringIO
()
except
:
s
=
BytesIO
()
scipy
.
misc
.
toimage
(
img
).
save
(
s
,
format
=
"
png
"
)
plt
.
imsave
(
s
,
img
,
format
=
'
png
'
)
# Create an Image object
img_sum
=
tf
.
Summary
.
Image
(
encoded_image_string
=
s
.
getvalue
(),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment