Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
7497a7d2
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7497a7d2
编写于
9月 17, 2019
作者:
J
juncaipeng
提交者:
GitHub
9月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix yolo_box bug (#2034)
* fix yolo_box bug, test=develop * fix test bug for yolo_box, test=develop
上级
b386cde2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
13 deletion
+28
-13
lite/backends/arm/math/yolo_box.cc
lite/backends/arm/math/yolo_box.cc
+3
-3
lite/operators/yolo_box_op.cc
lite/operators/yolo_box_op.cc
+13
-0
lite/tests/kernels/yolo_box_compute_test.cc
lite/tests/kernels/yolo_box_compute_test.cc
+12
-10
未找到文件。
lite/backends/arm/math/yolo_box.cc
浏览文件 @
7497a7d2
...
...
@@ -108,7 +108,7 @@ void yolobox(lite::Tensor* X,
auto
anchors_data
=
anchors
.
data
();
const
float
*
X_data
=
X
->
data
<
float
>
();
float
*
ImgSize_data
=
ImgSize
->
mutable_data
<
floa
t
>
();
int
*
ImgSize_data
=
ImgSize
->
mutable_data
<
in
t
>
();
float
*
Boxes_data
=
Boxes
->
mutable_data
<
float
>
();
...
...
@@ -116,8 +116,8 @@ void yolobox(lite::Tensor* X,
float
box
[
4
];
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
int
img_height
=
static_cast
<
int
>
(
ImgSize_data
[
2
*
i
])
;
int
img_width
=
static_cast
<
int
>
(
ImgSize_data
[
2
*
i
+
1
])
;
int
img_height
=
ImgSize_data
[
2
*
i
]
;
int
img_width
=
ImgSize_data
[
2
*
i
+
1
]
;
for
(
int
j
=
0
;
j
<
an_num
;
j
++
)
{
for
(
int
k
=
0
;
k
<
h
;
k
++
)
{
...
...
lite/operators/yolo_box_op.cc
浏览文件 @
7497a7d2
...
...
@@ -31,6 +31,19 @@ bool YoloBoxOp::CheckShape() const {
CHECK_OR_FALSE
(
ImgSize
);
CHECK_OR_FALSE
(
Boxes
);
CHECK_OR_FALSE
(
Scores
);
auto
dim_x
=
X
->
dims
();
auto
dim_imgsize
=
ImgSize
->
dims
();
std
::
vector
<
int
>
anchors
=
param_
.
anchors
;
int
anchor_num
=
anchors
.
size
()
/
2
;
auto
class_num
=
param_
.
class_num
;
CHECK_OR_FALSE
(
dim_x
.
size
()
==
4
);
CHECK_OR_FALSE
(
dim_x
[
1
]
==
anchor_num
*
(
5
+
class_num
));
CHECK_OR_FALSE
(
dim_imgsize
[
0
]
==
dim_x
[
0
]);
CHECK_OR_FALSE
(
dim_imgsize
[
1
]
==
2
);
CHECK_OR_FALSE
(
anchors
.
size
()
>
0
&&
anchors
.
size
()
%
2
==
0
);
CHECK_OR_FALSE
(
class_num
>
0
);
return
true
;
}
bool
YoloBoxOp
::
InferShape
()
const
{
...
...
lite/tests/kernels/yolo_box_compute_test.cc
浏览文件 @
7497a7d2
...
...
@@ -101,7 +101,7 @@ class YoloBoxComputeTester : public arena::TestCase {
float
conf_thresh_
=
0.
f
;
int
downsample_ratio_
=
0
;
DDim
_dims0_
{{
1
,
2
,
2
,
1
}};
DDim
_dims0_
{{
1
,
2
55
,
13
,
13
}};
DDim
_dims1_
{{
1
,
2
}};
public:
...
...
@@ -115,7 +115,10 @@ class YoloBoxComputeTester : public arena::TestCase {
anchors_
(
anchors
),
class_num_
(
class_num
),
conf_thresh_
(
conf_thresh
),
downsample_ratio_
(
downsample_ratio
)
{}
downsample_ratio_
(
downsample_ratio
)
{
int
anchor_num
=
anchors_
.
size
()
/
2
;
_dims0_
[
1
]
=
anchor_num
*
(
5
+
class_num
);
}
void
RunBaseline
(
Scope
*
scope
)
override
{
const
lite
::
Tensor
*
X
=
scope
->
FindTensor
(
input0_
);
...
...
@@ -149,14 +152,14 @@ class YoloBoxComputeTester : public arena::TestCase {
auto
anchors_data
=
anchors
.
data
();
const
float
*
in_data
=
in
->
data
<
float
>
();
const
float
*
imgsize_data
=
imgsize
->
data
<
floa
t
>
();
const
int
*
imgsize_data
=
imgsize
->
data
<
in
t
>
();
float
*
boxes_data
=
boxes
->
mutable_data
<
float
>
();
float
*
scores_data
=
scores
->
mutable_data
<
float
>
();
float
box
[
4
];
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
int
img_height
=
static_cast
<
int
>
(
imgsize_data
[
2
*
i
])
;
int
img_width
=
static_cast
<
int
>
(
imgsize_data
[
2
*
i
+
1
])
;
int
img_height
=
imgsize_data
[
2
*
i
]
;
int
img_width
=
imgsize_data
[
2
*
i
+
1
]
;
for
(
int
j
=
0
;
j
<
an_num
;
j
++
)
{
for
(
int
k
=
0
;
k
<
h
;
k
++
)
{
for
(
int
l
=
0
;
l
<
w
;
l
++
)
{
...
...
@@ -218,7 +221,7 @@ class YoloBoxComputeTester : public arena::TestCase {
}
std
::
vector
<
int
>
data1
(
_dims1_
.
production
());
for
(
int
i
=
0
;
i
<
_dims1_
.
production
();
i
++
)
{
data1
[
i
]
=
i
+
8
;
data1
[
i
]
=
60
8
;
}
SetCommonTensor
(
input0_
,
_dims0_
,
data0
.
data
());
SetCommonTensor
(
input1_
,
_dims1_
,
data1
.
data
());
...
...
@@ -227,10 +230,9 @@ class YoloBoxComputeTester : public arena::TestCase {
void
test_yolobox
(
Place
place
)
{
for
(
int
class_num
:
{
1
,
2
,
3
,
4
})
{
for
(
float
conf_thresh
:
{
0.5
,
0.2
,
0.7
})
{
for
(
int
downsample_ratio
:
{
1
,
2
,
3
})
{
std
::
vector
<
int
>
anchor
({
1
,
2
,
3
,
4
});
for
(
float
conf_thresh
:
{
0.01
,
0.2
,
0.7
})
{
for
(
int
downsample_ratio
:
{
16
,
32
})
{
std
::
vector
<
int
>
anchor
({
10
,
13
,
16
,
30
});
std
::
unique_ptr
<
arena
::
TestCase
>
tester
(
new
YoloBoxComputeTester
(
place
,
"def"
,
anchor
,
class_num
,
conf_thresh
,
downsample_ratio
));
arena
::
Arena
arena
(
std
::
move
(
tester
),
place
,
2e-5
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录