Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
f629ce07
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看板
未验证
提交
f629ce07
编写于
6月 15, 2018
作者:
Q
qingqing01
提交者:
GitHub
6月 15, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change the transposed conv2d initializer. (#984)
* Change the transposed conv2d initializer. * small fix.
上级
843a00f7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
11 deletion
+31
-11
fluid/face_detection/pyramidbox.py
fluid/face_detection/pyramidbox.py
+31
-11
未找到文件。
fluid/face_detection/pyramidbox.py
浏览文件 @
f629ce07
...
...
@@ -4,6 +4,7 @@ import paddle.fluid as fluid
from
paddle.fluid.param_attr
import
ParamAttr
from
paddle.fluid.initializer
import
Xavier
from
paddle.fluid.initializer
import
Constant
from
paddle.fluid.initializer
import
Bilinear
from
paddle.fluid.regularizer
import
L2Decay
...
...
@@ -48,14 +49,19 @@ class PyramidBox(object):
def
__init__
(
self
,
data_shape
,
num_classes
,
use_transposed_conv2d
=
True
,
is_infer
=
False
,
sub_network
=
False
):
"""
TODO(qingqing): add comments.
"""
self
.
data_shape
=
data_shape
self
.
min_sizes
=
[
16.
,
32.
,
64.
,
128.
,
256.
,
512.
]
self
.
steps
=
[
4.
,
8.
,
16.
,
32.
,
64.
,
128.
]
self
.
num_classes
=
num_classes
self
.
use_transposed_conv2d
=
use_transposed_conv2d
self
.
is_infer
=
is_infer
self
.
sub_network
=
sub_network
self
.
num_classes
=
num_classes
# the base network is VGG with atrous layers
self
.
_input
()
...
...
@@ -120,20 +126,30 @@ class PyramidBox(object):
b_attr
=
ParamAttr
(
learning_rate
=
2.
,
regularizer
=
L2Decay
(
0.
))
conv1
=
fluid
.
layers
.
conv2d
(
up_from
,
ch
,
1
,
act
=
'relu'
,
bias_attr
=
b_attr
)
conv_trans
=
fluid
.
layers
.
conv2d_transpose
(
conv1
,
ch
,
output_size
=
None
,
filter_size
=
4
,
padding
=
1
,
stride
=
2
,
groups
=
ch
,
bias_attr
=
False
)
if
self
.
use_transposed_conv2d
:
w_attr
=
ParamAttr
(
learning_rate
=
0.
,
regularizer
=
L2Decay
(
0.
),
initializer
=
Bilinear
())
upsampling
=
fluid
.
layers
.
conv2d_transpose
(
conv1
,
ch
,
output_size
=
None
,
filter_size
=
4
,
padding
=
1
,
stride
=
2
,
groups
=
ch
,
param_attr
=
w_attr
,
bias_attr
=
False
)
else
:
upsampling
=
fluid
.
layers
.
resize_bilinear
(
conv1
,
out_shape
=
up_to
.
shape
[
2
:])
b_attr
=
ParamAttr
(
learning_rate
=
2.
,
regularizer
=
L2Decay
(
0.
))
conv2
=
fluid
.
layers
.
conv2d
(
up_to
,
ch
,
1
,
act
=
'relu'
,
bias_attr
=
b_attr
)
# eltwise mul
conv_fuse
=
conv_trans
*
conv2
conv_fuse
=
upsampling
*
conv2
return
conv_fuse
self
.
lfpn2_on_conv5
=
fpn
(
self
.
conv6
,
self
.
conv5
)
...
...
@@ -245,6 +261,8 @@ class PyramidBox(object):
min_sizes
=
[
self
.
min_sizes
[
i
]],
steps
=
[
self
.
steps
[
i
]]
*
2
,
aspect_ratios
=
[
1.
],
clip
=
False
,
flip
=
True
,
offset
=
0.5
)
box
=
fluid
.
layers
.
reshape
(
box
,
shape
=
[
-
1
,
4
])
var
=
fluid
.
layers
.
reshape
(
var
,
shape
=
[
-
1
,
4
])
...
...
@@ -322,6 +340,8 @@ class PyramidBox(object):
min_sizes
=
[
min_sizes
[
i
]],
steps
=
[
steps
[
i
]]
*
2
,
aspect_ratios
=
[
1.
],
clip
=
False
,
flip
=
True
,
offset
=
0.5
)
box
=
fluid
.
layers
.
reshape
(
box
,
shape
=
[
-
1
,
4
])
var
=
fluid
.
layers
.
reshape
(
var
,
shape
=
[
-
1
,
4
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录