Example adding various images#490
Open
gar1t wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #490 +/- ##
==========================================
+ Coverage 89.07% 89.12% +0.05%
==========================================
Files 37 37
Lines 2562 2566 +4
==========================================
+ Hits 2282 2287 +5
+ Misses 280 279 -1 ☔ View full report in Codecov by Harness. |
Owner
|
Sorry for missing this PR. It would be good to minimize the overhead to convert the data back and forth. As of your suggestion, I think passing "string arg for image" might conflict with the usage of caffe2 blob name (use string to index tensor). I would suggest using What do you think? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is inspired by #21, which wants a way to easily add a PNG as an image summary. The examples demonstrate how to do this.
FWIW I think this example is a very reasonable feature addition:
The rationale for closing #21 was that this sort of encoding is best left to the user. I disagree based on the following:
tensorboardX already uses a PIL.Image instance to encode a numpy array to PNG bytes
If given a PIL.Image instance, tensorboardX can skip the step of generating one from the numpy array (this is shown in the example)
If given a string value as the second argument to
writer.add_image, tensorboardX can trivially callPIL.Image.openand use that image instance to encode the PNG bytes for the summaryThis PR is valid as a stand-alone example, but I also hope it makes the case to support the following enhancements to
writer.add_image:PIL.Image.openI'm happy to implement those changes in another PR but I wanted to start this discussion with an example (useful in its own right).