MNIST dataframe build with my own images

Hello,

I’m looking to build a MNIST type database with my own images in order to train a One-Class CNN. I have the images processed in Julia (Gray, 28x28), I know the label of each one, but I don’t know how to build the database.
Any idea, please?

Best regards,
Mihai

Hello and welcome!

Do you want to follow the exact MNIST format? I worked with Knet framework, so I will base my example on that
I suggest the intro in the example here:
https://github.com/denizyuret/Knet.jl/blob/master/tutorial/50.cnn.ipynb
dtrn and dtst are special Knet Types containing the multidimensional array of images: 28 x 28 x 1 x nimages and the vector of labels: usually integers. (and some other stuff like batch size etc…)
For example:

xtrn = fill(Float32(0),w,h,nr_channels,nr_images) # here you push images
ytrn = fill(UInt8(0),nr_files)# here you push labels

after this you can simply call:
dtrn = Knet.minibatch(xtrn, ytrn, batchsize; shuffle=true, xtype=xtype, o...)

Do that also for test dataset and your’re good to go.

I think I can come with a more complete example for you a little later if you need more info.

Have fun!

Hi Iulian,

Thank you for support. As you may know, Ambrosia weed is a very undesired plant, who cause trouble to a lot of people. I’m involved in a project of detecting that plant from aerial images taken by drone flying at medium to high altitude. I have prepared the training set and, based on your suggestion, I’ll migrate it into a database form, ready to be processed in Julia ML.

Best regards,
Mihai