📜 ⬆️ ⬇️

AI, practical course. Comparison of deep learning software

At a certain stage of your AI project, you will have to decide which machine learning environment you will use. For some tasks, traditional machine learning algorithms will suffice. However, if you are working with a large amount of text, images, video or voice data, it is recommended to use deep learning.
So which deep learning environment to choose? This article is devoted to a comparative analysis of existing deep learning environments.



general information


Deep learning environments simplify the development and training of deep learning models by providing the simplest high-level elements for complex and unreliable mathematical transformations, such as gradient descent, backward propagation, and inference.

Choosing the right environment is not easy, because this area is still poorly developed, and at the moment there is no absolutely winning option. Also, the choice of environment may depend on your goals, resources and team.
')
We will focus on environments that have versions optimized by Intel and that can work efficiently on new CPUs (for example, Intel Xeon Phi processors) optimized for matrix multiplication.

Criteria for evaluation


We evaluated media in two stages.

  1. At first, we quickly evaluated them for their compliance with the basic criterion of community activity.
  2. After that, we performed a deeper and thorough analysis of each environment.

Preliminary estimate


Every Wednesday we evaluated based on community activity and participants' ratings.
Github


Stack overflow


Detailed analysis




Deep learning environments


According to the results of our analysis of popular media, we have compiled the following table for evaluating each medium by popularity and activity.

The overall popularity and activity of different environments
Deep learning environmentNumber of stars GitHubNumber of forks GitHubNumber of GitHub commits in the last monthNumber of questions Stack Overflow
Tensorflow60 03028,808112712 118
Caffe18 35411,277124355
Keras16 3445788712754
Microsoft Cognitive Toolkit11,2502823337545
MXNet99513730230289
Torch696320627722
Deeplearning4J68003168172316
Theano641721541002207
Wednesday neon3043665380



According to these data, the most popular environments are TensorFlow, Caffe, Keras, Microsoft Cognitive Toolkit (formerly known as CNTK), MXNet, Torch, Deeplearning4j (DL4J) and Theano. The popularity of the neon environment is also growing. We will cover these environments in the next section.

Learn more about the most popular environments.


In-depth learning environments vary in their level of functionality. Some of them, such as Theano and TensorFlow, allow you to define neural networks of arbitrary level of complexity using the most basic structural elements. Environments of this type can even be called languages. Other environments, such as Keras, are engines or shells designed to increase developer productivity, but are limited in functionality due to a higher level of abstraction.

When choosing a deep learning environment, you must first choose a low-level environment. A high-level shell may be a good addition, but it is not required. As ecosystems mature, more and more low-level environments will be complemented by higher-level satellites.

Caffe


Caffe is a deep learning environment that is designed with expression, speed, and modularity in mind. It was created by Berkeley AI Research (BAIR) with the participation of community members. Yangqing Jia created a project during his doctoral thesis at the University of California at Berkeley. The Caffe Library is licensed under article 2 on the distribution of Berkeley University software.

Important features:


Microsoft Cognitive Toolkit


Microsoft Cognitive Toolkit (formerly called CNTK) is a unified set of tools for deep learning that presents neural networks as a series of computational actions through a directed graph. In the graph, leaves represent input values ​​or network parameters, and other nodes represent matrix operations in response to input values. The toolkit makes it easy to implement and combine popular types of models, for example, pre-emptive deep neural networks, convolutional neural networks, recurrent neural networks (RNN) and networks with long short-term memory (LSTM). It implements learning on the principle of stochastic gradient descent (SGD, backward error propagation) with automatic differentiation and parallelization across several GPUs and servers. The library has been licensed for open source software since April 2015.

Important features.


Keras


Keras is a high-level neural network API written in Python. This library can be used in addition to TensorFlow or Theano. The Keras library is mainly intended to speed up experiments. An important condition for successful research is the possibility of transition from the idea to the result with the minimum possible delay.

Important features.


DeepLearning4j


Deeplearning4j (DL4J) is the first distributed open source deep learning library for commercial use written for Java * and Scala *. The DL4J library is integrated with Hadoop * and Apache Spark * and is intended for use in corporate environments on distributed graphics processors (GPUs) and CPUs. DL4J is a state-of-the-art, ready-to-use library that is more standard-oriented than customizable and provides rapid prototyping for non-professional researchers. DL4J can be customized when scaled. The library is available under the Apache 2.0 license, and all derived products from DL4J belong to their creators. DL4J allows you to import neural network models from most of the core environments through Keras, including TensorFlow, Caffe, Torch and Theano, closing the gap between the Python ecosystem and the Java Virtual Machine (JVM) using a common set of tools designed for analysts, data engineers and developers. . As the DL4J application programming interface in Python, Keras is used.

Important features.


MXNet


MXNet is a simple, versatile and ultra- scalable environment for deep learning. The environment supports modern models of deep learning, including convolutional neural networks and LSTM. The library originates in the scientific community and is the product of collaborative and individual work of researchers from several leading universities. The library, actively supported by Amazon, was developed with a special focus on machine vision, processing and understanding of speech and language, generating models, convolutional and recurrent neural networks. MXNet allows you to define, train and deploy networks in a wide variety of conditions: from powerful cloud infrastructures to mobile and connected devices. The library provides a universal environment with support for many common languages, making it possible to use both imperative and symbolic software constructs. The MXNet library also takes up little space. Because of this, it can be scaled efficiently on multiple graphics processors and machines, which is well suited for learning on large data sets in a cloud environment.

Important features.


Wednesday neon


With an open source Python-based language and a set of libraries for developing deep learning models, neon is a fast, powerful, and easy-to-use tool.

Important features.


Tensorflow


TensorFlow is an open source software library for numerical calculations using data flow graphs. The nodes in the graph represent mathematical operations, and the branches of the graph represent multidimensional data arrays (tensors) that they exchange. Thanks to the universal computing architecture, you can deploy on one or more CPUs or graphics processors on a desktop computer, server, or mobile device with a single API. TensorFlow was originally developed by researchers and engineers who worked for the Google Brain team at Google’s Machine Intelligence unit for machine learning and neural networks, but because of its general nature, the system can also be used in other areas.

Theano


Theano is a Python library designed to define, optimize, and evaluate mathematical expressions, especially expressions with multidimensional arrays (numpy.ndarray). Theano allows you to achieve speeds of working with large amounts of data that can compete only with specially made programs in the SI language. Theano also surpasses the SI on the CPU many times due to the use of the latest versions of graphics processors. Theano combines aspects of the computer algebra system (SKA) with aspects of an optimizing compiler. With Theano, you can also create custom SI code for many mathematical operations. This combination of SKA with optimizing compilation is especially well suited for problems in which complex mathematical expressions are evaluated many times, therefore the speed of evaluation is important for them. In situations where many different expressions are evaluated only once, Theano helps reduce unproductive compilations and analyzes, while still providing symbolic functions, such as automatic differentiation.

Important features.


Torch


Torch is a scientific computing environment with broad support for machine learning algorithms, with an emphasis on graphics processors (GPUs). It is notable for its ease of use and speed due to the simple and fast scripting language, LuaJIT and the basic C / CUDA program.

Important features.


Detailed analysis


Most environments have common features: speed, portability, community and ecosystem, ease of development, compatibility, and scalability.

The inputs for the search process in the environment for our project to create an automatic video editing application must meet the following requirements.


Developer productivity: Language


Developer productivity is of great importance, especially at the stage of prototyping, so you need to choose an environment that matches the skills and knowledge of your team members. For this reason, we will exclude all environments based on alternative languages.


New or existing deep learning algorithms and network architecture


Most projects, including our training project, use only some existing neural network algorithm, such as AlexNet or LSTM. In our case, any deep learning environment should be suitable. However, if you are working on a research project (for example, developing a new algorithm, testing a new hypothesis or optimizing a library), high-level systems, such as Keras, will not work for you. Low-level environments are likely to require you to write a new algorithm in C ++.

Our list of (deep learning environments) remains the same.


Supported Neural Network Architectures


Our training project involves the solution of two traditional problems of deep learning:


All environments support convolutional neural networks (used mainly for image processing) and recurrent neural networks (used for sequence modeling).

Our list remains the same:


Availability of pre-trained models


Since we do not have a large data set (for example, 6000 annotated images) to train the model of our project, we must use previously trained models.

All selected environments support model parks. In addition, there are converters that allow the use of models that have been trained using another library. The Caffe library was the first to enter the model park and has the widest selection of models. There are tools for converting Caffe park models to virtually any other model:


All of these environments also have their own model parks.

Our list remains the same:


Developer productivity: Easy model definition


The model can be defined in two ways: using the configuration file (for example, using Caffe) or using scripts (in other environments). Configuration files are convenient from the point of view of model portability, but they are difficult to use when creating a complex neural network architecture (for example, try manually copying layers in ResNet-101). On the other hand, using scripts you can create complex neural networks with minimal code repetition, but the possibility of transferring such code to another environment will be questionable. Usually it is preferable to use scripts, because transitions from one environment to another within one project rarely happen.

Now our list will change as follows:


Support for optimized CPUs and multiple CPUs for learning deep learning models


The Intel Math Kernel Library (Intel MKL) for vector and matrix multiplication has been refined for deep learning and now includes the integrated multi-core architecture of Intel Many Integrated Core Architecture. This is a processor architecture with extensive parallelization, which significantly speeds up the process of deep learning on the CPU. All current competing environments have already integrated Intel MKL and offer versions optimized by Intel.

It is also important to know whether distributed learning is supported by multiple CPUs. Based on these criteria, our modified list will be as follows:


Developer Performance: Deploying the Model


TensorFlow supports a special tool called TensorFlow Serving. It takes a trained TensorFlow model as input and converts it into a web service that allows it to evaluate incoming requests. If you are going to use a trained model on a mobile device, TensorFlow Mobile provides immediate compression of the model.

Read more about TensorFlow Serving
TensorFlow Mobile

MXNet provides a merge deployment, in which the model, along with all the necessary bindings, is placed in a standalone file. Such a file can then be transferred to another machine, and accessed through other programming languages. For example, it can be used on a mobile device. More details .

The Microsoft Cognitive Toolkit (formerly CNTK) provides model deployment through the Azure * machine learning cloud environment. Mobile devices are not supported yet. Their support is expected in the next version. More details .

Although we are not going to deploy an out-of-the-box application on a mobile device, in some situations this possibility can be very useful. For example, imagine a video editing application that can be used to create videos from just taken snapshots (this feature is already available in Google Photos).

Now we have two competitors left: TensorFlow and MXNet. In the end, the team working on this project decided to use the TensorFlow library in conjunction with Keras, because it has a more active community, the team members have experience working with these tools, and also because TensorFlow has more successful projects. See the list of users TensorFlow .

Conclusion


In this article, we presented several popular environments for deep learning and compared them according to several criteria. The ease of prototyping, deployment, and debugging of the model, along with community size and scalability across multiple machines, are among the most important criteria that should be guided in choosing a deep learning environment. All modern environments now support convolutional and recurrent neural networks, have parks of pre-trained models and offer versions optimized for modern Intel Xeon Phi processors. As our analysis showed, for the purposes of our project, Keras based on the TensorFlow version optimized by Intel would be an excellent choice. Another successful option would be the Intel optimized MXNet library.

Although according to the results of this comparative analysis, the TensorFlow library won, we did not take into account comparison standards, which are of key importance. We plan to write a separate article in which we compare the output and training time of the TensorFlow and MXNet libraries for a wide range of deep learning models in order to determine the final winner.

Source: https://habr.com/ru/post/359184/


All Articles