You can do this with the packages Images
and ImageMagick
(you need to install both), and then:
using Images
download("https://juliaimages.org/latest/assets/logo.png","test.png");
img = Images.load("test.png");
size(img) # outputs (128, 128)
img2 = imresize(img,(50,50));
Images.save("test2.png",img2);
The file test2.png
has the size 50x50. More info about imsize
is available at:
https://juliaimages.org/latest/function_reference.html#Spatial-transformations-and-resizing-1
You would do this operation before hand (i.e. outside of Flux.jl) because otherwise the interpolation would need to be done at every time you compute the gradient.
The package Interpolations
would also allow you to resize the images. You would then interpolate the red, green, blue channels individually.
For the particular images of the kaggle challenge, padding the data with black pixels to a common size would also be an option.