Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Train a convolutional network

Use `trainNetwork`

to train your
convolutional neural network (ConvNet, CNN) for a classification or
regression problem after defining the layers of your network and specifying
the training options. You can train a ConvNet on either a CPU or a
GPU or multiple GPUs and/or in parallel. Training on a GPU or in parallel
requires the Parallel Computing Toolbox™. Using a GPU requires a CUDA^{®}-enabled NVIDIA^{®} GPU
with compute capability 3.0 or higher. Specify the training parameters
including the execution environment using the `trainingOptions`

function.

`trainedNet = trainNetwork(imds,layers,options)`

`trainedNet = trainNetwork(X,Y,layers,options)`

`trainedNet = trainNetwork(tbl,layers,options)`

`trainedNet = trainNetwork(tbl,responseName,layers,options)`

`trainedNet = trainNetwork(tbl,responseNames,layers,options)`

```
[trainedNet,traininfo]
= trainNetwork(___)
```

returns
a trained network for classification problems. `trainedNet`

= trainNetwork(`imds`

,`layers`

,`options`

)`imds`

stores
the input image data, `layers`

defines the convolutional
neural network (ConvNet) architecture, and `options`

defines
the training options.

returns
a trained network for classification and regression problems. `trainedNet`

= trainNetwork(`X`

,`Y`

,`layers`

,`options`

)`X`

contains
the predictor variables and `Y`

contains the categorical
labels or numeric responses.

returns
a trained network for classification and regression problems. `trainedNet`

= trainNetwork(`tbl`

,`layers`

,`options`

)`tbl`

contains
the predictors and the targets or response variables. The predictors
must be in the first column of `tbl`

. For information
on the targets or response variables, see the `tbl`

argument
description.

returns
a trained network for classification and regression problems. The
predictors must be in the first column of `trainedNet`

= trainNetwork(`tbl`

,`responseName`

,`layers`

,`options`

)`tbl`

.
The `responseName`

argument specifies the response
variable in the table `tbl`

.

returns
a trained network for regression problems. The predictors must be
in the first column of `trainedNet`

= trainNetwork(`tbl`

,`responseNames`

,`layers`

,`options`

)`tbl`

. The `responseNames`

argument
specifies the response variables in the table `tbl`

.

`[`

also returns information
on the training for any of the input arguments.`trainedNet`

,`traininfo`

]
= trainNetwork(___)

Was this topic helpful?