深度学习工具汇总

转自: http://blog.csdn.net/striker_v/article/details/52692848


深度学习工具汇总

A Summary of Deep Learning Developing Tools


       随着深度学习的迅猛发展,深度学习的开发框架和工具也越来越多。不只是著名大学和科研机构在研究自己的深度学习框架,各大公司也已经推出了不少深度学习开发平台。

                                            

                                             

    以下是深度学习主页上列出的深度学习开发工具。


    由此可见,目前基于深度学习的开发平台和开发工具种类已经很多,下面主要介绍一下大家普遍使用的一些开发工具。

 

 

1. DeepLearnToolbox


DeepLearn Toolbox是一种深度学习的Matlab实现。它以Matlab的一种扩展工具箱的方式被使用。其主要特性如下:

底层语言:Matlab

接口语言:Matlab

运行方式:CPU or GPU

操作系统:Windows or Linux

安装方式:下载后在Matlab中打开并添加路径即可

支持的深度学习网络:人工神经网络(NN),卷积神经网络(CNN),深度置信网(DBN),栈式自动编码器(SAE),卷积自动编码器(CAE)

集成的数据集:MNIST

  优势:使用Matlab实现,源码短且可读性强,适合深度学习入门学习。

  不足:集成的网络构建方法及网络参数选择较少,不能自由设定网络结构和部分参数,可变性差,设计自己的网络需要大量编程。

  下载地址:https://github.com/rasmusbergpalm/DeepLearnToolbox

 

2. Theano

Theano是一个Python库,它允许使用者有效地定义、优化和评估涉及多维数组的数学表达式,同时支持GPU和高效符号分化操作。

Theano具有以下特点:

(a)与NumPy紧密相关(在Theano的编译功能中使用了Numpy.ndarray)

(b)透明地使用GPU(执行数据密集型计算比CPU快了140多倍)

(c)速度和稳定性的优化(即使输入的x非常小也可以得到log(1+x)正确结果)

(d)动态生成C代码(表达式计算更快)

(e)广泛的单元测试和自我验证(多种错误类型的检测和判定)

自2007年起,Theano一直致力于大型密集型科学计算研究,但它目前也很被广泛应用在课堂之上(如Montreal大学的深度学习/机器学习课程)。

Theano的主要特性如下。

底层语言:Python

接口语言:Python

运行方式:CPU or GPU

操作系统:Windows or Linux

安装方式:需要配置相关Python库 需要CUDA支持

支持的深度学习网络:支持大部分先进的网络,提供数学计算支持,网络需要自己实现,缺少写好的例子。

集成的数据集:无

  优势:它引领了符号图在编程网络中使用的趋势,Theano的符号API支持循环控制,让RNN的实现更加容易且高效。而且Theano跨平台,模型能够部署到Windows环境上。

  不足:启动时间长,缺乏底层接口,并且其Python解释器也很低效,对工业用户而言缺少吸引力。

  下载地址:https://github.com/Theano/Theano

 

3. Caffe

Caffe的全称应该是ConvolutionalArchitecture for Fast Feature Embedding,它是一个清晰、高效的深度学习框架,它是开源的。Caffe是目前最流行的深度学习框架之一。

总的来说,Caffe的特点如下:
(a)表达方便:模型和优化办法的表达用的是纯文本办法表示,而不是代码
(b)速度快:对于科研来说,我们提供接近于工业化的速度对于大规模数据和当前最牛掰的算法模型是非常重要的
(c)模块化:具有新任务和设置需要的灵活性和扩展性
(d)开放性:科学研究和应用程序可调用同样的代码,参考模型,并且结果可重现。
(e)社区性:学术研究,启动原型和工业应用领域的伙伴以一个BSD-2项目的形式共同讨论和开发。

Caffe的主要特性如下。

开发者:Berkeley Vision and LearningCenter

底层语言:C++

接口语言:命令行,Python,Matlab

运行方式:CPU or GPU

操作系统:Windows or Linux

安装方式:需要配置相关Python库 需要CUDA支持 需要OpenCV支持

支持的深度学习网络:支持大部分先进的网络

集成的数据集:CIFAR10 ILSVRC12 MNIST

  优势:网络开发和构建过程简单,运行速度快,实现了多种接口,实现了跨平台,可能是第一个主流的工业级深度学习工具。

  不足:Caffe对递归网络和语言建模的支持很差,支持pycaffe接口,但这仅仅是用来辅助命令行接口的,而即便是使用pycaffe也必须使用protobuf定义模型。

  下载地址:https://github.com/BVLC/caffe

 

4. Torch & Torchnet

Torch诞生已经有十年之久,但是真正起势得益于2015年Facebook开源了大量Torch的深度学习模块和扩展。Torch另外一个特殊之处是采用了不怎么流行的编程语言Lua(该语言曾被用来开发视频游戏)。

Torch的主要特性如下。

开发者:Facebook

底层语言:用快速的脚本语言LuaJit开发,底层是C/CUDA实现

接口语言:Lua语言

运行方式:CPU or GPU

操作系统:Windows or Linux

安装方式:需要安装Lua语言支持

支持的深度学习网络:支持大部分先进的网络

  优势:对卷积网络的支持非常好。Torch通过很多非官方的扩展支持大量的RNN,同时网络的定义方法也有很多种。

  不足:Torch本质上是以图层的方式定义网络的,这种粗粒度的方式使得它对新图层类型的扩展缺乏足够的支持。模型运行需要LuaJIT的支持,虽然这样做对性能的影响并不大,但却对集成造成了很大的障碍,使得它的吸引力不如Caffe/CNTK/TensorFlow等直接支持C++的框架。

  下载地址:http://torch.ch/

 

 

 

 

 

 

 

 

 

5. TensorFlow

TensorFlow 是谷歌发布的第二代机器学习系统。具体的讲,TensorFlow是一个利用数据流图(Data Flow Graphs)进行数值计算的开源软件库:图中的节点(Nodes)代表数学运算操作,同时图中的边(Edges)表示节点之间相互流通的多维数组,即张量(Tensors)。这种灵活的架构可以让使用者多样化地将计算部署在台式机、服务器或者移动设备的一个或多个CPU上,而且无需重写代码。

TensorFlow具有以下特性:

开发者:Google Brain Team

底层语言:C++ Python

接口语言:Python C/C++

运行方式:CPU or GPU

操作系统:Linux or Mac OS X

安装方式:需要安装Python支持

支持的深度学习网络:卷积网络循环网络

优势:TensorFlo是一个理想的RNN(递归神经网络) API和实现,而且它架构清晰,采用了模块化设计,支持多种前端和执行平台。

不足:TensorFlow并不支持双向RNN和3D卷积,同时公共版本的图定义也不支持循环和条件控制,这使得RNN的实现并不理想,因为必须要使用Python循环且无法进行图编译优化。

    下载地址:www.tensorflow.org/

 

6. CNTK

CNTK(Computational Network Toolkit )是一个统一的深度学习工具包,该工具包通过一个有向图将神经网络描述为一系列计算步骤。在有向图中,叶节点表示输入值或网络参数,其他节点表示该节点输入之上的矩阵运算。

CNTK具有以下特性:

开发者:Microsoft

底层语言:C++

接口语言:Python C/C++ 命令行

运行方式:CPU or GPU

操作系统:Windows or Linux

安装方式:安装相关依赖库并编译源码

支持的深度学习网络:前馈DNN网络 卷积网络 循环网络

优势:CNTK通过细粒度的构件块让用户不需要使用低层次的语言就能创建新的、复杂的层类型。与Caffe一样也是基于C++并且跨平台的,大部分情况下部署非常简单。同时它实现了跨多GPU 和服务器自动分化和并行化的随机梯度下降(SGD,误差反向传播)学习。
    不足:CNTK不支持ARM架构,这限制了它在移动设备上的能力。

下载地址:https://github.com/Microsoft/CNTK

 

7. MXNET

MXNet是一个兼具效率和灵活性的深度学习框架。它允许使用者将符号编程和命令式编程相结合,以追求效率和生产力的最大化。其核心是动态依赖调度程序,该程序可以动态自动进行并行化符号和命令的操作。其中部署的图形优化层使得符号操作更快和内存利用率更高。该库轻量且便携带,并且可扩展到多个GPU和多台主机上。

MXNET具有以下特性:

开发者:分布式(深度)机器学习社区

底层语言:C++

接口语言:C++ Python Julia Matlab JavaScript R Scala

运行方式:CPU or GPU

操作系统:Linux  OS X  Windows

安装方式:需要Python和CUDA支持

支持的深度学习网络:随机储存器/动态贝叶斯网络 卷积网络 循环网络

优势:MXNet强调提高内存使用的效率,甚至能在智能手机上运行诸如图像识别等任务。MXNet整合了各种编程方法的优势最大限度地提高灵活性和效率。另外,MXNet对“云计算”友好,直接兼容S3、HDFS和Azure。

下载地址:https://github.com/dmlc/mxnet

 

8. Keras

Keras是极其精简并高度模块化的神经网络库,在TensorFlow 或 Theano 上都能够运行,是一个高度模块化的神经网络库,支持GPU和CPU运算。Keras可以说是Python版的Torch7,对于快速构建CNN模型非常方便,同时也包含了一些最新文献的算法,比如Batch Noramlize,文档教程也很全,在官网上作者都是直接给例子浅显易懂。Keras也支持保存训练好的参数,然后加载已经训练好的参数,进行继续训练。
    Keras侧重于开发快速实验,用可能最少延迟实现从理念到结果的转变,即为做好一项研究的关键。

当需要使用符合如下要求的深度学习的库时,就可以考虑使用Keras:

(a)考虑到简单快速的原型法(通过总体模块性、精简性以及可扩展性);

(b)同时支持卷积网络和递归网络,以及两者之间的组合;

(c)支持任意连接方案(包括多输入多输出训练);

(d)可在CPU和GPU 上无缝运行。

下载地址:https://github.com/fchollet/keras

 

 

参考资料:

1. Deep Learning主页

http://deeplearning.net/

2. Deep Learning –Software Links

http://deeplearning.net/software_links/

3.DeepLearnToolbox使用总结

http://blog.csdn.net/lifeitengup/article/details/10219075

4. CNTK从入门到深入研究(1)- 一切都从介绍和环境搭建开始

http://blog.csdn.net/borisjineman/article/details/50664298

5. 深度学习框架的评估与比较

http://www.infoq.com/cn/news/2016/01/evaluation-comparison-deep-learn?utm_campaign=infoq_content&

6. 主流深度学习框架对比

http://www.360doc.com/content/16/0913/21/32626470_590596139.shtml

7. TensorFlow等主流深度学习框架比较分析

http://www.tuicool.com/articles/BVFb6bb

8. 十个值得一试的开源深度学习框架

http://os.51cto.com/art/201511/497444.htm

9. 常用深度学习框架

http://www.gpus.cn/qianduan/front/getNewsArc?articleid=111

10 易用的深度学习框架Keras简介

http://www.tuicool.com/articles/ZbAJbiN

11. Keras Documentation

https://keras.io/

12. python keras (一个超好用的神经网络框架)的使用以及实例

http://blog.csdn.net/star_bob/article/details/48598417

 

 

深度学习工具包 Deprecation notice. ----- This toolbox is outdated and no longer maintained. There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/) I would suggest you use one of the tools mentioned above rather than use this toolbox. Best, Rasmus. DeepLearnToolbox ================ A Matlab toolbox for Deep Learning. Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data. It is inspired by the human brain's apparent deep (layered, hierarchical) architecture. A good overview of the theory of Deep Learning theory is [Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf) For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng. * [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007) * [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010) * [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011) If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284) ``` @MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012", } ``` Contact: rasmusbergpalm at gmail dot com Directories included in the toolbox ----------------------------------- `NN/` - A library for Feedforward Backpropagation Neural Networks `CNN/` - A library for Convolutional Neural Networks `DBN/` - A library for Deep Belief Networks `SAE/` - A library for Stacked Auto-Encoders `CAE/` - A library for Convolutional Auto-Encoders `util/` - Utility functions used by the libraries `data/` - Data used by the examples `tests/` - unit tests to verify toolbox is working For references on each library check REFS.md Setup ----- 1. Download. 2. addpath(genpath('DeepLearnToolbox')); Example: Deep Belief Network --------------------- ```matlab function test_example_DBN load mnist_uint8; train_x = double(train_x) / 255; test_x = double(test_x) / 255; train_y = double(train_y); test_y = double(test_y); %% ex1 train a 100 hidden unit RBM and visualize its weights rand('state',0) dbn.sizes = [100]; opts.numepochs = 1; opts.batchsize = 100; opts.momentum = 0; opts.alpha = 1; dbn = dbnsetup(dbn, train_x, opts); dbn = dbntrain(dbn, train_x, opts); figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights %% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NN rand('state',0) %train dbn dbn.sizes = [100 100]; opts.numepochs = 1; opts.batchsize = 100; opts.momentum = 0; opts.alpha = 1; dbn = dbnsetup(dbn, train_x, opts); dbn = dbntrain(dbn, train_x, opts); %unfold dbn to nn nn = dbnunfoldtonn(dbn, 10); nn.activation_function = 'sigm'; %train nn opts.numepochs = 1; opts.batchsize = 100; nn = nntrain(nn, train_x, train_y, opts); [er, bad] = nntest(nn, test_x, test_y); assert(er < 0.10, 'Too big error'); ``` Example: Stacked Auto-Encoders --------------------- ```matlab function test_example_SAE load mnist_uint8; train_x = double(train_x)/255; test_x = double(test_x)/255; train_y = double(train_y); test_y = double(test_y); %% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN % Setup and train a stacked denoising autoencoder (SDAE) rand('state',0) sae = saesetup([784 100]); sae.ae{1}.activation_function = 'sigm'; sae.ae{1}.learningRate = 1; sae.ae{1}.inputZeroMaskedFraction = 0.5; opts.numepochs = 1; opts.batchsize = 100; sae = saetrain(sae, train_x, opts); visualize(sae.ae{1}.W{1}(:,2:end)') % Use the SDAE to initialize a FFNN nn = nnsetup([784 100 10]); nn.activation_function = 'sigm'; nn.learningRate = 1; nn.W{1} = sae.ae{1}.W{1}; % Train the FFNN opts.numepochs = 1; opts.batchsize = 100; nn = nntrain(nn, train_x, train_y, opts); [er, bad] = nntest(nn, test_x, test_y); assert(er < 0.16, 'Too big error'); ``` Example: Convolutional Neural Nets --------------------- ```matlab function test_example_CNN load mnist_uint8; train_x = double(reshape(train_x',28,28,60000))/255; test_x = double(reshape(test_x',28,28,10000))/255; train_y = double(train_y'); test_y = double(test_y'); %% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% error rand('state',0) cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer }; cnn = cnnsetup(cnn, train_x, train_y); opts.alpha = 1; opts.batchsize = 50; opts.numepochs = 1; cnn = cnntrain(cnn, train_x, train_y, opts); [er, bad] = cnntest(cnn, test_x, test_y); %plot mean squared error figure; plot(cnn.rL); assert(er<0.12, 'Too big error'); ``` Example: Neural Networks --------------------- ```matlab function test_example_NN load mnist_uint8; train_x = double(train_x) / 255; test_x = double(test_x) / 255; train_y = double(train_y); test_y = double(test_y); % normalize [train_x, mu, sigma] = zscore(train_x); test_x = normalize(test_x, mu, sigma); %% ex1 vanilla neural net rand('state',0) nn = nnsetup([784 100 10]); opts.numepochs = 1; % Number of full sweeps through data opts.batchsize = 100; % Take a mean gradient step over this many samples [nn, L] = nntrain(nn, train_x, train_y, opts); [er, bad] = nntest(nn, test_x, test_y); assert(er < 0.08, 'Too big error'); %% ex2 neural net with L2 weight decay rand('state',0) nn = nnsetup([784 100 10]); nn.weightPenaltyL2 = 1e-4; % L2 weight decay opts.numepochs = 1; % Number of full sweeps through data opts.batchsize = 100; % Take a mean gradient step over this many samples nn = nntrain(nn, train_x, train_y, opts); [er, bad] = nntest(nn, test_x, test_y); assert(er < 0.1, 'Too big error'); %% ex3 neural net with dropout rand('state',0) nn = nnsetup([784 100 10]); nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through data opts.batchsize = 100; % Take a mean gradient step over this many samples nn = nntrain(nn, train_x, train_y, opts); [er, bad] = nntest(nn, test_x, test_y); assert(er < 0.1, 'Too big error'); %% ex4 neural net with sigmoid activation function rand('state',0) nn = nnsetup([784 100 10]); nn.activation_function = 'sigm'; % Sigmoid activation function nn.learningRate = 1; % Sigm require a lower learning rate opts.numepochs = 1; % Number of full sweeps through data opts.batchsize = 100; % Take a mean gradient step over this many samples nn = nntrain(nn, train_x, train_y, opts); [er, bad] = nntest(nn, test_x, test_y); assert(er < 0.1, 'Too big error'); %% ex5 plotting functionality rand('state',0) nn = nnsetup([784 20 10]); opts.numepochs = 5; % Number of full sweeps through data nn.output = 'softmax'; % use softmax output opts.batchsize = 1000; % Take a mean gradient step over this many samples opts.plot = 1; % enable plotting nn = nntrain(nn, train_x, train_y, opts); [er, bad] = nntest(nn, test_x, test_y); assert(er < 0.1, 'Too big error'); %% ex6 neural net with sigmoid activation and plotting of validation and training error % split training data into training and validation data vx = train_x(1:10000,:); tx = train_x(10001:end,:); vy = train_y(1:10000,:); ty = train_y(10001:end,:); rand('state',0) nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax output opts.numepochs = 5; % Number of full sweeps through data opts.batchsize = 1000; % Take a mean gradient step over this many samples opts.plot = 1; % enable plotting nn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally) [er, bad] = nntest(nn, test_x, test_y); assert(er < 0.1, 'Too big error'); ``` [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值