提交 d7d1ae5a 编写于 作者: W wwhu

minor revision

上级 88481641
...@@ -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^ {\lfloor \frac{n}{ b}\rfloor} $$
### 定义数据读取方法和事件处理程序 ### 定义数据读取方法和事件处理程序
读取数据时需要分别指定训练集和验证集的图像列表文件,这里假设这两个文件分别为`train.list``val.list` 读取数据时需要分别指定训练集和验证集的图像列表文件,这里假设这两个文件分别为`train.list``val.list`
......
...@@ -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(
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册