How to calculate the number of parameters in MATLAB that is used by a deep learning network like VGG/ResNet

15 ビュー (過去 30 日間)
Suppose I am using a deep learning model like VGG-16/ResNet/ Inception, The other tools like tensorflow, Keras automatically show the number of parameters used by the candidate network. for example for VGG-Net the number of parameters are 138 Million Also if the network is modified for our own application the number of parameters is important to check the network cost or to make a lighter network. There must be a procedure to check it for DAG network.
Thanks in Advance

回答 (1 件)

SC
SC 2019 年 12 月 3 日
編集済み: SC 2019 年 12 月 3 日
I used a function to analyse it manually. I'm not sure if there're better approaches. Here's my code for a dlnetwork object myDLnet (thus the code works for 2019b but not sure for the older version):
num_para=find_num_para(myDLnet)
function num_para=find_num_para(myDLnet)
layers=myDLnet.Learnables.Value;
num_layers = size(layers,1);
num_para=0;
for i=1:num_layers
num_para=num_para+prod(size(layers{i}));
end
end
  3 件のコメント
Sivylla Paraskevopoulou
Sivylla Paraskevopoulou 2022 年 5 月 13 日
Learnables is a property of the dlnetwork object, which is a type of deep learning network. If your network is a DAGNetwork or SeriesNetwork object, then there is no Learnables property.
If you are not already using a dlnetwork, convert your network to a dlnetwork by following the instructions in the Convert Pretrained Network to dlnetwork Object example.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by