MATLAB Answers

Why should I use Matlab Deep Learning Toolbox over Tensorflow?

202 views (last 30 days)
Haiming Wang
Haiming Wang on 25 Jun 2019
Answered: David Willingham on 30 Sep 2020
I am evaluating Matlab Deep Learning Toolbox vs Tensorflow now. Found some answers on this web and on line, such as
However, unfortunately this answer seems insufficient for my purpose.
There is a fundamental difference in consumer- and in industrial applications, for image sensor in particular, and for almost all sensing and metrology equipment in general. For instance, ghost images (aka flare) in photography may be regarded as a nice visual effect. However, for advanced driver-assistance systems (ADAS) for instance, confusing a ghost image of an incoming car's headlights with a motorcycle's headlight may have vital consequence.
Given this, the accuracy and reliability of math tools, including DL/CNN for image processing, for instance, is far more important in industry then in consumer and entertaiment.
The concept of neural networks is pretty much old. In fact there are maybe 3 core math tools integrated in DL/CNN, and nothing is new: 1) Tensor algebra; 2) Optimization; and 3) Automatic differentiation.
So apart from pros and cons regarding open source vs commercial software, reliable support vs online community, etc., my question boils down to this:
What is the difference between Matlab Deep Learning Toolbox and Tensorflow, in terms of precision, repeatability and reproducibility, accuracy, reliability, stability, etc.?
Ideally, if some examples with supporting data are provided, then it will be great.
The reason for me to ask this question is based on my experience and learning with Matlab. I have used Matlab together with Optimization Toolbox and Image Processing Toolbox extensively. I must admit I love these two toolboxes, very much. Considering Matlab is built on matrix, and tensor is a natural extension of matrix, and considering the power and reliability of Optimization Toolbox, intuitively I have some confidence in Matlab DL Toolbox. Especially it seems to me that the optimization tools in Tensor are quite primitive, mainly based on the gradient-descend (all variations are just different means to adjust the damping factor), or the Levenberg-Marquardt (aka damped least-squares, DLS) without Gaussian-Newton.
I also expect Matlab DL Toolbox may outperform Tensorflow in tensor analysis.
Seems the only drawback of Matlab DL Toolbox is unavailability of automative differentiation - So how important is it in DL/CNN? Does it show advantages in computing derivatives in back-propagation over numerical differentiation? Also, with the existence of Symbolic Toolbox, why is automatic differentiation still unavailable?
Thanks a lot!

  1 Comment

David Willingham
David Willingham on 30 Sep 2019
Hi Haiming,
To help answer some of your questions:
Automatic Differentiation:
As of R2019b, the deep learning toolbox supports Automatic Differentiation. As per the release notes, you can:
  • Define and train complex networks (including GANs) using custom training loops, automatic differentiation, shared weights, and custom loss functions
For a full list of updates go to:
For more information on using automatic differentiation in MATLAB go to:
A lot of new examples have been included in R2019b.
New examples of custom deep learning workflows include:
In addition more examples have been created that explore deep learning workflows:
New examples and topics help you progress with deep learning:
New examples for computer vision tasks include:
New examples for image processing tasks include:
New examples for signal and audio processing tasks include:
New examples for reinforcement learning tasks include:
New code generation examples include:

Sign in to comment.

Answers (1)

David Willingham
David Willingham on 30 Sep 2020
I’d like to provide an update to answer. MATLAB is used by Engineers and Scientists to develop, automate and integrate deep learning models into their domain-specific workflows. It helps them achieve this by providing:
  • An open framework that supports interoperability with Python and other open source deep learning frameworks.
  • Capabilities that extend beyond modeling to developing end to end applications.
  • Integration and Simulation of Deep Learning models into larger domain-specific systems.
  • Dedicated support from engineers at MathWorks, developers of MATLAB.
Further information:
The development efforts of MATLAB are aimed at addressing the entire system design workflow for building systems that rely on Deep Learning.
Deep Learning System Design Workflow (scroll left to right)
This workflow is being applied to developing Domain Specific Deep Learning applications in areas such as:
For each of the domain’s mentioned above MATLAB provides specialized tools and functions for data preprocessing and preparation, training interfaces, evaluation tools and reference examples.
Data Preparation:
Having the right data is critical to the success of developing a Deep Learning model but can be a time consuming process. MATLAB provides Apps for automating domain-specific labeling (Signal Labeler, Image Labeler, Video Labeler & Audio Labeler) and functions for pre-processing data, which aim at saving development time.
Users have the choice if they would like to use models developed in MATLAB, pretrained models such as GoogleNet or ResNet-50, or those available in OpenSource Frameworks TensorFlow, PyTorch or ONNX through Framework Interoperability. MATLAB's Deep Learning toolbox provides interactive Apps that automate network design, training and experiment management, allowing users to avoid steps that can be automated or eliminated.
Simulation & Test:
Deep learning models created in MATLAB can be integrated into system-level designs, developed in Simulink, for testing and verification using simulation. System-level simulation models can be used to verify how deep learning models work with the overall design, and test conditions that might be difficult or expensive to test in a physical system. THIS example shows how deep learning can be integrated with a controls model in Simulink, further more AI models can be tested using 3D simulation environments with sensor models as shown in THIS example.
These applications are being deployed to embedded and production systems through automatic code generation. Automatic code generation generates optimized native code for Intel and ARM CPU's, FPGA's and SoC's and NVIDIA GPU's for Deep Networks along with pre-processing and post-processing, eliminating errors of transcription or interpretation.
Examples in Industry and Academia:
MATLAB users in industry and academia have had success using MATLAB deep learning to solve challenging problems such as terrain recognition using hyperspectral data and converting brain signals to word phrases.
To Summarize on why engineers and scientists use MATLAB and MathWorks for Deep Learning:
  • MATLAB is focused towards engineering and science workflows
  • MATLAB is a platform that covers the entire workflow where users can improve productivity by using interactive apps that expedite analysis and automatically generate reusable code
  • Models can be deployed anywhere, from embedded to cloud systems
  • MATLAB has interoperability with OpenSource frameworks Tensorflow and PyTorch
  • Users have access to support from experienced MathWorks engineers in development, training & consulting.
If you have any questions regarding Deep Learning, please don't hesitate to contact me or any one of our Deep Learning experts at MathWorks via the "Have Questions? Talk to a deep learning expert." form on our Deep Learning solution page.
Deep Learning Product Manager, MathWorks


Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!