Main Content

Image Classifier

Classify data using a trained deep learning neural network

  • Library:
  • 深度学习工具箱/深神经膜ral Networks

  • Image classifier block

Description

TheImage Classifierblock predicts class labels for the data at the input by using the trained 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.

Limitations

  • TheImage Classifierblock does not support sequence networks and multiple input and multiple output networks (MIMO).

  • TheImage Classifierblock does not support MAT-file logging.

Ports

Input

expand all

Ah-by-w-by-c-by-Nnumeric array, whereh,w, andcare the height, width, and number of channels of the images, respectively, andNis the number of images.

AN-by-numFeaturesnumeric array, whereNis the number of observations andnumFeaturesis the number of features of the input data.

If the array containsNaNs, then they are propagated through the network.

Output

expand all

Predicted class labels with the highest score, returned as aN-by-1 enumerated vector of labels, whereNis the number of observations.

Predicted scores, returned as aN-by-Kmatrix, whereNis the number of observations, andKis the number of classes.

Labels associated with the predicted scores, returned as aN-by-Kmatrix, whereNis the number of observations, andKis the number of classes.

Parameters

expand all

Specify the source for the trained network. Select one of the following:

  • Network from MAT-file— Import a trained network from a MAT-file containing aSeriesNetwork,DAGNetwork, ordlnetworkobject.

  • Network from MATLAB function— Import a pretrained network from a MATLAB function. For example, by using thegooglenetfunction.

Programmatic Use

Block Parameter:Network
Type:character vector, string
Values:'Network from MAT-file'|'Network from MATLAB function'
Default:'Network from MAT-file'

This parameter specifies the name of the MAT-file that contains the trained deep learning network to load. If the file is not on the MATLAB path, use theBrowsebutton to locate the file.

Dependencies

要启用该参数,设置Networkparameter toNetwork from MAT-file.

Programmatic Use

Block Parameter:NetworkFilePath
Type:character vector, string
Values:MAT-file path or name
Default:'untitled.mat'

This parameter specifies the name of the MATLAB function for the pretrained deep learning network. For example, usegooglenetfunction to import the pretrained GoogLeNet model.

Dependencies

要启用该参数,设置Networkparameter toNetwork from MATLAB function.

Programmatic Use

Block Parameter:NetworkFunction
Type:character vector, string
Values:MATLAB function name
Default:'squeezenet'

Size of mini-batches to use for prediction, specified as a positive integer. Larger mini-batch sizes require more memory, but can lead to faster predictions.

Programmatic Use

Block Parameter:MiniBatchSize
Type:character vector, string
Values:positive integer
Default:'128'

Resize the data at the input port to the input size of the network.

Programmatic Use

Block Parameter:ResizeInput
Type:character vector, string
Values:'off'|'on'
Default:'on'

Enable output portypredthat outputs the label with the highest score.

Programmatic Use

Block Parameter:Classification
Type:character vector, string
Values:'off'|'on'
Default:'on'

Enable output portsscoresandlabelsthat output all predicted scores and associated class labels.

Programmatic Use

Block Parameter:Predictions
Type:character vector, string
Values:'off'|'on'
Default:'off'

Extended Capabilities

See Also

Introduced in R2020b