Skip to Content

Convolutional Neural Network CNN: How to Calculate Parameters in a Convolutional Neural Network Layer?

Learn how to calculate the number of parameters in a convolutional neural network (CNN) layer with a detailed example. Understand the formula for CNN parameter calculation, including bias terms.

Question

Suppose your input is a 256 by 256 color (RGB) image, and you use a convolutional layer with 128 filters that are each 7 × 7 7×7. How many parameters does this hidden layer have (including the bias parameters)?

A. 6400
B. 1233125504
C. 18816
D. 18944

Answer

D. 18944

Explanation

To determine the number of parameters in the given convolutional layer, let’s break it down step by step:

Problem Setup

  • Input: A 256 × 256 RGB image (3 channels for Red, Green, Blue).
  • Convolutional layer: 128 filters, each of size 7×7.
  • Bias: Each filter has one bias term.

Step 1: Calculate Parameters for One Filter

Each filter operates on all input channels (RGB), so its size is 7×7×3. The total parameters for one filter are:

Parameters per filter=Filter height×Filter width×Number of input channels

Substituting values:

7×7×3=147

Step 2: Add Bias Term

Each filter has one bias parameter. Therefore, the total parameters for one filter become:

147+1=148

Step 3: Calculate Total Parameters for All Filters

There are 128 filters in this layer. Hence, the total number of parameters is:

Total parameters=(Parameters per filter)×(Number of filters)

Substituting values:

148×128=18944

The total number of parameters in this convolutional layer, including biases, is 18944.

Convolutional Neural Network CNN: How to Calculate Parameters in a Convolutional Neural Network Layer?

Convolutional Neural Network CNN certification exam assessment practice question and answer (Q&A) dump including multiple choice questions (MCQ) and objective type questions, with detail explanation and reference available free, helpful to pass the Convolutional Neural Network CNN exam and earn Convolutional Neural Network CNN certification.