How to calculate number of parameters in a model e.g. LENET for mnist, or ConvNet for imagent model etc. Is there any specific function in caffe that returns or saves numbe
I can offer an explicit way to do this via the Matlab interface (make sure the matcaffe is installed first). Basically, you extract set of parameters from each network layer and count them. In Matlab:
% load the network
net_model =
net_weights =
phase = 'test';
test_net = caffe.Net(net_model, net_weights, phase);
% get the list of layers
layers_list = test_net.layer_names;
% for those layers which have parameters, count them
counter = 0;
for j = 1:length(layers_list),
if ~isempty(test_net.layers(layers_list{j}).params)
feat = test_net.layers(layers_list{j}).params(1).get_data();
counter = counter + numel(feat)
end
end
In the end, 'counter' contains the number of parameters.