Evaluation and Comparison of Deep Learning Frameworks

Artificial intelligence is undoubtedly the frontier field of the computer world, and deep learning is undoubtedly a research hotspot of artificial intelligence. So what are the open source deep learning tools now, and what are their respective advantages and disadvantages? Recently , zer0n and bamos published an article on GitHub, which made deep learning tools such as Caffe , CNTK , TensorFlow , Theano and Torch in terms of network, model capability, interface, deployment, performance, architecture, ecosystem, cross-platform, etc. Compare .

Network and Model Capabilities

Caffe is probably the first mainstream industrial-grade deep learning tool, which started in late 2013 with an excellent convolutional neural network implementation. Caffe is still the most popular toolkit in computer vision, it has many extensions, but it has poor support for recurrent networks and language modeling due to some legacy architectural issues. Also, layers in Caffe need to be defined using C++, while networks are defined using Protobuf.

CNTK was created by the speaker who initiated the deep learning craze, and has now developed into a general-purpose, platform-independent deep learning system. In CNTK, networks are specified as symbolic graphs of vector operations, and combinations of operations form layers. CNTK enables users to create new, complex layer types without using a low-level language through fine-grained building blocks.

TensorFlow is an ideal RNN (Recurrent Neural Network) API and implementation. TensorFlow uses a symbolic graph method of vector operations, making the specification of new networks quite easy, but TensorFlow does not support bidirectional RNNs and 3D convolutions, while the public version The graph definition also does not support looping and conditional control, which makes the implementation of RNNs less than ideal because Python loops must be used and graph compilation optimizations are not possible.

Theano supports most advanced networks, and many of the current research ideas come from Theano, which leads the trend of using symbolic graphs in programming networks. Theano's symbolic API supports loop control, making RNN implementation easier and more efficient.

Torch 's support for convolutional networks is very good. Temporal convolution in TensorFlow and Theano can be implemented via conv2d, but this is a bit tricky; Torch makes its use very intuitive through its native interface to temporal convolution. Torch supports a large number of RNNs through many unofficial extensions, and there are many ways to define the network. But Torch essentially defines the network in layers, and this coarse-grained way makes it lack sufficient support for the extension of new layer types. Compared to Caffe, defining new layers in Torch is very easy, no C++ programming is required, and there are minimal differences between how layers and networks are defined.

interface

Caffe supports pycaffethe interface, but this is only used to assist the command line interface, and even if it is used, the pycaffemodel must be defined using protobuf.

CNTK is used in a similar way to Caffe, by specifying a configuration file and running the command line, but CNTK does not have an interface to Python or any other high-level language.

TensorFlow supports two types of interfaces, Python and C++. Users can experiment in a relatively rich high-level environment and deploy models in environments that require native code or low latency.

Theano supports a Python interface.

Torch runs on LuaJIT, which is very fast compared to industrial languages ​​such as C++, C#, and Java. Users can write any type of calculation without worrying about performance. The only problem is that Lua is not a mainstream language.

Model deployment

Caffe is based on C++, so it can be compiled on a variety of devices, is cross-platform, and is the best choice in terms of deployment.

Like Caffe, CNTK is also C++-based and cross-platform, and deployment is very simple in most cases. But it doesn't support the ARM architecture, which limits its capabilities on mobile devices.

TensorFlow supports the C++ interface, and because it uses Eigen instead of the BLAS class library, it can be compiled and optimized based on the ARM architecture. Users of TensorFlow can deploy trained models to multiple devices without implementing a separate model decoder or loading a Python/LuaJIT interpreter. But TensorFlow does not support Windows, so its models cannot be deployed to Windows devices.

Theano lacks a low-level interface, and its Python interpreter is inefficient and unattractive to industrial users. Although the Python overhead for large models is not large, its limitations are there. The only bright spot is that it is cross-platform and the model can be deployed to the Windows environment.

Torch 's model operation requires LuaJIT support. Although this has little impact on performance, it poses a big obstacle to integration, making it less attractive than Caffe/CNTK/TensorFlow and other frameworks that directly support C++.

performance

In a single-GPU scenario, all of these toolsets call cuDNN, so as long as there is little difference in the computation or memory allocation of the outer layers, the performance is similar. The performance tests in this paper are based on Soumith@FB's ConvNets benchmark .

Caffe is  simple and fast.

CNTK is  simple and fast.

TensorFlow only uses cuDNN v2, but even so its performance is 1.5 times slower than Torch, which also uses cuDNN v2, and training GoogleNet with a batch size of 128 also has memory overflow problems .

Theano 's performance on large networks is on par with Torch7. But its main problem is the extremely long startup time because it needs to compile the C/CUDA code to binary, which is not the case with TensorFlow. Also, the import of Theano is time consuming and there is no way to get rid of preconfigured devices after import (for example GPU0).

Torch is very good, no issues with TensorFlow and Theano.

In addition, CNTK performs better than other deep learning toolkits in terms of multi-GPU, which implements 1-bit SGD and adaptive minibatching.

Architecture

The architecture of Caffe seems to be average now. Its main pain point is that layers need to be defined in C++, and models need to be defined in protobuf. In addition, if you want to support CPU and GPU, users must also implement additional functions, such as Forward_gpuand Backward_gpu; for custom layer types, they must also assign an id of type int and add it to the proto file.

TensorFlow has a clear architecture, adopts a modular design, and supports a variety of front-end and execution platforms.

Theano  's architecture is rather perverted, its entire codebase is Python, and even C/CUDA code is packaged as Python strings, which makes it difficult to navigate, debug, refactor, and maintain.

Torch7和nn类库拥有清晰的设计和模块化的接口。

跨平台

Caffe、CNTK和Theano都能在所有的系统上运行,而TensorFlow和Torch则不支持Windows。

 

原文地址: http://www.infoq.com/cn/news/2016/01/evaluation-comparison-deep-learn

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326888874&siteId=291194637