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

Reading images benchmarks #10

Open
dfalbel opened this issue Aug 29, 2020 · 0 comments
Open

Reading images benchmarks #10

dfalbel opened this issue Aug 29, 2020 · 0 comments
Milestone

Comments

@dfalbel
Copy link
Member

dfalbel commented Aug 29, 2020

Looks like jpeg and png are faster than magick for reading images. We should probably use them instead:

file <- "~/Downloads/tiny-imagenet/tiny-imagenet-200/train/n01443537/images/n01443537_0.JPEG"

bench::mark(
  jpeg = jpeg::readJPEG(file),
  magick = as.integer(magick::image_data(magick::image_read(file), "rgb"))/255, 
  check = FALSE
)
#> # A tibble: 2 x 6
#>   expression      min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 jpeg          115µs 157.19µs     6189.  121.49KB    13.8 
#> 2 magick        950µs   1.11ms      862.    5.45MB     2.04

file <- "~/Documents/torch/man/figures/torch.png"

bench::mark(
  png = png::readPNG(file),
  magick = as.integer(magick::image_data(magick::image_read(file), "rgb"))/255, 
  check = FALSE
)
#> Warning: Some expressions had a GC in every iteration; so filtering is disabled.
#> # A tibble: 2 x 6
#>   expression      min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 png           150ms    170ms      5.84     127MB     3.89
#> 2 magick        404ms    411ms      2.44     148MB     2.44

Created on 2020-08-29 by the reprex package (v0.3.0)

@dfalbel dfalbel added this to the v0.1.0 milestone Sep 25, 2020
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

1 participant