deep learning toolbox | manipulate activations

1 view (last 30 days)
I'm computing activations to images in a trained deep neural network. Is it possible to manipulate (let's say add noise to) the activations of a certain layer before computing the activations of the next layer?
See below for example code for a single image. This code computes the activations to the image in each layer of the network. What I'd like to do now is to compute activations for e.g. layer 1, then manipulate these activations, and pass them on to layer 2. Is there existing functionality within the deep learning toolbox to do this?
(I went through the toolbox functions, but none of the existing functions seems suitable for this purpose.)
im = imread(image.bmp);
net = alexnet;
nLayers = numel(net.Layers);
acti = cell(nLayers,1);
for layerI = 1: nLayers
layerName = net.Layers(layerI).Name;
acti{layerI} = activations(net,im,layerName);
end % layerI

Answers (1)

Sai Sri Pathuri
Sai Sri Pathuri on 9 Aug 2019
There is no function to manipulate activations in a trained neural network. Instead, you may create a custom layer for required activations.
There is a similar question. You may also refer it.

Community Treasure Hunt

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

Start Hunting!