-
Notifications
You must be signed in to change notification settings - Fork 7
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
benchmark results against other backends #15
Comments
Here with some throughput-oriented benchmarks comparing JpegTurbo.jl and ImageMagick.jl Run on 1.6.2, since 1.7 has much worse ImageMagick.jl performance. To benchmark, I use the first 1024 images of the ImageNette dataset. This comes in 3 sizes: (1) original image size, and each image cropped so that the shortest side is at least (2) 160px or (3) 320px. The data containers were created as follows: # loading file paths using FastAI
using FastAI
N = 1024
imagefiles = MLUtils.datasubset(MLUtils.filterobs(isimagefile, FileDataset(datasetpath("imagenette2"))), 1:N)
imagefiles_160 = MLUtils.datasubset(MLUtils.filterobs(isimagefile, FileDataset(datasetpath("imagenette2-160"))), 1:N)
using ImageMagick, JpegTurbo, MLUtils
data_magick = MLUtils.mapobs(ImageMagick.load, imagefiles)
data_turbo = MLUtils.mapobs(JpegTurbo.jpeg_decode, imagefiles) I then timed iterating over each image using
I then ran the same benchmarks using and
We can see that JpegTurbo consistently beats ImageMagick, not just in runtime but also memory performance. While JpegTurbo offers a speedup in itself, we can see that loading less image (i.e. the 160px versions) makes a bigger difference. Often images are stored in much larger sizes than needed, so storing a downsized version of the dataset helps in loading speed. JpegTurbo, however, can also load an image in at a reduced size directly, using the Here I benchmark loading in the full-size files with
As we can see, on-the-fly downsizing does not quite match the performance of presizing, but compares very favorably with loading the full images. This should be even more pronounced for datasets where the source images are larger. |
Loading the 1.2G pixel image https://www.flickr.com/photos/trevor_dobson_inefekt69/29314390837 on my MacBook pro
Footnotes
|
v0.1.4 (#30) reduces the loading time of the above 1.2G pixel image from 19.2s to 9.2s on my mac mini (M2 Pro) |
JPEG backends comparison
Even though JpegTurbo.jl provides more advanced and efficient in-memory features, the benchmark only tests the
filename
version because all other backends don't support this.Generally speaking, for the filename version, JpegTurbo.jl and OpenCV (python) are the fastest versions since they are both backed by libjpeg-turbo.
v0.1.0
moonsurface Gray{N0f8} (256, 256)
cameraman Gray{N0f8} (512, 512)
pirate Gray{N0f8} (512, 512)
house Gray{N0f8} (512, 512)
rand Gray{Float64} (512, 512)
rand Gray{Float64} (4096, 4096)
fabio RGB{N0f8} (512, 512)
barbara RGB{N0f8} (576, 720)
mandril RGB{N0f8} (512, 512)
coffee RGB{N0f8} (400, 600)
lighthouse RGB{N0f8} (512, 768)
earth_apollo RGB{N0f8} (3002, 3000)
rand RGB{Float64} (512, 512)
rand RGB{Float64} (4096, 4096)
The text was updated successfully, but these errors were encountered: