Deep Learning

Understanding and using deep learning networks

What’s New in 19b: MATLAB 3

Posted by Johanna Pingel,

This post is from Heather Gorr - MATLAB product marketing - here to talk about the new release of R2019b and new MATLAB functionality related to deep learning. You can get a high level overview of everything new in this release with an overview video on the release page, or dive into the specifics in the release notes.
It's not just Deep Learning Toolbox that has deep learning capabilities: When you look for what's new for deep learning, you should also think of base MATLAB. This release has many assorted goodies, but there are some new features which specifically help with deep learning applications and workflows:
  • Live Editor Tasks
  • Execute Python functions out of process
  • tiledlayout is the new subplot
  • App Designer updates
  • Function input argument validation

Live Editor Tasks

These are like mini-apps that you can embed in a Live Script and are very useful for preprocessing data, which is super important in DL. These are intended to help with tasks that are very iterative and visual. For example, in the Smooth Data task (pictured below) you can choose different parameters like the smoothing method, immediately visualize the results, and keep doing that until you find a method appropriate for your data. There are Live Editor Tasks for common data cleaning needs like: missing data, outliers, smoothing, detrending, change point detection, and joining tables.
Live Editor/ Live Scripts are very useful in Deep Learning in general, since they are so great for communicating – capturing code, output, documentation, equations, images, etc. And communication is such an important thing in DL.
More info on live editor tasks: https://www.mathworks.com/help/matlab/matlab_prog/add-live-editor-tasks-to-a-live-script.html

Execute Python functions out of process

You’re often using multiple deep learning models, trying different models and examples from the community, and sometimes you need to use MATLAB and Python together. You have the model sharing options via ONNX, TF importers, etc., but you can also call Python libraries directly from MATLAB and vice versa. This has been around for several years now and we’re continuously improving it. This release we include an option to run Python functions in a separate process to avoid library conflicts. So, if you ever have conflicts or crashes when calling TensorFlow, PyTorch, etc from MATLAB in the same process, you can use a separate process by setting this in the pyenv function:
pyenv("ExecutionMode","OutOfProcess")
More info on Python Functions: https://www.mathworks.com/help/matlab/matlab_external/out-of-process-execution-of-python-functionality.html

tiledLayout is the new subplot

Visualizations are really important in DL- you’re always plotting results, comparing classes, layer activations, etc. You also need to share your results, publish, and often customize visualizations.
Now you can use tiledlayout + nexttile instead of subplot when creating multiple plots in the same figure.
tiledlayout(2,1,"TileSpacing","compact"); nexttile; plot(rand(10,1)); nexttile; plot(rand(10,1),'m*') The syntax is nicer, but it's also more powerful than subplot. You can control spacing between axes, the resize behavior, etc and it’s easy to use different sized axes in same figure and arrange for publications, like the example below.
More info on tile layout: https://www.mathworks.com/help/matlab/ref/tiledlayout.html

Lots of App Designer features

App Designer is a user-friendly app authoring environment. It works well for sharing DL applications with others, even creating web apps using your model. It continues to improve each release and now you can make your app look better than ever in R2019b (lots of cosmetic-related functionality allow for customizing the look of your apps):  
  • Use uistyle to create styles for rows, columns, or cells in a table UI component
  • Use uihtml to add HTML, JavaScript, or CSS content to apps
  • Sort table UI components interactively when using logical, numeric, string, or cell arrays
For example, the below app was created with R2019b.
More info on App Designer: https://www.mathworks.com/help/matlab/app-designer.html

Function input argument validation

You often write functions in deep learning, especially when applications get more complicated and you need to better organize your code. You’d like to give some restrictions on what can be passed to the function (for example, you expect an image (matrix) but someone passes a table). You could always do this input validation, but it required if statements and type checking, more customized error handling (just more coding, not hard but tedious). Now it’s much easier on the developer to specify input requirements so they can spend more time writing the code for their actual algorithm, not fussing about argument checking and validation.
arguments width (1,1) double {mustBeNumeric} height (1,1) double {mustBeNumeric} xStart (1,1) double {mustBeNumeric} = 0 % optional yStart (1,1) double {mustBeNumeric} = 0 % optional end
More info on argument validation: https://www.mathworks.com/help/matlab/matlab_prog/function-argument-validation-1.html
These are just a few of my favorite highlights for deep learning, but there’s much more! Check out the release notes and overview pages for additional updates.
Thanks again to Heather for keeping us up-to-date in MATLAB. Got a question for Heather? Have a specific new feature you love in MATLAB? Leave a comment below.
Follow Heather on Twitter!
Follow Johanna on Twitter!
333 views (last 30 days)  | |

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.