Hello,
I want to train a CNN model using Julia Flux but I am not able to load and preprocess the custom image dataset for training. Can anyone provide me the code snippet for loading the custom image dataset and preprocessing for the dataset.
A bit more information might make it easier for people to help you.
What format is the dataset saved in?
What preprocessing do you want to do?
You could also share your code here. Maybe someone can spot the error.
Hi and welcome! You might get a better response if you follow
Hello,
The dataset is saved in the form of image.png. and for preprocessing I need to resize the images and save them between 0 to 1.
Hello,
Thank you I will follow that.
Have a look at Julia Images. There is a function imresize
for resizing images.
You can load a single image and convert it to a Float32 array like this. The elements should already be between 0 and 1.
using Images
img = load("img.png")
arr = convert(Array{Float32, 3}, channelview(img))
You could also find useful the following resources:
https://juliaml.github.io/MLDatasets.jl/stable/containers/overview/