Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
book
提交
16c1bd14
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
16c1bd14
编写于
2月 28, 2017
作者:
Y
Yuanpeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Translate Model definitions.
上级
471a93d2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
55 addition
and
0 deletion
+55
-0
recognize_digits/README.en.md
recognize_digits/README.en.md
+55
-0
未找到文件。
recognize_digits/README.en.md
浏览文件 @
16c1bd14
...
@@ -463,6 +463,15 @@ def softmax_regression(img):
...
@@ -463,6 +463,15 @@ def softmax_regression(img):
return
predict
return
predict
```
```
#### Softmax Regression
One simple fully connected layer with softmax activation function outputs classification result.
```
python
def
softmax_regression
(
img
):
predict
=
fc_layer
(
input
=
img
,
size
=
10
,
act
=
SoftmaxActivation
())
return
predict
```
#### 多层感知器
#### 多层感知器
下面代码实现了一个含有两个隐藏层(即全连接层)的多层感知器。其中两个隐藏层的激活函数均采用ReLU,输出层的激活函数用Softmax。
下面代码实现了一个含有两个隐藏层(即全连接层)的多层感知器。其中两个隐藏层的激活函数均采用ReLU,输出层的激活函数用Softmax。
...
@@ -478,6 +487,21 @@ def multilayer_perceptron(img):
...
@@ -478,6 +487,21 @@ def multilayer_perceptron(img):
return
predict
return
predict
```
```
#### MultiLayer Perceptron
One simple fully connected layer with softmax activation function outputs classification result.
```
python
def
multilayer_perceptron
(
img
):
# First fully connected layer with ReLU
hidden1
=
fc_layer
(
input
=
img
,
size
=
128
,
act
=
ReluActivation
())
# Second fully connected layer with ReLU
hidden2
=
fc_layer
(
input
=
hidden1
,
size
=
64
,
act
=
ReluActivation
())
# Output layer as fully connected layer and softmax activation. The size must be 10.
predict
=
fc_layer
(
input
=
hidden2
,
size
=
10
,
act
=
SoftmaxActivation
())
return
predict
```
#### 卷积神经网络LeNet-5
#### 卷积神经网络LeNet-5
以下为LeNet-5的网络结构:输入的二维图像,首先经过两次卷积层到池化层,再经过全连接层,最后使用以softmax为激活函数的全连接层作为输出层。
以下为LeNet-5的网络结构:输入的二维图像,首先经过两次卷积层到池化层,再经过全连接层,最后使用以softmax为激活函数的全连接层作为输出层。
...
@@ -509,6 +533,37 @@ def convolutional_neural_network(img):
...
@@ -509,6 +533,37 @@ def convolutional_neural_network(img):
return
predict
return
predict
```
```
#### Convolutional Neural Network LeNet-5
The following is the LeNet-5 network architecture. 2D input image is first fed into two sets of convolutional layer and pooling layer, and it is fed to fully connected layer, and another fully connected layer with softmax activation.
```
python
def
convolutional_neural_network
(
img
):
# First convolutional layer - pooling layer
conv_pool_1
=
simple_img_conv_pool
(
input
=
img
,
filter_size
=
5
,
num_filters
=
20
,
num_channel
=
1
,
pool_size
=
2
,
pool_stride
=
2
,
act
=
TanhActivation
())
# Second convolutional layer - pooling layer
conv_pool_2
=
simple_img_conv_pool
(
input
=
conv_pool_1
,
filter_size
=
5
,
num_filters
=
50
,
num_channel
=
20
,
pool_size
=
2
,
pool_stride
=
2
,
act
=
TanhActivation
())
# Fully connected layer
fc1
=
fc_layer
(
input
=
conv_pool_2
,
size
=
128
,
act
=
TanhActivation
())
# Output layer as fully connected layer and softmax activation. The size must be 10.
predict
=
fc_layer
(
input
=
fc1
,
size
=
10
,
act
=
SoftmaxActivation
())
return
predict
```
## 训练模型
## 训练模型
### 训练命令及日志
### 训练命令及日志
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录