I am trying to import a image dataset from kaggle

here is also the link to the dataset:

I am trying to create an image classifier using an AlexNet Architecture
This is the way I tried to import the data set but I am encountering problems

using Markdown
using InteractiveUtils
using Pkg


Pkg.activate("Project.toml")
Pkg.add("Flux")


#load data
trainData = "../src/dataset/chest_xray/train/"
testData  = "../src/dataset/chest_xray/test/"
validationData  = "../src/dataset/chest_xray/val/"

trainNormal =  "../src/dataset/chest_xray/train/NORMAL/"
TrainPneumonia =  "../src/dataset/chest_xray/train/PNEUMONIA/"

length(trainNormal)

Pretty scarce information here.

What are you expecting this to do? What problems are you encountering?

1 Like

Hi,
Currently you are just creating strings containing the paths to the images.
To load them you could use the Images package

using Images, ImageInTerminal
imgdir = "test/NORMAL"
imgpaths = readdir(imgdir, join=true)
imgpaths = imgpaths[2:end] # On my machine element 1 is the path to a .DSstore file, so I am omitting that. 
imgs = load.(imgpaths)

You can view one of the images in the terminal (thanks to ImageInTerminal) by typing
imgs[1]
For training a neural network you probably want to work with Float32 arrays rather than grayscale images
imgsFloat32 = convert.(Matrix{Float32}, imgs)
but it might require a lot of memory to run this line on the entire train set at once.

Note that your images appear to have different sizes. Maybe you would need to get them resized to a common size before training.

1 Like

The problem is i am not loading the images correctly so i was just asking what the correct why was to do it basically

Thanks, I will give this a try.