Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
dd87d289
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
接近 2 年 前同步成功
通知
706
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
dd87d289
编写于
7月 16, 2020
作者:
W
wangguanzhong
提交者:
GitHub
7月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix_inference_in_ttfnet (#1063)
上级
2cc0c157
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
2 deletion
+15
-2
deploy/cpp/include/preprocess_op.h
deploy/cpp/include/preprocess_op.h
+2
-0
deploy/cpp/src/object_detector.cc
deploy/cpp/src/object_detector.cc
+4
-1
deploy/cpp/src/preprocess_op.cc
deploy/cpp/src/preprocess_op.cc
+6
-0
tools/infer.py
tools/infer.py
+3
-1
未找到文件。
deploy/cpp/include/preprocess_op.h
浏览文件 @
dd87d289
...
...
@@ -39,6 +39,8 @@ class ImageBlob {
std
::
vector
<
float
>
ori_im_size_f_
;
// Evaluation image width and height
std
::
vector
<
float
>
eval_im_size_f_
;
// Scale factor for image size to origin image size
std
::
vector
<
float
>
scale_factor_f_
;
};
// Abstraction of preprocessing opration class
...
...
deploy/cpp/src/object_detector.cc
浏览文件 @
dd87d289
...
...
@@ -140,7 +140,7 @@ void ObjectDetector::Postprocess(
int
ymax
=
(
output_data_
[
5
+
j
*
6
]
*
rh
);
int
wd
=
xmax
-
xmin
;
int
hd
=
ymax
-
ymin
;
if
(
score
>
threshold_
)
{
if
(
score
>
threshold_
&&
class_id
>
-
1
)
{
ObjectResult
result_item
;
result_item
.
rect
=
{
xmin
,
xmax
,
ymin
,
ymax
};
result_item
.
class_id
=
class_id
;
...
...
@@ -172,6 +172,9 @@ void ObjectDetector::Predict(const cv::Mat& im,
}
else
if
(
tensor_name
==
"im_shape"
)
{
in_tensor
->
Reshape
({
1
,
3
});
in_tensor
->
copy_from_cpu
(
inputs_
.
ori_im_size_f_
.
data
());
}
else
if
(
tensor_name
==
"scale_factor"
)
{
in_tensor
->
Reshape
({
1
,
4
});
in_tensor
->
copy_from_cpu
(
inputs_
.
scale_factor_f_
.
data
());
}
}
// Run predictor
...
...
deploy/cpp/src/preprocess_op.cc
浏览文件 @
dd87d289
...
...
@@ -78,6 +78,12 @@ void Resize::Run(cv::Mat* im, ImageBlob* data) {
static_cast
<
float
>
(
im
->
cols
),
resize_scale
.
first
};
data
->
scale_factor_f_
=
{
resize_scale
.
first
,
resize_scale
.
second
,
resize_scale
.
first
,
resize_scale
.
second
};
}
std
::
pair
<
float
,
float
>
Resize
::
GenerateScale
(
const
cv
::
Mat
&
im
)
{
...
...
tools/infer.py
浏览文件 @
dd87d289
...
...
@@ -178,6 +178,8 @@ def main():
for
k
,
v
in
zip
(
keys
,
outs
)
}
logger
.
info
(
'Infer iter {}'
.
format
(
iter_id
))
if
'TTFNet'
in
cfg
.
architecture
:
res
[
'bbox'
][
1
].
append
([
len
(
res
[
'bbox'
][
0
])])
bbox_results
=
None
mask_results
=
None
...
...
@@ -256,4 +258,4 @@ if __name__ == '__main__':
default
=
"vdl_log_dir/image"
,
help
=
'VisualDL logging directory for image.'
)
FLAGS
=
parser
.
parse_args
()
main
()
\ No newline at end of file
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录