Skip to content
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 PNG reading support #2382

Merged
merged 136 commits into from
Jul 3, 2020
Merged

Add PNG reading support #2382

merged 136 commits into from
Jul 3, 2020

Conversation

fmassa
Copy link
Member

@fmassa fmassa commented Jul 2, 2020

Follow-up from #2379 (comment)

Thanks to @peterjc123 , we found out that there was a bug in the tests that were preventing them to run.

@fmassa
Copy link
Member Author

fmassa commented Jul 2, 2020

@andfoy Seems like Windows is not able to find libpng. I'm going to be reverting your PR again, can you integrate the changes in this branch and then try fixing the issues with Windows?

@peterjc123
Copy link
Contributor

Hi @andfoy, I've made a few suggestions in #2379 (review). Hopefully that may help you to get libpng to be found before installation.

@andfoy
Copy link
Contributor

andfoy commented Jul 2, 2020

Thanks @peterjc123! Let me apply those suggestions here and hopefully it will work as expected

setup.py Show resolved Hide resolved
torchvision/io/image.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jul 2, 2020

Codecov Report

Merging #2382 into master will increase coverage by 0.00%.
The diff coverage is 70.96%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2382   +/-   ##
=======================================
  Coverage   70.76%   70.76%           
=======================================
  Files          93       94    +1     
  Lines        7788     7819   +31     
  Branches     1209     1214    +5     
=======================================
+ Hits         5511     5533   +22     
- Misses       1913     1918    +5     
- Partials      364      368    +4     
Impacted Files Coverage Δ
torchvision/io/image.py 70.96% <70.96%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 39e4057...d0fd739. Read the comment docs.

@andfoy
Copy link
Contributor

andfoy commented Jul 2, 2020

pytorch/pytorch#40928 is passing, so that means that the documentation build was fixed as well

@peterjc123
Copy link
Contributor

@fmassa You can merge it if you like.

@fmassa fmassa merged commit 5247f7b into pytorch:master Jul 3, 2020
@fmassa fmassa deleted the fix-image-ext-test branch July 3, 2020 08:33
@fmassa
Copy link
Member Author

fmassa commented Jul 3, 2020

Thanks @andfoy and @peterjc123 !

@fmassa fmassa changed the title Fix image extension tests Add PNG reading support Jul 3, 2020
de-vri-es pushed a commit to fizyr-forks/torchvision that referenced this pull request Aug 4, 2020
* Add libpng requirement into conda recipe

* Try to install libjpeg-turbo

* Add PNG reading capabilities

* Remove newline

* Add image extension to compilation instructions

* Include png functions as part of the main library

* Update CMakeLists

* Detect if building on conda-build

* Debug

* More debug messages

* Print globbed libreries

* Print globbed libreries

* Point to correct PNG path

* Remove libJPEG preventively

* Debug extension loading

* Link libpng explicitly

* Link with PNG

* Add PNG reading capabilities

* Add libpng requirement into conda recipe

* Try to install libjpeg-turbo

* Remove newline

* Add image extension to compilation instructions

* Include png functions as part of the main library

* Update CMakeLists

* Detect if building on conda-build

* Debug

* More debug messages

* Print globbed libreries

* Print globbed libreries

* Point to correct PNG path

* Remove libJPEG preventively

* Debug extension loading

* Link libpng explicitly

* Link with PNG

* Install libpng on conda-based wheel distributions

* Add -y flag

* Add -y flag to yum

* Locate LibPNG on windows conda

* Remove empty else

* Copy libpng16.so

* Copy dylib on Mac

* Improve check on Windows

* Try to install ninja using conda on windows

* Use libpng on Windows

* Package lib on windows wheel

* Point library to the correct place

* Include binaries as part of wheel

* Copy libpng.so on linux

* Look for png.h on Windows when using conda-build

* Do not skip png tests on Mac/Win

* Restore libjpeg-turbo

* Install jpeg-turbo on wheel distributions

* Install libjpeg-turbo from conda-forge on wheel distributions

* Do not pull av on conda-build

* Add pillow disclaimer

* Vendors libjpeg-turbo 2.0.4

* Merge JPEG work

* Remove submodules

* Regenerate circle config

* Fix style issues

* Fix C++ style issues

* More style corrections

* Add JPEG-turbo to linking libraries

* More style corrections

* More style corrections

* More style corrections

* Install libjpeg-turbo-devel

* Install libturbo-jpeg on typing pipeline

* Update Circle template

* Windows and Unix turbojpeg have the same linking name

* Install turbojpeg-devel instead of libjpeg-turbo

* Copy TurboJPEG binaries to wheel

* Move test image

* Move back test image

* Update JPEG test path

* Remove dot from extension

* Move image functions to extension

* Use stdout arg in subprocess

* Disable image extension if libpng or turbojpeg are not found

* Append libpng stdout

* Prevent list appending on lists

* Minor path correction

* Minor error correction

* Add linking flags

* Style issues correction

* Address minor review corrections

* Refactor library search

* Restore access index

* Fix JPEG tests

* Update libpng version in Travis

* Add -y flag

* Remove dot

* Update libpng using apt

* Check libpng version

* Change libturbojpeg binary

* Update import

* Change call

* Restore av in conda recipe

* Minor error correction

* Remove unused comment in travis.yml

* Update README

* Fix missing links

* Remove fixes for 16.04

* Remove JPEG-related code

* Remove installation references to turbojpeg

* Remove further references to turbojpeg

* Fix c++ style issues

* Fix c++ style issues

* Fix libpng-config include flag parsing

* Remove conda-forge

* Remove include dirs from main extension

* Do not pass extra include and library paths to main torchvision extension

* Add libpng to environment.yml

* Remove inexistent imports

* Add instructions regarding environment variables to README

* Fix image extension tests

* Add libpng to environment + test fixes

* Minor improvements

* Remove unused Py2 code

* Add stub comments to prevent deletion while merging

* Reintroduce files in order to prevent deletion during merge

* Remove unwanted merge sections

* Restore libpng conda installation on wheel distributions

* Restore comment

* Fix libpng discovery on Windows

* Fix PEP8 style issues

* Add linking flag on Windows

* Remove parenthesis

* Restore libpng during runtime

Co-authored-by: Edgar Andrés Margffoy Tuay <andfoy@gmail.com>
Co-authored-by: Ryad ZENINE <r.zenine@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants