Main Content

Multiple-Input and Multiple-Output Networks

In Deep Learning Toolbox™, you can define network architectures with multiple inputs (for example, networks trained on multiple sources and types of data) or multiple outputs (for example, networks that predicts both classification and regression responses).

Multiple-Input Networks

Define networks with multiple inputs when the network requires data from multiple sources or in different formats. For example, networks that require image data captured from multiple sensors at different resolutions.

Training

To define and train a deep learning network with multiple inputs, specify the network architecture using alayerGraphobject and train using thetrainNetworkfunction with datastore input.

To use a datastore for networks with multiple input layers, use thecombineandtransform函数创建一个astore that outputs a cell array with (numInputs+ 1) columns, wherenumInputsis the number of network inputs. In this case, the firstnumInputscolumns specify the predictors for each input and the last column specifies the responses. The order of inputs is given by theInputNamesproperty of the layer graphlayers.

For an example showing how to train a network with both image and feature input, seeTrain Network on Image and Feature Data.

Tip

If the network also has multiple outputs, then you must use a custom training loop. for more information, see多输出网络.

Prediction

To make predictions on a trained deep learning network with multiple inputs, use either thepredictorclassifyfunction. Specify multiple inputs using one of the following:

  • combinedDatastoreobject

  • transformedDatastoreobject

  • multiple numeric arrays

多输出网络

Define networks with multiple outputs for tasks requiring multiple responses in different formats. For example, tasks requiring both categorical and numeric output.

Training

To train a deep learning network with multiple outputs, use a custom training loop. For an example, seeTrain Network with Multiple Outputs.

Prediction

To make predictions using a model function, use the model function directly with the trained parameters. For an example, seeMake Predictions Using Model Function.

Alternatively, convert the model function to aDAGNetworkobject using theassembleNetworkfunction. With the assembled network, you can:

  • Make predictions with other data types such as datastores using thepredictfunction forDAGNetworkobjects.

  • Specify prediction options such as the mini-batch size using thepredictfunction forDAGNetworkobjects.

  • Save the network in a MAT file.

For an example, seeAssemble Multiple-Output Network for Prediction.

See Also

|

Related Topics