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 to create the network architecture.
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.
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 pretrained network, you can select it from the start page.
You can also click New on the Designer tab to load a network from the workspace, select a pretrained network, or build a network from scratch. 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.
The Designer pane of Deep Network Designer is where you can construct, edit, and analyze your network.
Assemble a network 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. Click the help icon next to the layer name for more information about the properties of the 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.
To check the network and examine the layers in further detail, on the Designer tab, click Analyze. Investigate problems and examine the layer properties to help you resolve size mismatches in the network. Return to the Deep Network Designer to edit layers, then check results by clicking Analyze again. If the Deep Learning Network Analyzer reports zero errors, then the edited network is ready for training.
You can train the network for image classification problems, using the Deep Network Designer app. On the Data tab, click Import Data to select the image data on which you want to train the network.
After you import your data, on the Training tab, click Train. Deep Network Designer copies the network you construct in the Designer pane and then trains the network. If you want greater control over the training, modify the training options by clicking Training Options. For more information on importing data and training a network constructed in Deep Network Designer, see Transfer Learning with Deep Network Designer.
Deep Network Designer can train image classification networks. For an example showing how to export a network and train it for sequence classification problems, see Create Simple Sequence Classification Network Using Deep Network Designer.
To export the untrained network to the workspace for training, on the
Designer tab, click Export. The Deep Network
Designer app exports the network to a new variable containing the edited network layers.
After exporting, you can supply the layer variable to the
For this example, assume that the layers exported from the app are named
lgraph_1, the images are in an augmented image datastore called
options contains the training options. To
train the network,
trainedNet = trainNetwork(images,lgraph_1,options)
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.
To export the trained network to the workspace, on the Training tab, click Export. The exported network has layers with weights trained by Deep Network Designer.
Using Deep Network Designer, you can generate MATLAB code to recreate the network construction and training performed in the app.
For an example showing how to generate MATLAB code that recreates the network architecture, see Generate MATLAB Code to Recreate Network Layers.
For an example showing how to generate MATLAB code that recreates the network architecture and the network training, see Generate MATLAB Code to Train Network.