Extracting features from one layer of dlnetwork model MATLAB 2023a

조회 수: 13 (최근 30일)
MAHMOUD EID
MAHMOUD EID 2023년 4월 11일
댓글: MAHMOUD EID 2023년 4월 22일
I have used the multi-input CNN network example on the following link :
After the traing and getting the predction, I need to extract the features from one of the max pooling layers of the dlnet model.
Can you help by writing the code to do so?
I have tried to use activations function with the dlnet model but not working
for example, using activation with SeriesNetwork or DAGNetwor , the code is
layer = "pool10";
featuresTrain = activations(net,augimdsTrain,layer,OutputAs="rows");
featuresTest = activations(net,augimdsTest,layer,OutputAs="rows");
What is the code to do the same if I have dlnetwork model?

답변 (1개)

V Sairam Reddy
V Sairam Reddy 2023년 4월 19일
Hi Mahmoud,
I understand that you want a way to visualise the activations in a dl network.
The 'activations' function in MATLAB is however only supported in SeriesNetwork or DAGNetwork object. Instead you can use the 'foward' function to get the activations in a dl network.
Please find the attached code below:
features = forward(dlNetwork, dlArray, 'Outputs', layerName);
% In your case:
features = forward(dlnet, dlarray(single(XUpper),'SSCB'), 'Outputs', 'pool10');
To know more about the forward function, please check the following link from the documentation:
https://www.mathworks.com/help/deeplearning/ref/dlnetwork.forward.html
  댓글 수: 1
MAHMOUD EID
MAHMOUD EID 2023년 4월 22일
Hi. The issue is how to pass the two inputs to the command predict. when I run the mentioned command , I have recived this error message @V Sairam Reddy
Error using deep.internal.network.dlnetwork/validateForwardInputs
Incorrect number of network inputs. Network has 2 inputs, but 1 inputs were passed.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by