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

Benchmarking against Pillow-SIMD w/libjpeg-turbo #1

Open
willprice opened this issue Feb 25, 2021 · 4 comments
Open

Benchmarking against Pillow-SIMD w/libjpeg-turbo #1

willprice opened this issue Feb 25, 2021 · 4 comments

Comments

@willprice
Copy link

Hey @cceyda,
I came here via https://cceyda.github.io/blog/dali/cv/image_processing/2020/11/10/nvidia_dali.html
nice blog post!
Did you use pillow-simd built against libjpeg-turbo, or just the vanilla version? I find libjpeg-turbo speeds things up considerably (even compared to opencv it's 3x fast in my benchmarks). Also check out simplejpeg which so far seems to be the fasted jpeg loader I've yet to come across.

@cceyda
Copy link
Owner

cceyda commented Feb 26, 2021

Thank you for your comment 😄
I have re-run and updated the benchmarks in benchmark_jpeg_decode.ipynb adding libjpeg-turbo check.

  • libjpeg-turbo vs pip installed pillow-simd makes about a 50ms difference, still slower than others.

Also not yet included in those benchmarks; I tried out nvidia-dali on an A100 GPU (which is supposed to be faster than a TITAN X ,for reasons I mention in my blog post)
And got the results like below:
image
(*pil-simd(turbo))
Mind you this is on a different machine than the results in the previous notebook, and I still need to profile what is happening
BUT...

It looks like it is always faster to use DALI > torchvision > pil-simd(turbo) > pil-simd > pil

Haven't had the chance to try simplejpeg yet but I think It would perform similarly to pil-simd(turbo) since it is based on it.

@willprice
Copy link
Author

Hi @cceyda,
I had a little play around last night and came up with these findings https://twitter.com/will_price_94/status/1365057412902891521
It's interesting you found torchvision quicker than pillow-simd with libjpeg-turbo. I found the opposite. I've found simplejpeg to be the fastest of the CPU options.
I'd be curious if we can figure out why we have conflicting results on pillow-simd. Your benchmark is more realistic, whereas mine is just decoding the same image repeatedly.

@cceyda
Copy link
Owner

cceyda commented Feb 26, 2021

Nice~ I have upgraded my script to include OpenCV and simplejpeg.
It looks like simplejpeg is FASTER than pillow-simd and torchvision(0.8.2)! 🤔 Thanks for sharing 😄
FYI: My benchmarks are on bytes->Tensor because that was my use case. Feel free to adapt it to yours

@willprice
Copy link
Author

Good to know you also found simplejpeg fast too. It's a great library that deserves wider use! The author also has an interesting project called augpy that has NvJPEG decoding.

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

No branches or pull requests

2 participants