Is it possible to get the ouput values of a convolutional layer for a given input?

6 次查看(过去 30 天)
I am currently in the process of implementing a convolutional-autoencoder using layers from the MATLAB Deep Learning toolbox. I have a series of convolutional layers after the encoder portion of the autoencoder to convert the output to an NxN grid. In order to test this network on real data, I need to feed the outputs of this layer into an NxN pixel grid, and in order to do this I need to be able to view the output of the first half of my network. Below is my layer structure. Does anyone have any recommendations as to how I might get the information that I want from this network?
layers = [
imageInputLayer([inputSize 1], 'Normalization','none')
fullyConnectedLayer(16*N^2)
reluLayer
convert1d2dLayer % convert from fully connected to usable by convolution layers
convolution2dLayer(3, inputSize, 'Padding', 1)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2, 'Stride', 2)
convolution2dLayer(3, 2*inputSize, 'Padding', 1)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2, 'Stride', 2)
convolution2dLayer(3, 1, 'Padding', 1)
sigmoidLayer('sigmoid') % custom sigmoid activation layer
% ---end of encoder--- %
transposedConv2dLayer(16, inputSize, 'Stride', 16) % upsampling
% ---start of decoder--- %
convolution2dLayer(5, 2*inputSize, 'Padding', 2)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2, 'Stride', 2)
convolution2dLayer(3, inputSize, 'Padding', 1)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2, 'Stride', 2)
fullyConnectedLayer(inputSize)
fullyConnectedLayer(inputSize)
softmaxLayer
classificationLayer];

回答(1 个)

Jayanti
Jayanti 2025-8-22
Hi Ian,
I understand that you want to obtain the output values of an intermediate layer for a given input.
The recommended approach is to use "minibatchpredict" function. This allows you to directly extract the results from any layer in your network.
I am also attaching offical MathWorks documentation link on "minibatchpredict" for your reference:
Hope this help!

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by