Main Content

activations

Class: dlhdl.Simulator
Namespace: dlhdl

Retrieve intermediate layers results for dlhdl.Simulator object

Since R2021b

Description

activations(simulatorObject,image,layername) returns intermediate layer activation data results for the image data in image and the name of the layer specified in layername. The result size depends on the output size of the layer. The layer output size can be retrieved by using the analyzeNetwork function.

result = activations(simulatorObject,image,layername) stores the intermediate layer activation data results for the image data in image and the name of the layer specified in layername in result. The result size depends on the output size of the layer. The layer output size can be retrieved by using the analyzeNetwork function.

Input Arguments

expand all

Instance of the simulator object, specified as an dlhdl.Simulator object.

Input image, specified as a m-by-n-by-k numeric array. m , n, and k must match the dimensions of the deep learning network input image layer. For example, for the LogoNet network, resize the input images to a 227-by-227-by-3 array.

Data Types: single

Layer to extract activations from, specified as a character vector.

To compute the activations of a SeriesNetwork object, specify the layer as a character vector corresponding to the layer name.

To compute the activations of a DAGNetwork object, specify the layer as a character vector corresponding to the layer name. If the layer has multiple outputs, specify the layer and output as the layer name, followed by the character "/", followed by the name of the layer output. That is, layername of the form 'layerName/outputName'.

These limitations apply when extracting activations from layers:

  • A maxPooling2DLayer which has the HasUnpoolingIndices argument set to true has three outputs out, indices, and size. Activations are supported only for the output out.

  • Activations for a ReLUlayer in the branch of a DAG network are supported when the layer is not preceded by a Convolution, Fully Connected, or Addition layer.

  • Activations for the dropout layer is not supported.

Example: 'conv1'

Example: 'mpool/out'

Output Arguments

expand all

Intermediate layer activation data, returned as an array of singles. The array size depends on the layer output size. For example, for the ResNet-18 network pool1 layer, the size of the returned result array is 56-by-56-by-64.

Version History

Introduced in R2021b

expand all