Main Content

Build and Train Networks

Create deep neural networks for image data and train from scratch

Create new deep networks for image classification and regression tasks by defining the network architecture and training the network from scratch.

After defining the network architecture, you can define training parameters using the trainingOptions function. You can then train the network using the trainnet function. Use the trained network to predict class labels or numeric responses. If the trainingOptions function does not provide the training options that you need for your task, or custom output layers do not support the loss functions that you need, then you can define a custom training loop.

You can train a neural network on a CPU, a GPU, multiple CPUs or GPUs, or in parallel on a cluster or in the cloud. Training on a GPU or in parallel requires Parallel Computing Toolbox™. Using a GPU requires a supported GPU device (for information on supported devices, see GPU Computing Requirements (Parallel Computing Toolbox)). Specify the execution environment using the trainingOptions function.


  • Build Deep Neural Networks
    Build neural networks for image data using MATLAB® code or interactively using Deep Network Designer
  • Built-In Training
    Train deep learning networks for image data using built-in training functions
  • Custom Training Loops
    Customize deep learning training loops and loss functions for image networks