# What is the optimal number of neurons in fully connected layer in CNN?

I am reading this paper "Human Activity Recognition From Accelerometer Data Using Convolutional Neural Network". NN experts don't have to read the entire paper. I'm adding the important diagram here:

It takes a vector as an input. First layer is convolutional layer. It consists of 128*3 neurons with three different sizes (3,4 and 5). Then maxpool layer. Output of maxpool layer is concatenated and vector of length 384 is formed which then is inputted to fully connected layer. My question here is that how many neurons should be there in the fully connected layer. It might sound like a naive question but I am a newbie to these concepts :)

• you may either try different numbers of neurons , and see which number gives you the best test error -or you could just go for the usual approach of the "old-school" CNNs and simply use the same number of neurons as the length of the vector obtained by flattening out the last layer before the fully connected layer (i.e., $N=384$ in this case).
Note that the latter is the choice made by the authors of the paper you cite. This is confirmed by the footnote where they confirm that the fully connected part of their neural network (the part in subfigure d. dropout, i.e., the two topmost layers) contribute an extra $384\times 384\times 3$ weights to the overall number of weights of the network. BTW, bit of a crappy architecture. It's practically a dumbed-down LeNet5, where instead of three RGB channels we have 3 window lengths, and the convolutions are 1D rather than 2D. They didn't spend a whole lot of time optimizing their architecture for generalization error, apparently.