fully connected layer in a CNN

조회 수: 2 (최근 30일)
Jyoti Nautiyal
Jyoti Nautiyal 2020년 9월 27일
댓글: Jyoti Nautiyal 2020년 10월 2일
I trained a CNN for MNIST dataset with one fully connected layer. The input to fully connected layer is 9 channels of size 20 x 20, and ouput is 10 classes. How can i calculate the total number of multiplications and additions in this layer.

채택된 답변

Srivardhan Gadila
Srivardhan Gadila 2020년 10월 1일
You can use the analyzeNetwork to view the network architecture, shape of layerwise Activations & Learnables etc.
Based on the above information and under the assumption that your fullyConnectedLayer is having bias as Learnables then the layer has an input vector of size 4000 (i.e., 20x20x10 flattened) and the size of Weights & Bias are 10x4000, 10x1 respectively.
The general operation of fullyConnectedLayer is Z = W*X + b => 10*4000 = 40,000 multiplications and 39,990 + 10 = 40,000 additions.
  댓글 수: 2
Jyoti Nautiyal
Jyoti Nautiyal 2020년 10월 2일
Thanks a lot for replying..
I am confused with the size of the fully connected layer and the number of neurons. If size of my fully connected layer is 10 x 1, does it mean it has 10 neurons?
or
if input size is 20 x 20, so number of neurons will be 400?
Jyoti Nautiyal
Jyoti Nautiyal 2020년 10월 2일
I have one more query that-
our 1st conv layer is having 9 filters of size 3 x 3, then weights are 3 x 3 x 9 and image size is 26 x 26 x 9.
now when our second conv layer is having 9 filters of size 3 x 3 x 9, so image size should be = 22 x 22 x 9 or 22 x 22 x 9 x 9 and why?
Thanks in advance.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by