Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
d7d1ae5a
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d7d1ae5a
编写于
6月 02, 2017
作者:
W
wwhu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor revision
上级
88481641
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
5 addition
and
52 deletion
+5
-52
image_classification/README.md
image_classification/README.md
+5
-0
image_classification/googlenet.py
image_classification/googlenet.py
+0
-50
image_classification/resnet.py
image_classification/resnet.py
+0
-2
未找到文件。
image_classification/README.md
浏览文件 @
d7d1ae5a
...
@@ -123,6 +123,11 @@ optimizer = paddle.optimizer.Momentum(
...
@@ -123,6 +123,11 @@ optimizer = paddle.optimizer.Momentum(
learning_rate_schedule
=
"discexp"
,
)
learning_rate_schedule
=
"discexp"
,
)
```
```
通过
`learning_rate_decay_a`
(简写$a$) 、
`learning_rate_decay_b`
(简写$b$) 和
`learning_rate_schedule`
指定学习率调整策略,这里采用离散指数的方式调节学习率,计算公式如下, $n$ 代表已经处理过的累计总样本数,$lr_{0}$ 即为参数里设置的
`learning_rate`
。
$$ lr = lr_{0}
*
a^ {
\l
floor
\f
rac{n}{ b}
\r
floor} $$
### 定义数据读取方法和事件处理程序
### 定义数据读取方法和事件处理程序
读取数据时需要分别指定训练集和验证集的图像列表文件,这里假设这两个文件分别为
`train.list`
和
`val.list`
。
读取数据时需要分别指定训练集和验证集的图像列表文件,这里假设这两个文件分别为
`train.list`
和
`val.list`
。
...
...
image_classification/googlenet.py
浏览文件 @
d7d1ae5a
...
@@ -3,56 +3,6 @@ import paddle.v2 as paddle
...
@@ -3,56 +3,6 @@ import paddle.v2 as paddle
__all__
=
[
'googlenet'
]
__all__
=
[
'googlenet'
]
def
inception
(
name
,
input
,
channels
,
filter1
,
filter3R
,
filter3
,
filter5R
,
filter5
,
proj
):
cov1
=
paddle
.
layer
.
conv_projection
(
input
=
input
,
filter_size
=
1
,
num_channels
=
channels
,
num_filters
=
filter1
,
stride
=
1
,
padding
=
0
)
cov3r
=
paddle
.
layer
.
img_conv
(
name
=
name
+
'_3r'
,
input
=
input
,
filter_size
=
1
,
num_channels
=
channels
,
num_filters
=
filter3R
,
stride
=
1
,
padding
=
0
)
cov3
=
paddle
.
layer
.
conv_projection
(
input
=
cov3r
,
filter_size
=
3
,
num_filters
=
filter3
,
stride
=
1
,
padding
=
1
)
cov5r
=
paddle
.
layer
.
img_conv
(
name
=
name
+
'_5r'
,
input
=
input
,
filter_size
=
1
,
num_channels
=
channels
,
num_filters
=
filter5R
,
stride
=
1
,
padding
=
0
)
cov5
=
paddle
.
layer
.
conv_projection
(
input
=
cov5r
,
filter_size
=
5
,
num_filters
=
filter5
,
stride
=
1
,
padding
=
2
)
pool1
=
paddle
.
layer
.
img_pool
(
name
=
name
+
'_max'
,
input
=
input
,
pool_size
=
3
,
num_channels
=
channels
,
stride
=
1
,
padding
=
1
)
covprj
=
paddle
.
layer
.
conv_projection
(
input
=
pool1
,
filter_size
=
1
,
num_filters
=
proj
,
stride
=
1
,
padding
=
0
)
cat
=
paddle
.
layer
.
concat
(
name
=
name
,
input
=
[
cov1
,
cov3
,
cov5
,
covprj
],
bias_attr
=
True
,
act
=
paddle
.
activation
.
Relu
())
return
cat
def
inception2
(
name
,
input
,
channels
,
filter1
,
filter3R
,
filter3
,
filter5R
,
def
inception2
(
name
,
input
,
channels
,
filter1
,
filter3R
,
filter3
,
filter5R
,
filter5
,
proj
):
filter5
,
proj
):
cov1
=
paddle
.
layer
.
img_conv
(
cov1
=
paddle
.
layer
.
img_conv
(
...
...
image_classification/resnet.py
浏览文件 @
d7d1ae5a
...
@@ -31,7 +31,6 @@ def shortcut(input, n_out, stride, b_projection):
...
@@ -31,7 +31,6 @@ def shortcut(input, n_out, stride, b_projection):
def
basicblock
(
input
,
ch_out
,
stride
,
b_projection
):
def
basicblock
(
input
,
ch_out
,
stride
,
b_projection
):
# TODO: bug fix for ch_in = input.num_filters
conv1
=
conv_bn_layer
(
input
,
ch_out
,
3
,
stride
,
1
)
conv1
=
conv_bn_layer
(
input
,
ch_out
,
3
,
stride
,
1
)
conv2
=
conv_bn_layer
(
conv1
,
ch_out
,
3
,
1
,
1
,
paddle
.
activation
.
Linear
())
conv2
=
conv_bn_layer
(
conv1
,
ch_out
,
3
,
1
,
1
,
paddle
.
activation
.
Linear
())
short
=
shortcut
(
input
,
ch_out
,
stride
,
b_projection
)
short
=
shortcut
(
input
,
ch_out
,
stride
,
b_projection
)
...
@@ -40,7 +39,6 @@ def basicblock(input, ch_out, stride, b_projection):
...
@@ -40,7 +39,6 @@ def basicblock(input, ch_out, stride, b_projection):
def
bottleneck
(
input
,
ch_out
,
stride
,
b_projection
):
def
bottleneck
(
input
,
ch_out
,
stride
,
b_projection
):
# TODO: bug fix for ch_in = input.num_filters
conv1
=
conv_bn_layer
(
input
,
ch_out
,
1
,
stride
,
0
)
conv1
=
conv_bn_layer
(
input
,
ch_out
,
1
,
stride
,
0
)
conv2
=
conv_bn_layer
(
conv1
,
ch_out
,
3
,
1
,
1
)
conv2
=
conv_bn_layer
(
conv1
,
ch_out
,
3
,
1
,
1
)
conv3
=
conv_bn_layer
(
conv2
,
ch_out
*
4
,
1
,
1
,
0
,
conv3
=
conv_bn_layer
(
conv2
,
ch_out
*
4
,
1
,
1
,
0
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录