Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
book
提交
8bfb2bc0
B
book
项目概览
PaddlePaddle
/
book
通知
16
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
40
列表
看板
标记
里程碑
合并请求
37
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
B
book
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
40
Issue
40
列表
看板
标记
里程碑
合并请求
37
合并请求
37
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8bfb2bc0
编写于
4月 11, 2017
作者:
L
liaogang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update LeNet-5
上级
108c0aac
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
31 addition
and
51 deletion
+31
-51
02.recognize_digits/README.en.md
02.recognize_digits/README.en.md
+6
-10
02.recognize_digits/README.md
02.recognize_digits/README.md
+6
-10
02.recognize_digits/index.en.html
02.recognize_digits/index.en.html
+6
-10
02.recognize_digits/index.html
02.recognize_digits/index.html
+6
-10
02.recognize_digits/train.py
02.recognize_digits/train.py
+7
-11
未找到文件。
02.recognize_digits/README.en.md
浏览文件 @
8bfb2bc0
...
...
@@ -172,7 +172,7 @@ def convolutional_neural_network(img):
num_channel
=
1
,
pool_size
=
2
,
pool_stride
=
2
,
act
=
paddle
.
activation
.
Tanh
())
act
=
paddle
.
activation
.
Relu
())
conv_pool_2
=
paddle
.
networks
.
simple_img_conv_pool
(
input
=
conv_pool_1
,
...
...
@@ -181,13 +181,9 @@ def convolutional_neural_network(img):
num_channel
=
20
,
pool_size
=
2
,
pool_stride
=
2
,
act
=
paddle
.
activation
.
Tanh
())
act
=
paddle
.
activation
.
Relu
())
fc1
=
paddle
.
layer
.
fc
(
input
=
conv_pool_2
,
size
=
128
,
act
=
paddle
.
activation
.
Tanh
())
predict
=
paddle
.
layer
.
fc
(
input
=
fc1
,
predict
=
paddle
.
layer
.
fc
(
input
=
conv_pool_2
,
size
=
10
,
act
=
paddle
.
activation
.
Softmax
())
return
predict
...
...
@@ -203,9 +199,9 @@ images = paddle.layer.data(
label
=
paddle
.
layer
.
data
(
name
=
'label'
,
type
=
paddle
.
data_type
.
integer_value
(
10
))
predict
=
softmax_regression
(
images
)
#predict = multilayer_perceptron(images) # uncomment for MLP
#
predict = convolutional_neural_network(images) # uncomment for LeNet5
#
predict = softmax_regression(images)
#
predict = multilayer_perceptron(images) # uncomment for MLP
predict
=
convolutional_neural_network
(
images
)
# uncomment for LeNet5
cost
=
paddle
.
layer
.
classification_cost
(
input
=
predict
,
label
=
label
)
```
...
...
02.recognize_digits/README.md
浏览文件 @
8bfb2bc0
...
...
@@ -173,7 +173,7 @@ def convolutional_neural_network(img):
num_channel
=
1
,
pool_size
=
2
,
pool_stride
=
2
,
act
=
paddle
.
activation
.
Tanh
())
act
=
paddle
.
activation
.
Relu
())
# 第二个卷积-池化层
conv_pool_2
=
paddle
.
networks
.
simple_img_conv_pool
(
input
=
conv_pool_1
,
...
...
@@ -182,13 +182,9 @@ def convolutional_neural_network(img):
num_channel
=
20
,
pool_size
=
2
,
pool_stride
=
2
,
act
=
paddle
.
activation
.
Tanh
())
# 全连接层
fc1
=
paddle
.
layer
.
fc
(
input
=
conv_pool_2
,
size
=
128
,
act
=
paddle
.
activation
.
Tanh
())
act
=
paddle
.
activation
.
Relu
())
# 以softmax为激活函数的全连接输出层,输出层的大小必须为数字的个数10
predict
=
paddle
.
layer
.
fc
(
input
=
fc1
,
predict
=
paddle
.
layer
.
fc
(
input
=
conv_pool_2
,
size
=
10
,
act
=
paddle
.
activation
.
Softmax
())
return
predict
...
...
@@ -205,9 +201,9 @@ images = paddle.layer.data(
label
=
paddle
.
layer
.
data
(
name
=
'label'
,
type
=
paddle
.
data_type
.
integer_value
(
10
))
predict
=
softmax_regression
(
images
)
# Softmax回归
#predict = multilayer_perceptron(images) #多层感知器
#
predict = convolutional_neural_network(images) #LeNet5卷积神经网络
#
predict = softmax_regression(images) # Softmax回归
#
predict = multilayer_perceptron(images) #多层感知器
predict
=
convolutional_neural_network
(
images
)
#LeNet5卷积神经网络
cost
=
paddle
.
layer
.
classification_cost
(
input
=
predict
,
label
=
label
)
```
...
...
02.recognize_digits/index.en.html
浏览文件 @
8bfb2bc0
...
...
@@ -214,7 +214,7 @@ def convolutional_neural_network(img):
num_channel=1,
pool_size=2,
pool_stride=2,
act=paddle.activation.
Tanh
())
act=paddle.activation.
Relu
())
conv_pool_2 = paddle.networks.simple_img_conv_pool(
input=conv_pool_1,
...
...
@@ -223,13 +223,9 @@ def convolutional_neural_network(img):
num_channel=20,
pool_size=2,
pool_stride=2,
act=paddle.activation.
Tanh
())
act=paddle.activation.
Relu
())
fc1 = paddle.layer.fc(input=conv_pool_2,
size=128,
act=paddle.activation.Tanh())
predict = paddle.layer.fc(input=fc1,
predict = paddle.layer.fc(input=conv_pool_2,
size=10,
act=paddle.activation.Softmax())
return predict
...
...
@@ -245,9 +241,9 @@ images = paddle.layer.data(
label = paddle.layer.data(
name='label', type=paddle.data_type.integer_value(10))
predict = softmax_regression(images)
#predict = multilayer_perceptron(images) # uncomment for MLP
#
predict = convolutional_neural_network(images) # uncomment for LeNet5
#
predict = softmax_regression(images)
#
predict = multilayer_perceptron(images) # uncomment for MLP
predict = convolutional_neural_network(images) # uncomment for LeNet5
cost = paddle.layer.classification_cost(input=predict, label=label)
```
...
...
02.recognize_digits/index.html
浏览文件 @
8bfb2bc0
...
...
@@ -215,7 +215,7 @@ def convolutional_neural_network(img):
num_channel=1,
pool_size=2,
pool_stride=2,
act=paddle.activation.
Tanh
())
act=paddle.activation.
Relu
())
# 第二个卷积-池化层
conv_pool_2 = paddle.networks.simple_img_conv_pool(
input=conv_pool_1,
...
...
@@ -224,13 +224,9 @@ def convolutional_neural_network(img):
num_channel=20,
pool_size=2,
pool_stride=2,
act=paddle.activation.Tanh())
# 全连接层
fc1 = paddle.layer.fc(input=conv_pool_2,
size=128,
act=paddle.activation.Tanh())
act=paddle.activation.Relu())
# 以softmax为激活函数的全连接输出层,输出层的大小必须为数字的个数10
predict = paddle.layer.fc(input=
fc1
,
predict = paddle.layer.fc(input=
conv_pool_2
,
size=10,
act=paddle.activation.Softmax())
return predict
...
...
@@ -247,9 +243,9 @@ images = paddle.layer.data(
label = paddle.layer.data(
name='label', type=paddle.data_type.integer_value(10))
predict = softmax_regression(images) # Softmax回归
#predict = multilayer_perceptron(images) #多层感知器
#
predict = convolutional_neural_network(images) #LeNet5卷积神经网络
#
predict = softmax_regression(images) # Softmax回归
#
predict = multilayer_perceptron(images) #多层感知器
predict = convolutional_neural_network(images) #LeNet5卷积神经网络
cost = paddle.layer.classification_cost(input=predict, label=label)
```
...
...
02.recognize_digits/train.py
浏览文件 @
8bfb2bc0
...
...
@@ -29,7 +29,7 @@ def convolutional_neural_network(img):
num_channel
=
1
,
pool_size
=
2
,
pool_stride
=
2
,
act
=
paddle
.
activation
.
Tanh
())
act
=
paddle
.
activation
.
Relu
())
# second conv layer
conv_pool_2
=
paddle
.
networks
.
simple_img_conv_pool
(
input
=
conv_pool_1
,
...
...
@@ -38,14 +38,10 @@ def convolutional_neural_network(img):
num_channel
=
20
,
pool_size
=
2
,
pool_stride
=
2
,
act
=
paddle
.
activation
.
Tanh
())
# The first fully-connected layer
fc1
=
paddle
.
layer
.
fc
(
input
=
conv_pool_2
,
size
=
128
,
act
=
paddle
.
activation
.
Tanh
())
# The softmax layer, note that the hidden size should be 10,
# which is the number of unique digits
act
=
paddle
.
activation
.
Relu
())
# fully-connected layer
predict
=
paddle
.
layer
.
fc
(
input
=
fc1
,
size
=
10
,
act
=
paddle
.
activation
.
Softmax
())
input
=
conv_pool_2
,
size
=
10
,
act
=
paddle
.
activation
.
Softmax
())
return
predict
...
...
@@ -58,9 +54,9 @@ label = paddle.layer.data(name='label', type=paddle.data_type.integer_value(10))
# Here we can build the prediction network in different ways. Please
# choose one by uncomment corresponding line.
predict
=
softmax_regression
(
images
)
#predict = multilayer_perceptron(images)
#
predict = convolutional_neural_network(images)
#
predict = softmax_regression(images)
#
predict = multilayer_perceptron(images)
predict
=
convolutional_neural_network
(
images
)
cost
=
paddle
.
layer
.
classification_cost
(
input
=
predict
,
label
=
label
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录