Wednesday, May 30, 2018

ROC curve Code in Matlab for Multiclass Classification Problem

>> Matlab code to compute the total number of trainable parameters of a deep CNN model.

Code: 

clc;
clear all;
close all;
myDLnet = resnet18;
totalPar=0;
for i=1:length(myDLnet.Layers)
temp=properties(myDLnet.Layers(i));
if (sum(strcmp(temp,'Weights')>=1))||(sum(strcmp(temp,'bias')>=1))
  totalPar = totalPar + (prod(size(myDLnet.Layers(i).Weights))+prod(size(myDLnet.Layers(i).Bias)));
end

if (sum(strcmp(temp,'Offset')>=1))||(sum(strcmp(temp,'Scale')>=1))
  totalPar = totalPar + (prod(size(myDLnet.Layers(i).Offset))+prod(size(myDLnet.Layers(i).Scale)));
end
end
TotalParameters = round((totalPar/1000000),3)

Output:

TotalParameters =

   11.6940

No comments:

Post a Comment

ROC curve Code in Matlab for Multiclass Classification Problem

>> Matlab code to compute the total number of trainable parameters of a deep CNN model. Code:  clc; clear all; close all; ...