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.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Train TensorFlow Object Detection API on Custom Dataset

Sensor activity recognition: Case Study

65+ Frameworks & Tools for Machine Learning

Power Apps — Making AI technologies consumable for daily business operations

Tabular data extraction using computer vision

Language, word embeddings and brands: using Natural Language Processing to pierce fashion bubbles

Adversarial Controls: Is your model just learning noise?

A scarecrow overlooking a field.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Technical Source

Technical Source

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.

More from Medium

No of Pipeline Stages in Verilog coming from an m file (or latency)

From TensorFlow Hub to AI Platform

For loop variations with multiple utility functions

A quick survey of the AI/ML applications in Telecoms