Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
c9f10e2b
X
X2Paddle
项目概览
PaddlePaddle
/
X2Paddle
大约 1 年 前同步成功
通知
328
Star
698
Fork
167
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
26
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
X2Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
26
Issue
26
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c9f10e2b
编写于
7月 02, 2019
作者:
S
SunAhong1993
提交者:
GitHub
7月 02, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #33 from SunAhong1993/master
fix the flatten and detection
上级
458cb584
2c41c5ce
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
6 addition
and
9 deletion
+6
-9
caffe2fluid/kaffe/custom_layers/detection_out.py
caffe2fluid/kaffe/custom_layers/detection_out.py
+2
-2
caffe2fluid/kaffe/custom_layers/flatten.py
caffe2fluid/kaffe/custom_layers/flatten.py
+4
-3
caffe2fluid/kaffe/custom_layers/reshape.py
caffe2fluid/kaffe/custom_layers/reshape.py
+0
-4
未找到文件。
caffe2fluid/kaffe/custom_layers/detection_out.py
浏览文件 @
c9f10e2b
...
...
@@ -49,13 +49,13 @@ def detectionoutput_layer(inputs,
pbv
=
fluid
.
layers
.
reshape
(
x
=
pbv
,
shape
=
[
-
1
,
4
])
mbox_loc
=
inputs
[
0
]
mbox_loc
=
fluid
.
layers
.
reshape
(
x
=
mbox_loc
,
shape
=
[
-
1
,
mbox_conf_flatten
.
shape
[
1
],
4
])
x
=
mbox_loc
,
shape
=
[
0
,
mbox_conf_flatten
.
shape
[
1
],
4
])
default
=
{
"nms_threshold"
:
0.3
,
"top_k"
:
10
,
"eta"
:
1.0
}
fields
=
[
'eta'
,
'top_k'
,
'nms_threshold'
]
for
f
in
default
.
keys
():
if
not
nms_param
.
has_key
(
f
)
:
if
f
not
in
nms_param
:
nms_param
[
f
]
=
default
[
f
]
nmsed_outs
=
fluid
.
layers
.
detection_output
(
...
...
caffe2fluid/kaffe/custom_layers/flatten.py
浏览文件 @
c9f10e2b
...
...
@@ -2,7 +2,7 @@
more info can be found here: http://caffe.berkeleyvision.org/tutorial/layers/flatten.html
"""
from
.register
import
register
from
functools
import
reduce
def
flatten_shape
(
input_shape
,
axis
=
1
,
end_axis
=-
1
):
""" calculate the output shape of this layer using input shape
...
...
@@ -29,6 +29,8 @@ def flatten_shape(input_shape, axis=1, end_axis=-1):
%
(
start_axis
,
end_axis
)
output_shape
=
input_shape
[
0
:
start_axis
]
flat_sz
=
reduce
(
lambda
a
,
b
:
a
*
b
,
input_shape
[
start_axis
:
end_axis
])
if
flat_sz
<
0
:
flat_sz
=
-
1
output_shape
+=
[
flat_sz
]
output_shape
+=
input_shape
[
end_axis
:
-
1
]
...
...
@@ -52,9 +54,8 @@ def flatten_layer(input, name, axis=1, end_axis=-1):
input_shape
=
list
(
input
.
shape
)
if
input_shape
[
0
]
==
-
1
:
input_shape
[
0
]
=
1
input_shape
[
0
]
=
0
output_shape
=
flatten_shape
(
input_shape
,
axis
=
axis
,
end_axis
=
end_axis
)
output_shape
[
0
]
=
-
1
else
:
output_shape
=
flatten_shape
(
input_shape
,
axis
=
axis
,
end_axis
=
end_axis
)
...
...
caffe2fluid/kaffe/custom_layers/reshape.py
浏览文件 @
c9f10e2b
...
...
@@ -79,11 +79,7 @@ def reshape_layer(input, name, shape, axis=0, num_axes=-1):
output (variable): output variable for this layer
"""
fluid
=
import_fluid
()
input_shape
=
list
(
input
.
shape
)
print
(
input_shape
)
print
(
shape
)
if
input_shape
[
0
]
==
-
1
:
input_shape
[
0
]
=
0
output_shape
=
reshape_shape
(
input_shape
,
shape
,
axis
,
num_axes
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录