File Exchange

image thumbnail

MATLAB Coder Interface for Deep Learning Libraries

Interface for Deep Learning Libraries from MATLAB Coder

49 Downloads

Updated 09 Jan 2020

MATLAB Coder™ generates C and C++ code from MATLAB® code for a variety of hardware platforms, from desktop systems to embedded hardware. It supports most of the MATLAB language and a wide range of toolboxes. You can integrate the generated code into your projects as source code, static libraries, or dynamic libraries. The generated code is readable and portable.

You can deploy a variety of trained deep learning networks such as Yolo, ResNet-50, SqueezeNet, MobileNet etc. from Deep Learning Toolbox™. You can generate optimized code for preprocessing and postprocessing along with your trained deep learning networks to deploy complete algorithms.

https://www.mathworks.com/help/coder/ug/networks-and-layers-supported-for-c-code-generation.html

MATLAB Coder Interface for Deep Learning Libraries provides the ability to customize the generated code by leveraging target specific libraries on the embedded target. With this support package, you can integrate with libraries optimized for specific CPU targets for deep learning such as the ARM® Compute Library for ARM architectures.
MATLAB Coder Interface for Deep Learning integrates with the following deep learning accelerator libraries and the corresponding CPU architectures:
• Intel Math Kernel Library for Deep Neural Networks (MKL-DNN) for Intel CPUs that support AVX2
• ARM Compute library for ARM processors that support NEON instructions

This hardware support package is functional for R2018b and beyond.

If you have download or installation problems, please contact Technical Support - https://www.mathworks.com/support/contact_us.html

Comments and Ratings (9)

When use mkl-dnn ver 1.x

Configuration:
cfg = coder.config('mex');
cfg.TargetLang = 'C++';
cfg.DeepLearningConfig = coder.DeepLearningConfig('mkldnn');

Call codegen:
codegen -config cfg classifyImage -args {ones(28,28,1,'static')} -report

Errors:
MWCNNLayerImpl.hpp:143:21: error: 'primitive_desc' is not a member of 'mkldnn::memory'
MWMkldnnUtils.cpp:10:28: error: 'mkldnn::memory::format' has not been declared
MWMkldnnUtils.cpp:17:1: error: 'primitive_desc' is not a member of 'mkldnn::memory'
... and others

When I try use mkldnn library version 0.x - it not working because MATLAB mkldnn api don't work with old version

cui

nice!

R2018b users can fix the linker error "can not open “C:\Program Files\mkl-dnn\lib\mwmklnnet.lib” by following the steps in the bug report below:
https://www.mathworks.com/support/bugreports/details/1858299

Steps to install Intel MKL-DNN v0.14 can be found at the MATLAB Answers post below:
https://www.mathworks.com/matlabcentral/answers/447387-matlab-coder-how-do-i-build-the-intel-mkl-dnn-library-for-deep-learning-c-code-generation-and-dep

TripleSSSS

I also experience this problem:

can not open “C:\Program Files\mkl-dnn\lib\mwmklnnet.lib”

where should I get "mwmklnnet.lib"

Ram

Bill Chou

peng hook

I have installed MKLDNN. and then

cfg = coder.config('mex');
cfg.TargetLang = 'C++';
cfg.DeepLearningConfig = coder.DeepLearningConfig('mkldnn');
codegen -args {ones(227,227,3,'single')} -config cfg alexnet_predict

but I got a problem about link error.
can not open “C:\Program Files\mkl-dnn\lib\mwmklnnet.lib”

where should I get "mwmklnnet.lib"

peng hook

why my platform is not supported

MATLAB Release Compatibility
Created with R2018b
Compatible with R2018b to R2019b
Platform Compatibility
Windows macOS Linux