http://blog.revolutionanalytics.com/2016/08/deep-learning-part-1.html

Deep Learning Part 1: Comparison of Symbolic Deep Learning Frameworks

by Anusua Trivedi, Microsoft Data Scientist

Background and Approach

This blog series is based on my upcoming talk on re-usability of Deep Learning Models at the Hadoop+Strata World Conference in Singapore. This blog series will be in several parts – where I describe my experiences and go deep into the reasons behind my choices.

Deep learning is an emerging field of research, which has its application across multiple domains. I try to show how transfer learning and fine tuning strategy leads to re-usability of the same Convolution Neural Network model in different disjoint domains. Application of this model across various different domains brings value to using this fine-tuned model.

In this blog (Part1), I describe and compare the commonly used open-source deep learning frameworks. I dive deep into different pros and cons for each framework, and discuss why I chose Theano for my work.

Please feel free to email me at trivedianusua23@gmail.com if you have questions.

Symbolic Frameworks

Symbolic computation frameworks (as in CNTK, MXNET, TensorFlow, Theano) are specified as a symbolic graph of vector operations, such as matrix add/multiply or convolution. A layer is just a composition of those operations. The fine granularity of the building blocks (operations) allows users to invent new complex layer types without implementing them in a low-level language (as in Caffe).

I've used different symbolic computation frameworks in my work. However, I found each of them has their pros and cons in their design and current implementation, and none of them can perfectly satisfy all needs. For my problem needs , I decided to work with Theano.

Here we compare the following symbolic computation frameworks:

Theano

  • Software: Theano
  • Creator: Université de Montréal
  • Software license: BSD license
  • Open source: Yes
  • Platform: Cross-platform
  • Written in: Python
  • Interface: Python
  • CUDA support: Yes
  • Automatic differentiation: Yes
  • Has pre-trained models: Through Lasagne's model zoo
  • Recurrent Nets: Yes
  • Convolutional Nets: Yes
  • RBM/DBNs: Yes

TensorFlow

  • Software: TensorFlow
  • Creator: Google Brain Team
  • Software license: Apache 2.0
  • Open source: Yes
  • Platform: Linux, Mac OS X,
  • Windows support on roadmap
  • Written in: C++, Python
  • Interface: Python, C/C++
  • CUDA support: Yes
  • Automatic differentiation: Yes
  • Has pre-trained models: No
  • Recurrent Nets: Yes
  • Convolutional Nets: Yes
  • RBM/DBNs: Yes

MXNET

  • Software: MXNET
  • Creator: Distributed (Deep) Machine Learning Community
  • Software license: Apache 2.0
  • Open source: Yes
  • Platform: Ubuntu, OS X, Windows, AWS, Android, iOS, JavaScript
  • Written in: C++, Python, Julia, Matlab, R, Scala
  • Interface: C++, Python, Julia, Matlab, JavaScript, R, Scala
  • CUDA support: Yes
  • Automatic differentiation: Yes
  • Has pre-trained models: Yes
  • Recurrent Nets: Yes
  • Convolutional Nets: Yes
  • RBM/DBNs: Yes

Non-symbolic frameworks

PROS:

  • Non-symbolic (imperative) neural network frameworks like torch, caffe etc. tend to have  very similar design in their computation part.
  • In terms of expressiveness, imperative frameworks with a good design can also expose graph-like interface (e.g. torch/nngraph).

CONS:

  • The main drawbacks of imperative frameworks actually lie in manual optimization. For example, in-place operation has to be manually implemented.
  • Most imperative frameworks are not designed well enough to have comparable expressiveness as symbolic frameworks.

Symbolic frameworks

PROS:

  • Symbolic frameworks can possibly infer optimization automatically from the dependency graph.
  • A symbolic framework can exploit much more memory reuse opportunities, as is well done in MXNET.
  • Symbolic frameworks can automatically compute an optimal schedule. This is explained in TensorFlow whitepaper.

CONS:

  • Available open source symbolic frameworks currently are still not good enough to beat imperative frameworks in performance.

Adding New Operations

In all of these frameworks, adding an Operation with reasonable performance is not easy.

Theano / MXNET

TensorFlow

Can add Operation in Python with inline C support.

Forward in C++, symbolic gradient in Python.

Code Re-usability

Training deep networks are time-consuming. So, Caffe has released some pre-trained model/weights (model zoo) which could be used as initial weights while transfer learning or fine tuning deep networks on domain specific or custom images.

  • Theano
    Lasagne is a high-level framework built on top of Theano. It’s very easy to use Caffe pre-tained model weights in Lasagne.
  • TensorFlow
    No support for pre-trained model.
  • MXNET
    MXNET has a caffe_converter tool which allows to convert pre-trained caffe model weights to fit MXNET.

Low-level Tensor Operators

A reasonably efficient implementation of low-level operators can serve as ingredients in writing new models, saving the effort to write new Operations.

Theano

TensorFlow

MXNET

A lot of basic Operations

Fairly good

Very few

Control Flow Operator

Control flow operators make the symbolic engine more expressive and generic.

Theano

TensorFlow

MXNET

Supported

Experimental

Not Supported

High-level Support

  • Theano
    Pure symbolic computation framework. High-level frameworks can be built to fit desired means of use. Successful examples include KerasLasagneblocks.
  • TensorFlow
    Has good design considerations for neural network training, and at the same time avoid being totally a neural network framework, which is a wonderful job. The graph collection, queues, image augmenters etc. can be useful building blocks for a higher-level wrapper.
  • MXNET
    Apart from the symbolic part, MXNET also comes with all necessary components for image classification, going all the way through data loading to building a model that has a method to start training.

Performance

Benchmarking Using Single-GPU

I benchmark LeNet model on MNIST Dataset using a Single-GPU (NVIDIA Quadro K1200 GPU).

Theano

TensorFlow

MXNET

Great

Not so good

Excellent

Memory

GPU memory is limited and may usually be a problem for large models.

Theano

TensorFlow

MXNET

Great

Not so good

Excellent

Single-GPU Speed

Theano takes a long time to compile a graph, especially with complex models. TensorFlow is a bit slower.

Theano / MXNET

TensorFlow

comparable to CuDNNv4

about 0.5x slower

Parallel/Distributed Support

Theano

TensorFlow

MXNET

experimental multi-GPU

multi-GPU

distributed

Conclusion

Theano (with higher-level Lasagne & Keras) is a great choice for deep learning models. It’s very easy to implement new networks & modify existing networks using Lasagne/Keras. I prefer python, and thus prefer using Lasagne/Keras due to their very mature python interface. However, they do not support R. I have tried using transfer learning and fine tuning in Lasagne/Keras, and it’s very easy to modify an existing network and customize it with domain-specific custom data.

Comparisons of different frameworks show that MXNET is the best choice (better performance/memory). Moreover, it has a great R support. In fact, it is the only framework that supports all functions in R. In MXNET, transfer learning and fine tuning networks are possible, but not as easy (as compared to Lasagne/Keras). This makes modifying existing trained networks more difficult, and thus a bit difficult to use domain-specific custom data.

Continued in Deep Learning Part 2: Transfer Learning and Fine-tuning Deep Convolutional Neural Networks

Comments

You can follow this conversation by subscribing to the comment feed for this post.

It’s worth to note that H2O is another framework of DL as well but w/o GPU support now.
And, it’s a tradeoff between performance and flexibility for DL framework.
One example in below blog post which shows the native R DL code w/ GPU backend acceleration.

http://www.parallelr.com/r-deep-neural-network-from-scratch/
http://www.parallelr.com/r-dnn-parallel-acceleration/
http://www.parallelr.com/r-dnn-cuda-multigpu/

Posted by: daisy | August 10, 2016 at 20:18

You are using some old TensorFlow release. It is no longer slow and it supports multi machine training. Operations can also be easily defined in Python and control ops are no longer experimental.

Posted by: Andrew | August 25, 2016 at 23:00

Would you please put your benchmarking code on GitHub and link back here in a comment?

Posted by: Dale Smith | August 26, 2016 at 05:21

Excellent post Anusha. Very informative. Do you mind I re-post this along with part 2 on my platform www.gladwinanalytics.com ? It would be greatly useful to tens and thousands of Gladwin Analytics users.

Thanks,
Anandh Shanmugaraj

Posted by: Big Data Jobs | August 27, 2016 at 05:35

Thanks for the comments.

Daisy - I tried to compare open-source frameworks only. I haven't played much with H2O, thanks for posting the links.

Andrew - Ahh! Thanks for pointing. I bench-marked TensorFlow sometime back, I need to update to new version.

Dale Smith - The plan is to make all codes available through Github. Its a work in progress, and I'll make it available once I have some newer version results.

Anandh Shanmugaraj - Feel free to re-post.

Posted by: Anusua Trivedi | August 29, 2016 at 07:12

The comments to this entry are closed.

Comparison of Symbolic Deep Learning Frameworks的更多相关文章

  1. Comparing deep learning frameworks: Tensorflow, CNTK, MXNet, & Caffe

    https://imaginghub.com/blog/10-a-comparison-of-four-deep-learning-frameworks-tensorflow-cntk-mxnet-a ...

  2. Deep Learning in R

    Introduction Deep learning is a recent trend in machine learning that models highly non-linear repre ...

  3. Machine and Deep Learning with Python

    Machine and Deep Learning with Python Education Tutorials and courses Supervised learning superstiti ...

  4. deep learning framework(不同的深度学习框架)

    常用的deep learning frameworks 基本转自:http://www.codeceo.com/article/10-open-source-framework.html 1. Caf ...

  5. Coursera Deep Learning 2 Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization - week1, Assignment(Regularization)

    声明:所有内容来自coursera,作为个人学习笔记记录在这里. Regularization Welcome to the second assignment of this week. Deep ...

  6. (转) Learning Deep Learning with Keras

    Learning Deep Learning with Keras Piotr Migdał - blog Projects Articles Publications Resume About Ph ...

  7. 课程一(Neural Networks and Deep Learning),第一周(Introduction to Deep Learning)—— 1、经常提及的问题

    Frequently Asked Questions Congratulations to be part of the first class of the Deep Learning Specia ...

  8. Convolutional Neural Networks from deep learning (assignment 1 from week 1)

    Convolutional Neural Networks https://www.coursera.org/learn/convolutional-neural-networks/home/welc ...

  9. Deep Learning for NLP学习翻译笔记(2)

    Deep Learning for NLP Deep Learning for NLP Lecture 2:Introduction to Teano enter link description h ...

随机推荐

  1. javascript总结34 :DOM之节点元素获取

    常用节点元素获取: 1. 获取 html -- > document.documentElement 2. 获取 body -- > document.body 3. 获取指定的元素 -- ...

  2. WordPaster2项目变化

    1.1.1. jsp 1.引入json2.min.js 2.控件名称改为WordPasterManager 3.文件保存逻辑更新,直接使用控件生成的文件名称 1.1.2. asp.net 1.引入js ...

  3. 深入理解java虚拟机(十三) Java 即时编译器JIT机制以及编译优化

    在部分的商用虚拟机中,Java 程序最初是通过解释器( Interpreter )进行解释执行的,当虚拟机发现某个方法或代码块的运行特别频繁的时候,就会把这些代码认定为“热点代码”.为了提高热点代码的 ...

  4. 关于super关键字与继承

    super它只是一个限定词,当用super引用时,它也是引用当前对象本身,只是super只是限定了访问当前对象从父类那里继承得到成员变量或方法. import java.util.Date; publ ...

  5. .net 序列化反序列化

    .net 序列化创建对象的深拷贝 public static object DeepClone(object original) { using (MemoryStream stream = new ...

  6. 设置ArcGIS地图文档的数据源为相对路径

    ArcGIS中默认情况下,地图文档的数据源路径为绝对路径.在这种情况下,如果移动/拷贝地图文档及其数据源后,再次打开地图文档时,就看不到具体图层数据了(图层列表中图层前有“!”图标,并且无法查看图层数 ...

  7. 《html5 从入门到精通》读书笔记(一)

    今天看了<html5 从入门到精通>这本书,感觉阅读下来很舒心,不像阅读其他书籍很揪心.html增加的知识点,我觉得非常有价值,看完几章记录了一些内容,不但能巩固,也为下次遗忘知识点做好准 ...

  8. 解决SqlServer 2005 sa帐户不能登录问题

    允许 sa 用户远程是很危险的.推荐的做法是在本地新建一个允许远程连接的用户. 1.启用TCP/IP协议. 2.配置监听端口(1433). net -an 检查本地端口是否建立监听,使用 在线IP端口 ...

  9. mysql用户增删改

    MySql中添加用户,新建数据库,用户授权,删除用户,修改密码(注意每行后边都跟个;表示一个命令语句结束): 1.新建用户 1.1 登录MYSQL: @>mysql -u root -p @&g ...

  10. 转载:RabbitMQ常用命令

    RabbitMQ常用命令 RabbitMQ常用命令 rabbitmqctl命令http://www.rabbitmq.com/man/rabbitmqctl.1.man.html# 1). 服务器启动 ...