Main Content

Stateful Classify

Classify data using a trained deep learning recurrent neural network

  • Library:
  • Deep Learning Toolbox / Deep Neural Networks

  • Stateful Classify block

Description

The Stateful Classify block predicts class labels for the data at the input by using the trained recurrent neural network specified through the block parameter. This block allows loading of a pretrained network into the Simulink® model from a MAT-file or from a MATLAB® function. This block updates the state of the network with every prediction.

Limitations

The Stateful Classify block does not support MAT-file logging.

Ports

Input

expand all

The format of the input depend on the type of data.

InputDescription
Vector sequencesc-by-s matrices, where c is the number of features of the sequences and s is the sequence length.
2-D image sequencesh-by-w-by-c-by-s arrays, where h, w, and c correspond to the height, width, and number of channels of the images, respectively, and s is the sequence length.

Output

expand all

Predicted class labels with the highest score, returned as a N-by-1 enumerated vector of labels, where N is the number of observations.

Predicted scores, returned as a N-by-K matrix, where N is the number of observations, and K is the number of classes.

Labels associated with the predicted scores, returned as a N-by-K matrix, where N is the number of observations, and K is the number of classes.

Parameters

expand all

Specify the source for the trained recurrent neural network. The trained network must have at least one recurrent layer (for example, an LSTM network). Select one of the following:

  • Network from MAT-file— Import a trained recurrent neural network from a MAT-file containing a SeriesNetwork, DAGNetwork, or dlnetwork object.

  • Network from MATLAB function— Import a pretrained recurrent neural network from a MATLAB function.

This parameter specifies the name of the MAT-file that contains the trained recurrent neural network to load. If the file is not on the MATLAB path, use the Browse button to locate the file.

Dependencies

To enable this parameter, set the Network parameter to Network from MAT-file.

This parameter specifies the name of the MATLAB function for the pretrained recurrent neural network.

Dependencies

To enable this parameter, set the Network parameter to Network from MATLAB function.

Specify the sample time as a value other than -1. For more information, see Specify Sample Time (Simulink).

Enable output port ypred that outputs the label with the highest score.

Enable output ports scores and labels that output all predicted scores and associated class labels.

Extended Capabilities

Introduced in R2021a