i'm trying to make an object classifier of different musical note types and I'm having a problem understanding fully connected layers. for example I have a 3d array of binarized images (WxLxNo.OfImages) and i pass that array to the conv layer, relu and pooling. a lot of the videos and other tutorials said that I make a vector using the images but is the input per image, category or the whole training data? My second question is how many neuron should be on the last layer? should it be the number of categories in my training dataset?
Starting with your last question: The final fully-connected layer shoud output the number of target classes you have. This output can then be passed to a softmax, which normalises the values between the range [0, 1] - allowing them to be interpreted as probabilities.
Remember, you train using the following dimensions:
[batch_size, height, width, channels] # channels = 1 (in your case) so is removed
You always need to maintain the
batch_size through one loop forwards and backwards through your neuiral network. Normally it set to
None which allows the model to accept any batch size you decide on.
What people mean by "make a vector" is that the output of your convolutional layers will be a 3D (including channels) and so 2D in your case. You need to flatten these into a single vector. The conv layer output, which then flows into the fully-connected layers will then be:
[batch_size, height * width] # height and width are those from the final conv layer
Depending on your framework, there will be a layer called
view etc., which gives you the vector for each image, keeping the
batch_size. This is performed as part of the model structure and so is applied to all data as it passes through the model (training, validation and test data).