Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
74aecd48
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看板
提交
74aecd48
编写于
7月 27, 2020
作者:
Y
yongqiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change priorbox. test=develop
上级
b6c88f70
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
17 deletion
+38
-17
lite/backends/arm/math/prior_box.cc
lite/backends/arm/math/prior_box.cc
+9
-9
lite/backends/arm/math/prior_box.h
lite/backends/arm/math/prior_box.h
+4
-4
lite/kernels/arm/prior_box_compute.cc
lite/kernels/arm/prior_box_compute.cc
+19
-3
lite/kernels/arm/prior_box_compute.h
lite/kernels/arm/prior_box_compute.h
+6
-1
未找到文件。
lite/backends/arm/math/prior_box.cc
100644 → 100755
浏览文件 @
74aecd48
...
...
@@ -21,7 +21,7 @@ namespace lite {
namespace
arm
{
namespace
math
{
const
int
MALLOC_ALIGN
=
16
;
const
int
MALLOC_ALIGN
=
64
;
void
*
fast_malloc
(
size_t
size
)
{
size_t
offset
=
sizeof
(
void
*
)
+
MALLOC_ALIGN
-
1
;
...
...
@@ -46,8 +46,8 @@ void fast_free(void* ptr) {
void
density_prior_box
(
const
lite
::
Tensor
*
input
,
const
lite
::
Tensor
*
image
,
lite
::
Tensor
*
*
boxes
,
lite
::
Tensor
*
*
variances
,
lite
::
Tensor
*
boxes
,
lite
::
Tensor
*
variances
,
const
std
::
vector
<
float
>&
min_size_
,
const
std
::
vector
<
float
>&
fixed_size_
,
const
std
::
vector
<
float
>&
fixed_ratio_
,
...
...
@@ -69,11 +69,11 @@ void density_prior_box(const lite::Tensor* input,
int
win1
=
input
->
dims
()[
3
];
int
hin1
=
input
->
dims
()[
2
];
DDim
shape_out
({
hin1
,
win1
,
prior_num_
,
4
});
(
*
boxes
)
->
Resize
(
shape_out
);
(
*
variances
)
->
Resize
(
shape_out
);
boxes
->
Resize
(
shape_out
);
variances
->
Resize
(
shape_out
);
float
*
_cpu_data
=
(
*
boxes
)
->
mutable_data
<
float
>
();
float
*
_variance_data
=
(
*
variances
)
->
mutable_data
<
float
>
();
float
*
_cpu_data
=
boxes
->
mutable_data
<
float
>
();
float
*
_variance_data
=
variances
->
mutable_data
<
float
>
();
const
int
width
=
win1
;
const
int
height
=
hin1
;
...
...
@@ -329,8 +329,8 @@ void density_prior_box(const lite::Tensor* input,
void
prior_box
(
const
lite
::
Tensor
*
input
,
const
lite
::
Tensor
*
image
,
lite
::
Tensor
*
*
boxes
,
lite
::
Tensor
*
*
variances
,
lite
::
Tensor
*
boxes
,
lite
::
Tensor
*
variances
,
const
std
::
vector
<
float
>&
min_size
,
const
std
::
vector
<
float
>&
max_size
,
const
std
::
vector
<
float
>&
aspect_ratio
,
...
...
lite/backends/arm/math/prior_box.h
100644 → 100755
浏览文件 @
74aecd48
...
...
@@ -25,8 +25,8 @@ namespace math {
void
density_prior_box
(
const
lite
::
Tensor
*
input
,
const
lite
::
Tensor
*
image
,
lite
::
Tensor
*
*
boxes
,
lite
::
Tensor
*
*
variances
,
lite
::
Tensor
*
boxes
,
lite
::
Tensor
*
variances
,
const
std
::
vector
<
float
>&
min_size_
,
const
std
::
vector
<
float
>&
fixed_size_
,
const
std
::
vector
<
float
>&
fixed_ratio_
,
...
...
@@ -47,8 +47,8 @@ void density_prior_box(const lite::Tensor* input,
void
prior_box
(
const
lite
::
Tensor
*
input
,
const
lite
::
Tensor
*
image
,
lite
::
Tensor
*
*
boxes
,
lite
::
Tensor
*
*
variances
,
lite
::
Tensor
*
boxes
,
lite
::
Tensor
*
variances
,
const
std
::
vector
<
float
>&
min_size
,
const
std
::
vector
<
float
>&
max_size
,
const
std
::
vector
<
float
>&
aspect_ratio
,
...
...
lite/kernels/arm/prior_box_compute.cc
浏览文件 @
74aecd48
...
...
@@ -46,7 +46,7 @@ inline void ExpandAspectRatios(const std::vector<float>& input_aspect_ratior,
}
}
void
PriorBoxCompute
::
Run
()
{
void
PriorBoxCompute
::
PrepareFor
Run
()
{
auto
&
param
=
Param
<
operators
::
PriorBoxParam
>
();
bool
is_flip
=
param
.
flip
;
...
...
@@ -69,8 +69,8 @@ void PriorBoxCompute::Run() {
lite
::
arm
::
math
::
prior_box
(
param
.
input
,
param
.
image
,
&
param
.
boxes
,
&
param
.
variances
,
&
out_
boxes
,
&
variances
,
min_size
,
max_size
,
aspect_ratios_vec
,
...
...
@@ -85,6 +85,22 @@ void PriorBoxCompute::Run() {
is_clip
,
order
,
min_max_aspect_ratios_order
);
this
->
_flag_init
=
true
;
}
void
PriorBoxCompute
::
Run
()
{
if
(
!
this
->
_flag_init
)
{
LOG
(
FATAL
)
<<
"ERROR: init priorbox first
\n
"
;
}
auto
&
param
=
Param
<
operators
::
PriorBoxParam
>
();
param
.
boxes
->
Resize
(
out_boxes
.
dims
());
param
.
variances
->
Resize
(
out_boxes
.
dims
());
memcpy
(
param
.
boxes
->
mutable_data
<
float
>
(),
out_boxes
.
data
<
float
>
(),
param
.
boxes
->
numel
());
memcpy
(
param
.
variances
->
mutable_data
<
float
>
(),
variances
.
data
<
float
>
(),
param
.
variances
->
numel
());
}
}
// namespace arm
...
...
lite/kernels/arm/prior_box_compute.h
浏览文件 @
74aecd48
...
...
@@ -24,10 +24,15 @@ namespace arm {
class
PriorBoxCompute
:
public
KernelLite
<
TARGET
(
kARM
),
PRECISION
(
kFloat
)
>
{
public:
using
param_t
=
operators
::
PriorBoxParam
;
void
PrepareForRun
()
override
;
void
Run
()
override
;
virtual
~
PriorBoxCompute
()
=
default
;
private:
bool
_flag_init
{
false
};
lite
::
Tensor
out_boxes
;
lite
::
Tensor
variances
;
};
}
// namespace arm
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录