-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add encoding and writing PNG ops #2726
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2726 +/- ##
==========================================
+ Coverage 72.91% 72.93% +0.01%
==========================================
Files 95 95
Lines 8233 8238 +5
Branches 1279 1279
==========================================
+ Hits 6003 6008 +5
Misses 1838 1838
Partials 392 392
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* Add encode/write_png functions * Do not redefine * Style issues correction * Comply with low-level interface * Minor comment correction * Add python frontend functions * Add encode_png test * Pass compession level to encode_png * Do not compare output buffers * Convert to bytes * Compare pil image instead of buffer * Add error tests * Add test_write_png * Remove png test assets * Register writePNG correctly * Update write_png docstring * Do not preserve PIL image beyond the scope Co-authored-by: Francisco Massa <[email protected]>
* Add encode/write_png functions * Do not redefine * Style issues correction * Comply with low-level interface * Minor comment correction * Add python frontend functions * Add encode_png test * Pass compession level to encode_png * Do not compare output buffers * Convert to bytes * Compare pil image instead of buffer * Add error tests * Add test_write_png * Remove png test assets * Register writePNG correctly * Update write_png docstring * Do not preserve PIL image beyond the scope Co-authored-by: Francisco Massa <[email protected]>
This PR introduces new encoding and writing operators to the torchvision image frontend, as follows:
encode_png
: Takes a CHW tensor as input and produces a byte buffer containing the PNG file in tensor form.write_png
: Takes a CHW tensor and a filename and writes the image into a PNG file in disk.