Main Content

Train Networks Using Deep Network Designer

The Deep Network Designer app lets you build and train deep neural networks. Deep Network Designer supports trainNetwork training using image data or datastore objects. You can also export your untrained network for training at the command line, for example, to train your network using custom training loops.

To train a network, follow these steps:

  1. Create network

  2. Import data

  3. Select training options

  4. Train network

  5. Export network

You can build a network interactively using Deep Network Designer, or import a network from the workspace. You can also select a pretrained network from the Deep Network Designer start page for transfer learning. For more information, see Build Networks with Deep Network Designer.

To train a deep learning model, you must have a suitable network and training data. To import image data from a folder containing a subfolder of images for each class, or from an imageDatastore object, on the Data tab, click Import Data > Import Image Classification Data. To import any datastore, on the Data tab, click Import Data > Import Custom Data. After import, Deep Network Designer displays a preview of the imported data so that you can check that the data is as expected prior to training. For more information, see Import Data into Deep Network Designer.

Select Training Options

Once you have your network and data, the next step is to select the training options. On the Training tab, click Training Options. If you do not know which training options to use, try training with the default settings and then adjusting them to suit your network and data. For example, try adjusting the initial learning rate, or train for longer by increasing the number of epochs. For information about techniques for improving the accuracy of deep learning networks, see Deep Learning Tips and Tricks. For more information about the training options, see trainingOptions.

Training Options dialog box in Deep Network Designer

Train Network

After you select your training options, train the network by clicking Train. The Deep Network Designer app displays an animated plot of the training progress. The plot shows mini-batch loss and accuracy and additional information on the training progress. If you specified validation data, the plot also shows the validation loss and accuracy. The plot has a stop button in the top-right corner. Click the button to stop training and return the current state of the network. For more information on the training progress plot, see Monitor Deep Learning Training Progress.

Training progress plot in Deep Network Designer

You can train a variety of networks using Deep Network Designer. For example, image classification or regression networks, sequence networks, numeric data networks, semantic segmentation networks, and image-to-image regression networks. In Deep Network Designer, you can train a network using the trainNetwork function on any data that you can express as a datastore object. The following examples show how to build and train a network using Deep Network Designer.

Once training is complete, on the Training tab, click Export to export your trained network and results to the workspace. To save the training progress plot as an image, click Export Training Plot. You can learn how to build and train your network using command line functions by clicking Export > Generate Code for Training and examining the generated live script.

Deep Network Designer does not support training using custom training loops. To train your network using a custom training loop, first export the network to the workspace and convert it to a dlnetwork object. You can then train the network using the dlnetwork object and a custom training loop. For more information, see Train Network Using Custom Training Loop.

Next Steps

Once training is complete, click Export > Create Experiment to create a deep learning experiment in Experiment Manager. You can use Experiment Manager to sweep through a range of hyperparameter values or use Bayesian optimization to find optimal training options. For an example showing how to use Experiment Manager to tune the hyperparameters of a network trained in Deep Network Designer, see Generate Experiment Using Deep Network Designer.

See Also


Related Topics