Error using activations with GoogLeNet in R2017b

I am trying to use an “activations” function on a pretrained googlenet network. It runs ok, but returns a 4-D matrix. So I tried using (‘OutputAs’, ‘columns’) Name-Value pair. But this produces an error. Here are the reproduction steps and the error message:

net = googlenet;

mockImage = randn(224, 224, 3);

layer = ‘loss3-classifier’;

trainingFeatures = activations(net, mockImage, layer, ‘OutputAs’, ‘columns’);

Error using DAGNetwork>iParseAndValidateActivationsNameValuePairs (line 598)

‘OutputAs’ is not a recognized parameter. For a list of valid name-value pair arguments, see the

documentation for this function.

Error in DAGNetwork/activations (line 230)

[miniBatchSize, executionEnvironment] =

iParseAndValidateActivationsNameValuePairs(varargin{:});

Error in reproduce_OutputAs_error (line 4)

trainingFeatures = activations(net, mockImage, layer, ‘OutputAs’, ‘columns’);

How can I get the activations in a correct format from googlenet? The reason I am trying to do this, is to follow feature extraction example, https://www.mathworks.com/help/nnet/examples/feature-extraction-using-alexnet.html, using googlenet instead of alexnet.

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

The pretrained networks “alexnet” and “googlenet” belong to different MATLAB classes: “alexnet” is a SeriesNetwork, while “googlenet” is a DAGNetwork (where layers do not have to be arranged as one single chain). For a DAGNetwork, the “activations” method is not fully supported yet — this functionality will be available in a future MATLAB release.

But as you found out, the “activations” method does work on a “googlenet” to some extent. It returns a _h_-by-_w_-by-_c_-by-_n_ array, where _h_, _w_, and _c_ are the height, width, and number of channels for the output of the chosen layer, and _n_ is the number of observations.

SEE COMPLETE ANSWER CLICK THE LINK

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.