Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.pytorch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.learn.pytorch
Merge requests
!37
Use matplotlib to save images
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Use matplotlib to save images
fixes_plot
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Anjith GEORGE
requested to merge
fixes_plot
into
master
5 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
The old one breaks for the new scipy version; replaces image saving with matplotlib.
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
40c5f1dc
1 commit,
5 years ago
1 file
+
2
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
bob/learn/pytorch/trainers/tflog.py
+
2
−
2
Options
# 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
(),
Loading