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

13 vues (au cours des 30 derniers jours)
Ian Walter
Ian Walter le 3 Mar 2019
Réponse apportée : Jayanti le 22 Août 2025
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];

Réponses (1)

Jayanti
Jayanti le 22 Août 2025
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!

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by