fully connected layer in a CNN

3 ビュー (過去 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 Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by