副标题[/!--empirenews.page--]
深度学习工具
深度学习的进步也严重依赖于软件基础架构的进展。 软件库如: Torch(2011), Theano(2012), DistBelief(2012), PyLearn2 (2013), Caffe(2013), MXNet (2015) 和 TensorFlow(2015) 都能支持重要的研究项目或商业产品。
如果说深度学习的话,我个人接触是在2015年,这个技术其实被雪藏了很久,在2012年又得到了完全的爆发,至今已经是AI界的主流,那今天就来说说最实际也是接触最多的一个环节,那就是框架,也可以说是工具。
大家所了解的工具不知道有哪些???
今天,我以我使用过的工具来和大家分享,希望你们可以找到自己喜欢的工具,与其一起去“ 炼丹 ”(不知道这个意思的,百度下)嘿嘿!

在我研究生入学以来,接触的深度学习工具一只手就可以数过来,有兴趣的小伙伴可以深入搜索,网上还是有很多不同说法。我接下来根基我自己的实际体验而大家说说深度学习工具这些事。 Matlab

Matlab

刚开始接触深度学习,第一个使用的工具就是:DeepLearnToolbox,一个用于深度学习的Matlab工具箱。 深度学习作为机器学习的一个新领域,它的重点是学习深层次的数据模型,其主要灵感来自于人脑表面的深度分层体系结构,深度学习理论的一个很好的概述是学习人工智能的深层架构。这个工具箱比较简单,当时我就做了一个手写数字和人脸分类(AR人脸数据库)。主要包括如下:
NN :前馈BP神经网络的库
CNN :卷积神经网络的库
DBN :深度置信网络的库
SAE :堆栈自动编码器的库
CAE :卷积自动编码器的库
Util :库中使用的效用函数
Data :数据存储
tests :用来验证工具箱正在工作的测试
案例如下
- rand('state',0)
-
- cnn.layers = {
-
- struct('type', 'i') %输入
-
- struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %卷积层
-
- struct('type', 's', 'scale', 2) %下采样层
-
- struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %卷积层
-
- struct('type', 's', 'scale', 2) %下采样层
-
- };
-
- cnn = cnnsetup(cnn, train_x, train_y); opts.alpha = 1;
-
- opts.batchsize = 50;
-
- opts.numepochs = 5;
-
- cnn = cnntrain(cnn, train_x, train_y, opts); save CNN_5 cnn;
-
- load CNN_5;
-
- [er, bad] = cnntest(cnn, test_x, test_y); figure; plot(cnn.rL);
-
- assert(er<0.12, 'Too big error');
运行界面比较单一:

PyTorch
这个Pytorch库的话,其实我没怎么用,就是随便试玩了下,个人感觉还是不要碰了,没啥意思,我接下来也就简单聊一下。 他是一个基于Python的科学计算包,目标用户有两类。一类是 为了使用GPU来替代numpy;另一类是一个深度学习援救平台:提供最大的灵活性和速度。

以深度学习来说,可以使用 torch.nn 包来构建神经网络。已知道autograd包,nn包依赖autograd包来定义模型并求导。一个nn.Module包含各个层和一个faward(input)方法,该方法返回output。
案例如下
- import torch from torch.autograd
-
- import Variable import torch.nn
-
- import torch.nn.functional as F
-
- class Net(nn.Module):
-
- def __init__(self):
-
- super(Net, self).__init__()
-
- # 1 input image channel, 6 output channels, 5*5 square convolution
-
- # kernel
-
- self.conv1 = nn.Conv2d(1, 6, 5)
-
- self.conv2 = nn.Conv2d(6, 16, 5)
-
- # an affine operation: y = Wx + b
-
- self.fc1 = nn.Linear(16 * 5 * 5, 120)
-
- self.fc2 = nn.Linear(120, 84)
-
- self.fc3 = nn.Linear(84, 10)
-
- def forward(self, x):
-
- # max pooling over a (2, 2) window
-
- x = F.max_pool2d(F.relu(self.conv1(x)), (2, 2))
-
- # If size is a square you can only specify a single number
-
- x = F.max_pool2d(F.relu(self.conv2(x)), 2)
-
- x = x.view(-1, self.num_flat_features(x))
-
- x = F.relu(self.fc1(x))
-
- x = F.relu(self.fc2(x))
-
- x = self.fc3(x)
-
- return x
-
- def num_flat_features(self, x):
-
- size = x.size()[1:]
-
- # all dimensions except the batch dimension
-
- num_features = 1
-
- for s in size:
-
- num_features *= s
-
- return num_features
-
- net = Net()
-
- print(net)
具体操作和细节过程,有兴趣的可以抽空去玩玩!
Caffe
(编辑:晋中站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|