Working with CSV imge data to perform CNN in Julia - format problem

Viewed 48

I am trying to make a convolusional neural network on MNIST sign language dataset. It is provided in a CSV format where each row is one picture and there are 784 columns refering to a single pixel (the pictures have a size 28x28). My problem is that in order to perform the algorithm I need to transpose my data to a different format, the same as is the format of a built-in ML dataset fashion MNIST, which is:

Array{Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2},1}

I would like to end up with the following format, where my data is joined with the encoded labels:

Array{Tuple{Array{Float32,4},Flux.OneHotMatrix{Array{Flux.OneHotVector,1}}},1}

I was trying to use reshape function to convert it to a 4-dimensional array, but all I get is:

7172×28×28×1 Array{Float64,4}

My labels are in the following (correct) format:

25×7172 Flux.OneHotMatrix{Array{Flux.OneHotVector,1}}

I understand that somehow the proper data format is an array in an array while my data is a simple array with 4 dimensions, but I can't figure out how to change that. I am new to Julia and some of the code I am using has been written by someone else.

0 Answers
Related