Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
64a2a78e
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
64a2a78e
编写于
7月 16, 2020
作者:
W
wangguanzhong
提交者:
GitHub
7月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix cpp inference without resize (#1073)
上级
c4219c27
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
67 addition
and
35 deletion
+67
-35
configs/face_detection/blazeface.yml
configs/face_detection/blazeface.yml
+6
-4
configs/face_detection/blazeface_keypoint.yml
configs/face_detection/blazeface_keypoint.yml
+6
-4
configs/face_detection/blazeface_nas.yml
configs/face_detection/blazeface_nas.yml
+6
-4
configs/face_detection/blazeface_nas_v2.yml
configs/face_detection/blazeface_nas_v2.yml
+6
-4
configs/face_detection/faceboxes.yml
configs/face_detection/faceboxes.yml
+7
-4
configs/face_detection/faceboxes_lite.yml
configs/face_detection/faceboxes_lite.yml
+7
-4
deploy/cpp/include/preprocess_op.h
deploy/cpp/include/preprocess_op.h
+8
-0
deploy/cpp/src/preprocess_op.cc
deploy/cpp/src/preprocess_op.cc
+21
-11
未找到文件。
configs/face_detection/blazeface.yml
浏览文件 @
64a2a78e
...
...
@@ -96,11 +96,12 @@ EvalReader:
-
!DecodeImage
to_rgb
:
true
-
!NormalizeBox
{}
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
batch_size
:
1
TestReader
:
...
...
@@ -112,9 +113,10 @@ TestReader:
sample_transforms
:
-
!DecodeImage
to_rgb
:
true
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
batch_size
:
1
configs/face_detection/blazeface_keypoint.yml
浏览文件 @
64a2a78e
...
...
@@ -104,11 +104,12 @@ EvalReader:
-
!DecodeImage
to_rgb
:
true
-
!NormalizeBox
{}
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
batch_size
:
1
TestReader
:
...
...
@@ -120,9 +121,10 @@ TestReader:
sample_transforms
:
-
!DecodeImage
to_rgb
:
true
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
batch_size
:
1
configs/face_detection/blazeface_nas.yml
浏览文件 @
64a2a78e
...
...
@@ -98,11 +98,12 @@ EvalReader:
-
!DecodeImage
to_rgb
:
true
-
!NormalizeBox
{}
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
batch_size
:
1
TestReader
:
...
...
@@ -114,9 +115,10 @@ TestReader:
sample_transforms
:
-
!DecodeImage
to_rgb
:
true
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
batch_size
:
1
configs/face_detection/blazeface_nas_v2.yml
浏览文件 @
64a2a78e
...
...
@@ -98,11 +98,12 @@ EvalReader:
-
!DecodeImage
to_rgb
:
true
-
!NormalizeBox
{}
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
batch_size
:
1
TestReader
:
...
...
@@ -114,9 +115,10 @@ TestReader:
sample_transforms
:
-
!DecodeImage
to_rgb
:
true
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
batch_size
:
1
configs/face_detection/faceboxes.yml
浏览文件 @
64a2a78e
...
...
@@ -97,11 +97,13 @@ EvalReader:
sample_transforms
:
-
!DecodeImage
to_rgb
:
true
-
!
Permute
{}
-
!
NormalizeBox
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
TestReader
:
inputs_def
:
...
...
@@ -112,9 +114,10 @@ TestReader:
sample_transforms
:
-
!DecodeImage
to_rgb
:
true
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
batch_size
:
1
configs/face_detection/faceboxes_lite.yml
浏览文件 @
64a2a78e
...
...
@@ -98,11 +98,13 @@ EvalReader:
-
!DecodeImage
to_rgb
:
true
-
!NormalizeBox
{}
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
TestReader
:
inputs_def
:
...
...
@@ -113,9 +115,10 @@ TestReader:
sample_transforms
:
-
!DecodeImage
to_rgb
:
true
-
!Permute
{}
-
!NormalizeImage
is_channel_first
:
false
is_scale
:
false
mean
:
[
1
04
,
117
,
123
]
mean
:
[
1
23
,
117
,
104
]
std
:
[
127.502231
,
127.502231
,
127.502231
]
-
!Permute
{}
batch_size
:
1
deploy/cpp/include/preprocess_op.h
浏览文件 @
64a2a78e
...
...
@@ -50,6 +50,12 @@ class PreprocessOp {
virtual
void
Run
(
cv
::
Mat
*
im
,
ImageBlob
*
data
)
=
0
;
};
class
InitInfo
:
public
PreprocessOp
{
public:
virtual
void
Init
(
const
YAML
::
Node
&
item
,
const
std
::
string
&
arch
)
{}
virtual
void
Run
(
cv
::
Mat
*
im
,
ImageBlob
*
data
);
};
class
Normalize
:
public
PreprocessOp
{
public:
virtual
void
Init
(
const
YAML
::
Node
&
item
,
const
std
::
string
&
arch
)
{
...
...
@@ -127,6 +133,8 @@ class Preprocessor {
public:
void
Init
(
const
YAML
::
Node
&
config_node
,
const
std
::
string
&
arch
)
{
arch_
=
arch
;
// initialize image info at first
ops_
[
"InitInfo"
]
=
std
::
make_shared
<
InitInfo
>
();
for
(
const
auto
&
item
:
config_node
)
{
auto
op_name
=
item
[
"type"
].
as
<
std
::
string
>
();
ops_
[
op_name
]
=
CreateOp
(
op_name
);
...
...
deploy/cpp/src/preprocess_op.cc
浏览文件 @
64a2a78e
...
...
@@ -19,6 +19,24 @@
namespace
PaddleDetection
{
void
InitInfo
::
Run
(
cv
::
Mat
*
im
,
ImageBlob
*
data
)
{
data
->
ori_im_size_
=
{
static_cast
<
int
>
(
im
->
rows
),
static_cast
<
int
>
(
im
->
cols
)
};
data
->
ori_im_size_f_
=
{
static_cast
<
float
>
(
im
->
rows
),
static_cast
<
float
>
(
im
->
cols
),
1.0
};
data
->
eval_im_size_f_
=
{
static_cast
<
float
>
(
im
->
rows
),
static_cast
<
float
>
(
im
->
cols
),
1.0
};
data
->
scale_factor_f_
=
{
1.
,
1.
,
1.
,
1.
};
}
void
Normalize
::
Run
(
cv
::
Mat
*
im
,
ImageBlob
*
data
)
{
double
e
=
1.0
;
if
(
is_scale_
)
{
...
...
@@ -44,20 +62,12 @@ void Permute::Run(cv::Mat* im, ImageBlob* data) {
(
data
->
im_data_
).
resize
(
rc
*
rh
*
rw
);
float
*
base
=
(
data
->
im_data_
).
data
();
for
(
int
i
=
0
;
i
<
rc
;
++
i
)
{
cv
::
extractChannel
(
*
im
,
cv
::
Mat
(
rh
,
rw
,
CV_32FC1
,
base
+
i
*
rh
*
rw
),
i
);
int
cur_c
=
to_bgr_
?
rc
-
i
-
1
:
i
;
cv
::
extractChannel
(
*
im
,
cv
::
Mat
(
rh
,
rw
,
CV_32FC1
,
base
+
cur_c
*
rh
*
rw
),
i
);
}
}
void
Resize
::
Run
(
cv
::
Mat
*
im
,
ImageBlob
*
data
)
{
data
->
ori_im_size_
=
{
static_cast
<
int
>
(
im
->
rows
),
static_cast
<
int
>
(
im
->
cols
)
};
data
->
ori_im_size_f_
=
{
static_cast
<
float
>
(
im
->
rows
),
static_cast
<
float
>
(
im
->
cols
),
1.0
};
auto
resize_scale
=
GenerateScale
(
*
im
);
cv
::
resize
(
*
im
,
*
im
,
cv
::
Size
(),
resize_scale
.
first
,
resize_scale
.
second
,
interp_
);
...
...
@@ -137,7 +147,7 @@ void PadStride::Run(cv::Mat* im, ImageBlob* data) {
// Preprocessor op running order
const
std
::
vector
<
std
::
string
>
Preprocessor
::
RUN_ORDER
=
{
"Resize"
,
"Normalize"
,
"PadStride"
,
"Permute"
"
InitInfo"
,
"
Resize"
,
"Normalize"
,
"PadStride"
,
"Permute"
};
void
Preprocessor
::
Run
(
cv
::
Mat
*
im
,
ImageBlob
*
data
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录