Build Networks with Deep Network Designer

Build and edit deep learning networks interactively using the Deep Network Designer app. Using this app, you can:

  • Import and edit networks.

  • Build new networks from scratch.

  • Drag and drop to add new layers and create new connections.

  • View and edit layer properties.

  • Generate MATLAB® code.


Starting with a pretrained network and fine-tuning it with transfer learning is usually much faster and easier than training a new network from scratch. For an example showing how to perform transfer learning with a pretrained network, see Transfer Learning with Deep Network Designer.

Open the App and Import Networks

To open Deep Network Designer, on the Apps tab, under Machine Learning and Deep Learning, click the app icon. Alternatively, you can open the app from the command line:


If you want to modify or copy an existing network, you can import it into the app from the workspace. To try editing a pretrained network, enter:

net = googlenet;

Click Import and choose the network to load from the workspace. Deep Network Designer displays a zoomed-out view of the whole network.

In the app, you can use any of the built-in layers to build a network. In addition, you can work with custom layers by creating them at the command line and then importing the network into the app. For a list of available layers and examples of custom layers, see List of Deep Learning Layers.

Create and Edit Networks

Assemble networks by dragging blocks from the Layer Library and connecting them. You can work with blocks of layers at a time. Select multiple layers then copy and paste or delete.

To view and edit layer properties, select a layer. For information on all layer properties, click the layer name in the table on the List of Deep Learning Layers page.

For tips on selecting a suitable network architecture, see Deep Learning Tips and Tricks.

Creating blocks of layers to copy and connect repeated units can be useful. For example, you can use blocks of layers to create multiple copies of groups of convolution, batch normalization, and ReLU layers. You can add layers to the end of pretrained networks to make them deeper. Alternatively, if you are working with small input images, you can edit a pretrained network to simplify it. For example, you can create a simpler network by deleting units of layers, such as inception modules, from a GoogLeNet network.

Check Network

To check the network and examine the layers in further detail, click Analyze. Investigate problems and examine the layer properties to help you solve size mismatches in the network. Return to the Deep Network Designer to edit layers, then check results by clicking Analyze again. The edited network is ready for training if the Deep Learning Network Analyzer reports zero errors.

Export Network for Training

To export the network to the workspace, return to the Deep Network Designer and click Export. The Deep Network Designer exports the network to a new variable containing the edited network layers. After exporting, you can supply the layer variable to the trainNetwork function.

Train the network. For this example, assume that the layers exported from the app are named lgraph_1, and that your images are in an augmented image datastore called images.

trainedNet = trainNetwork(images,lgraph_1,options)

For information on resizing and processing images, see Preprocess Images for Deep Learning.

For an example script showing how to train a network after editing it in the app, see Train Network Exported from Deep Network Designer.

For command-line examples showing how to set training options and assess trained network accuracy, see Create Simple Deep Learning Network for Classification or Train Residual Network for Image Classification.

For an example showing how to generate MATLAB code that recreates the network architecture and returns it as a variable in the workspace, see Generate MATLAB Code from Deep Network Designer.

See Also

Related Topics