Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
ca2e96f2
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ca2e96f2
编写于
1月 23, 2018
作者:
W
wanghaox
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update code
上级
534cf741
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
16 deletion
+18
-16
paddle/operators/prior_box_op.cc
paddle/operators/prior_box_op.cc
+6
-8
paddle/operators/prior_box_op.h
paddle/operators/prior_box_op.h
+12
-8
未找到文件。
paddle/operators/prior_box_op.cc
浏览文件 @
ca2e96f2
...
...
@@ -98,16 +98,14 @@ class PriorBoxOpMaker : public framework::OpProtoAndCheckerMaker {
"the input image data of PriorBoxOp, The layout is NCHW."
);
AddOutput
(
"Boxes"
,
"(Tensor, default Tensor<float>), the output prior boxes of "
"PriorBoxOp. The layout is [layer_height, layer_width, "
"num_priors, 4]. layer_height is the height of input, "
"layer_width is the width of input, num_priors is the box "
"count of each position."
);
"PriorBoxOp. The layout is [H, W, num_priors, 4]. "
"H is the height of input, W is the width of input, num_priors "
"is the box count of each position."
);
AddOutput
(
"Variances"
,
"(Tensor, default Tensor<float>), the expanded variances of "
"PriorBoxOp. The layout is [layer_height, layer_width, "
"num_priors, 4]. layer_height is the height of input, "
"layer_width is the width of input, num_priors is the box "
"count of each position."
);
"PriorBoxOp. The layout is [H, W, num_priors, 4]. "
"H is the height of input, W is the width of input, num_priors "
"is the box count of each position."
);
AddAttr
<
std
::
vector
<
int
>>
(
"min_sizes"
,
"(vector<int>) "
,
"List of min sizes of generated prior boxes."
);
AddAttr
<
std
::
vector
<
int
>>
(
"max_sizes"
,
"(vector<int>) "
,
...
...
paddle/operators/prior_box_op.h
浏览文件 @
ca2e96f2
...
...
@@ -77,13 +77,13 @@ class PriorBoxOpKernel : public framework::OpKernel<T> {
auto
img_width
=
image
->
dims
()[
3
];
auto
img_height
=
image
->
dims
()[
2
];
auto
layer
_width
=
input
->
dims
()[
3
];
auto
layer
_height
=
input
->
dims
()[
2
];
auto
feature
_width
=
input
->
dims
()[
3
];
auto
feature
_height
=
input
->
dims
()[
2
];
T
step_width
,
step_height
;
if
(
step_w
==
0
||
step_h
==
0
)
{
step_width
=
static_cast
<
T
>
(
img_width
)
/
layer
_width
;
step_height
=
static_cast
<
T
>
(
img_height
)
/
layer
_height
;
step_width
=
static_cast
<
T
>
(
img_width
)
/
feature
_width
;
step_height
=
static_cast
<
T
>
(
img_height
)
/
feature
_height
;
}
else
{
step_width
=
step_w
;
step_height
=
step_h
;
...
...
@@ -98,8 +98,8 @@ class PriorBoxOpKernel : public framework::OpKernel<T> {
vars
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
auto
e_boxes
=
framework
::
EigenTensor
<
T
,
4
>::
From
(
*
boxes
);
for
(
int
h
=
0
;
h
<
layer
_height
;
++
h
)
{
for
(
int
w
=
0
;
w
<
layer
_width
;
++
w
)
{
for
(
int
h
=
0
;
h
<
feature
_height
;
++
h
)
{
for
(
int
w
=
0
;
w
<
feature
_width
;
++
w
)
{
T
center_x
=
(
w
+
offset
)
*
step_width
;
T
center_y
=
(
h
+
offset
)
*
step_height
;
T
box_width
,
box_height
;
...
...
@@ -164,12 +164,16 @@ class PriorBoxOpKernel : public framework::OpKernel<T> {
boxes
->
data
<
T
>
(),
clip_func
);
}
Eigen
::
Tensor
<
T
,
2
,
Eigen
::
RowMajor
>
var_et
(
1
,
variances
.
size
());
framework
::
Tensor
var_t
;
var_t
.
mutable_data
<
T
>
(
framework
::
make_ddim
({
1
,
static_cast
<
int
>
(
variances
.
size
())}),
ctx
.
GetPlace
());
auto
var_et
=
framework
::
EigenTensor
<
T
,
2
>::
From
(
var_t
);
for
(
size_t
i
=
0
;
i
<
variances
.
size
();
++
i
)
{
var_et
(
0
,
i
)
=
variances
[
i
];
}
int
box_num
=
layer_height
*
layer
_width
*
num_priors
;
int
box_num
=
feature_height
*
feature
_width
*
num_priors
;
auto
var_dim
=
vars
->
dims
();
vars
->
Resize
({
box_num
,
static_cast
<
int
>
(
variances
.
size
())});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录