# How many neurons a deep learning model (specifically a CNN) does have?

I found total number of neurons of ResNet-50 model is 26,560 and 94,059 in two different papers. Their titles are below:

1: DeepXplore: Automated Whitebox Testing of Deep Learning Systems 2: Testing Deep Neural Network based Image Classifiers

I found another article (link) that clearly describes how many neurons a CNN does have. If I follow this technique then the neuron count does not match with the count mentioned in those papers.

Could anybody please help me how I can calculate number of neurons in a DL model? Also which layers have neurons and which don't have.

• Do you mind providing links ot where you found that ResNet-50 has 26k and 94k neurons, that seems very far off from the actual number of neurons they have. Secondly, are you asking for neurons using a framework or theoretically? – PSub Mar 13 at 6:14
• In my post I have mentioned about two papers and if you go through these papers you will find two tables and in those tables the authors mentioned that number of total neurons. I want to know the theoretical concept to calculate number of neurons a DL model (specially CNN) does have. Also in my post I have mentioned about a link and if you have a look in that link then you will find out how we can calculate number of neurons a model does have. I also appreciate your effort if you can help me how can I count number of neurons through a framework like Tensorflow or Keras. – Abdul Awal Mar 13 at 14:55

I hope you are talking about the parameter count in a convolutional neural network.

Below is basic understanding about calculating the parameters. After getting this, it would be self explanatory.

kernel count = k
kernel size = (a, a)
depth of input = d
Total number of parameters: k*(a*a)*d + k


Now, for below scenario which has one input layer with one con2d layer.

To cross check the number of parameters, we need k,d,a:

 k = 64, d = 3, a*a = 3*3

Total parameters: 64*(3*3)*3 + 64 = 1792


Hope its clear now.

• Thanks for your comment. I know how to calculate number of trainable parameters. But my concern is how to calculate number of neurons a DL model (specially CNN) does have. Also I have mentioned about two papers in my post and the authors mentioned total number of neurons in those papers. If you have a look to those papers then you can see there are two tables in those papers and the number of neurons are mentioned along with their DL model. – Abdul Awal Mar 13 at 15:13
• Selecting hyperparameters totally depends on how developer would like to see it. It is selected after hyperparameter tunings like kerastuner, GridCVSearch, RandomCVSearch . – Santosh Kumar Mar 13 at 15:23