12 large depth of learning open source framework (caffe, tf, pytorch, mxnet etc.) Quick Start projects

This is a summary of the text, to give us great depth study stroke clear 12 Quick Start open-source framework, which is three AI's GitHub project, we welcome the star / fork

https://github.com/longpeng2008/yousan.ai
Here Insert Picture Description

Here Insert Picture Description

1 Overview

1.1 Open Source Framework Overview

Today open source eco very well, many open-source framework related to the depth of learning, there is just familiar Caffe, tensorflow, pytorch / caffe2, keras, mxnet , paddldpaddle, Theano, cntk, deeplearning4j, matconvnet and so on.

How to choose the most suitable for your open source framework is a problem. There are three AI in some time ago, give everyone finishing the tutorial and code 12 Quick Start depth study of open-source framework for beginners to pick a qualified engineer how deep learning algorithm was familiar with one of the more than 3 bar.

Here is an overview of the major open-source framework.
Here Insert Picture Description

Here we have some framework does not impress, because they have been upgraded or you prefer to use a simpler version, such as from torch-> pytorch, from theano to lasagne. In addition these frameworks support CUDA , and therefore there is no programming language to write cuda.

In the choice of open-source framework, to consider a number of reasons, such as open source ecosystem of perfection , such as their own needs projects , such as their own familiar language . Of course, now there are many open source tools such as MMDNN etc. Mutual Convert between open source framework, but also reduces the cost to migrate them to learn the framework.

In addition there are tiny-dnn, ConvNetJS, MarVin, Neon, and so a small minority, as well as other mobile end CoreML framework, it is no longer introduced one by one.

Overall for what kind of framework choices, three can give some advice.

(1) In any case, tensorflow / pytorch you have to be , which is the developer favorite, the most abundant of the two open source projects framework.

(2) If you want to develop mobile end algorithm, then Caffe is not will not.

(3) If you are very familiar with Matlab, matconvnet you should not miss.

(4) If you pursue efficient and lightweight , the darknet and mxnet you can not familiar with.

(5) If you are lazy, you want to write a minimum of code to complete the task, then use keras it.

(6) If you are a java programmer, grasp deeplearning4j correct.

Other frameworks, but also has its own characteristics, they can go with their own multi-use.

Learn how open source framework 1.2

To master an open source framework, usually you need to do the following:

  • (1) the preparation and use of master data of different tasks.

  • (2) master model definition.

  • (3) proficiency training process and results visualization.

  • (4) proficiency training methods and test methods.

A framework, the official will open a number of cases, the most common case is to MNISI data interface + pre-training model in the form of, for your fast results, but this is obviously not enough, learning should not remain on the run through the official demo , but to solve practical problems.

We must learn to read custom data from the interface, self-defined visualization of network structures, model train, model, model testing and deployment omni grasp.

So we set up a "Quick Start 2 hours open source framework" series, to a reference image classification task, and lead us step by step entry, follow-up will increase segmentation, testing and other tasks.

This is a binary classification task for everyone to prepare a 500 smiley face pictures, 500 expressionless pictures, placed in the data directory git engineering, image preview below, have all been scaled to the size of 60 * 60:

This is expressionless picture:
Here Insert Picture Description
This is a smiley face picture.
Here Insert Picture Description

Therefore, our goal is to use these 500 pictures image classification accomplish this task.

In the process of learning all of the following framework, we must complete the following process, the only way to truly be called completed a training mission.

Here Insert Picture Description
In addition, all frames use the same model, which is a three-layer fully connected network convolution +2 floor, convolution + BN + layer composed of an active layer, and some use a long band convolution step, some use of the pool, not very different.

Input image, 48 48 the RGB color Fig.

The first layer convolution, the number of channels 12, 3 * 3 convolution kernel.

The second layer convolution, the number of channels 24, 3 * 3 convolution kernel.

The third layer convolution, the number of channels 48, 3 * 3 convolution kernel.

The first layer is fully connected, the number of channels 128.

The second layer is fully connected, channels 2, i.e. the number of categories.

Network structure is as follows:

Here Insert Picture Description
This is the simplest kind of network structure, depending on the optimization of the time frame, using a slightly different embodiment. Because the goal here is not to compare the performance of each frame, so there is no deliberately kept exactly the same.

2 open source framework

Here we begin each framework outlined.

2.1 Caffe

github address: https: //github.com/BVLC/caffe.

(1 Overview:

Caffe Berkeley is leading the development of Jayantha clear to C ++ / CUDA code is based, one of the earliest deep learning framework, than TensorFlow, Mxnet, Pytorch so earlier, you need to compile and install. Support command line, Python and Matlab interfaces, stand-alone multi-card, multi-machine card so you can easily use. Currently master branch has stopped updating, intel still maintain branches, etc., Caffe framework has been very stable .

(2) caffe typically use the following process:

Here Insert Picture Description

Are decoupled from each other than the process, the use of very elegant caffe simple.

(3) caffe has obvious advantages and disadvantages.

  • advantage:
  1. In C ++ / CUDA / python code is based, fast, high performance .
  2. Factory design pattern, clear code structure, readability and strong expansion.
  3. Support command line, Python and Matlab interfaces, easy to use.
  4. Easy to switch between the CPU and GPU, GPU more convenient training.
  5. Rich tools, community activists.
  • Disadvantages:
  1. Source modifications higher threshold, before communication to the need to achieve reverse, and the code ... CUDA
  2. It does not support automatic derivation.
  3. It does not support the model-level parallelism, which only supports data-level parallelism
  4. Not suitable for non-image tasks.

Here Insert Picture Description
At the same time you can see the following quick start documents, and read the relevant source code.

[Quick] caffe caffe image classification model to test the custom from

2.2 Tensorflow

github address: https: //github.com/tensorflow/tensorflow.

(1 Overview

TensorFlow is Google brain launch open-source machine learning library can be used all kinds of deep learning-related tasks.

The Tensor + = Flow TensorFlow, the Tensor is a tensor , represents N-dimensional array, and this is the blob similar Caffe; Flow i.e. flow , data flow graph represents the calculated based.

(2) features

TensorFlow biggest feature is calculation map, i.e., to define good map, and then calculates , so all TensorFlow code contains two parts:

  • Create a calculated diagram showing the data flow calculation. What does it do? In fact, a good definition of some operations, you can define it as a process of Caffe prototxt in.

  • Running a session, executes the operation, can be seen in the training process Caffe. Just a lot more flexible than Caffe TensorFlow session, since the interface is Python, Take intermediate result analysis, Debug like a lot easier.

Currently tensorflow has been updated to 2.0, the code still 1.x version, for example.

Here Insert Picture Description

[Quick] Tensorflow tensorflow custom image classification from model to test

2.3 Pytorch

github address: https: //github.com/pytorch/pytorch.

(1) Overview: stating Pytorch = Python + Torch.

Torch is a machine learning open source framework at New York University, a few years ago is very popular in academia, including Lecun and other heavyweights are in use. However, due to the use of an absolute majority of people have not heard of the Lua language, leading to a lot of people are scared off. Later, as more and more perfect ecological Python, the Institute launched a Pytorch Facebook artificial intelligence and open source. Torch Pytorch not a simple package and provides a Python interface, but above all codes have been reconstructed Tensor, like TensorFlow, increase the automatic derivation .

Later Caffe2 fully incorporated Pytorch, it has now become very popular frameworks. Many recent studies such as stylized, GAN and so in most cases Pytorch source.

(2) features

  • FIG dynamic calculation. TensorFlow development from a static to a dynamic map drawing mechanism Eager Execution, pytorch the outset dynamic map mechanism. The benefits of dynamic graph mechanism is to modify at any time, anywhere debug, no such compilation process.

  • Simple . Compared TensorFlow1.0 in Tensor, Variable, Session full of concepts, data reading interface frequently updated, tf.nn, tf.layers, tf.contrib each repetition, Pytorch is from Tensor and then to Variable nn.Module, latest the Pytorch has Tensor and Variable merger, which is the amount of each level of abstraction to the progressive network from data sheets. People laugh TensorFlow design is " the make IT Complicated ", then Pytorch design is " the Keep IT SIMPL E."

Here Insert Picture Description

[Quick] Pytorch pytorch custom image classification from model to test

2.4 Mxnet

github address: https: //github.com/apache/incubator-mxnet.

(1 Overview

Mxnet is led by Li Mu, who developed a very flexible, highly scalable framework is Amazon as the official framework.

(2) features

Mxnet have both imperative programming and symbolic programming features. In order to provide programming MXNet tensor calculation, and control logic for updating iterative training of the model; MXNet in declarative programming support symbolic expressions used to describe the neural network, and the system provides an automatic derivation to train model. Mxnet performance is very high, not recommended students use the resources.

Here Insert Picture Description

[Quick] mxnet mxnet custom image classification from model to test

2.5 Hard

github URL: https: //github.com/keras-team/keras.

(1 Overview

Keras is one pair of white very user-friendly and simple deep learning framework, strictly speaking, it is not an open source framework, but a highly modular neural network library.

Keras at the top can call TensorFlow, CNTK, Theano, there are more libraries are also supported in succession. Keras feature is the ability to build a fast implementation of the model is the key to scientific research is conducted efficiently.

(2) features

  • Highly modular, build a network is very simple.

  • API is very simple , with a unified style.

  • Easy to expand, just use python to add new classes and functions.

[Quick] Keras Keras custom image classification from model to test

2.6 Paddlepaddle

github URL: https: //github.com/PaddlePaddle/Paddle.

(1 Overview

As the saying Google has Tensorflow, Facebook has Pytorch, Amazon has Mxnet, as a domestic pioneer in machine learning, Baidu also has PaddlePaddle, which Paddle ie Parallel Distributed Deep Learning (Parallel Distributed depth study).

(2) features

paddlepaddle performance is also very good, overall use and tensorflow very similar, with Chinese help documentation within the Baidu is also recommended for other tasks. Further, supporting a visual frame visualdl , tensorboard also with the same purpose. Small domestic framework, we support ah!

[Quick] paddlepaddle paddlepaddle custom image classification model from the test,

2.7 CNT

github address: https: //github.com/Microsoft/CNTK.

(1 Overview

CNTK Microsoft open source deep learning toolkit neural network will be described as a series of calculation steps to FIG there through. In a directed graph, the input values ​​representing the leaf nodes or network parameters, while the other nodes represent matrix operation on its input.

CNTK allows the user to very easily implement a combination of popular models, including the feedforward DNN, convolution Network (CNN) and the cycle network (RNN / LSTM). Most of the current frame as to achieve the automatic derivation, using a stochastic gradient descent optimization method.

(2) features

  • CNTK higher performance , according to its official statement, are higher than other open source framework for performance.

  • Suitable for voice , CNTK this is Microsoft Speech team of open source, natural voice is more suitable to do the task, using the RNN and other models, as well as convolution in the spatial and temporal scales are very easy.

[Quick] cntk cntk custom image classification from model to test

2.8 Matconvnet

github address: https: //github.com/vlfeat/matconvnet.

(1 Overview

Python language is different from the kinds of deep learning framework widely used, MatConvnet is used as an interface language matlab depth study of open source libraries , the underlying language is cuda.

(2) features

Because it is in matlab below, the debug process is very convenient, but also itself has a lot of researchers have been using matlab language, so in fact the language group is very large.

[Quick] MatConvnet MatConvnet custom image classification from model to test

2.9 Deeplearning4j

github address: https: //github.com/deeplearning4j/deeplearning4j.

(1 Overview

Language learning is different from the widely used Python depth, DL4J is written in open source java jvm and deep learning library supports a variety of deep learning model.

(2) features

The most important feature is DL4J Support for distributed, Spark and can run on Hadoop, support for distributed CPU and GPU operation. DL4J is for the business environment, rather than the design of the Institute, and therefore closer to some of the production environment.

[Quick] Deeplearning4j DL4J custom image classification from model to test

2.10 Chainer

github address: https: //github.com/chainer/chainer.

(1 Overview

chainer is a python framework based on the depth of learning, can easily and intuitively write complex neural network architecture, widely used in Japanese companies.

(2) features

chainer using "Define-by-Run" scheme, i.e., by calculating the actual forward dynamically defined network. Rather, chainer storage computing history instead of programming logic, pytorch dynamic thinking mainly comes from graph mechanism chainer.

[Quick] chainer chainer custom image classification from model to test

2.11 Lasagne/Theano

github address: https: //github.com/Lasagne/Lasagne.

(1 Overview

Lasagen is actually encapsulates theano, which is a very old framework, in 2008, when it is open source by the Montreal LISA led a group Yoshua Bengio.

(2) features

Theano the high cost, need to start to write the code from the ground up to the model, Lasagen its packaging, such theano simpler to use.

[Quick] Lasagne Lasagne / Theano custom image classification from model to test

2.12 Darknet

github address: https: //github.com/pjreddie/darknet.

(1 Overview

Darknet itself is a framework for Joseph Redmon Yolo series development.

Joseph Redmon proposed Yolo v1, Yolo v2, Yolo v3.

(2) features

Darknet almost no dependencies, deep learning is an open source framework from CUDA C and began writing to support the CPU and GPU. Darknet with caffe somewhat similar, but more lightweight, well worth learning to use.

[Quick] Darknet darknet custom image classification from model to test

Published 69 original articles · won praise 47 · views 4912

Guess you like

Origin blog.csdn.net/weixin_42535423/article/details/104799191