Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
86d75e9e
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
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看板
未验证
提交
86d75e9e
编写于
2月 20, 2021
作者:
G
Guanghua Yu
提交者:
GitHub
2月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix_deploy_python_infer (#2233)
上级
e4909b55
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
15 addition
and
15 deletion
+15
-15
dygraph/deploy/python/infer.py
dygraph/deploy/python/infer.py
+7
-7
dygraph/deploy/python/preprocess.py
dygraph/deploy/python/preprocess.py
+4
-4
dygraph/deploy/python/visualize.py
dygraph/deploy/python/visualize.py
+1
-1
dygraph/docs/tutorials/INSTALL_cn.md
dygraph/docs/tutorials/INSTALL_cn.md
+1
-1
dygraph/ppdet/engine/export_utils.py
dygraph/ppdet/engine/export_utils.py
+2
-2
未找到文件。
dygraph/deploy/python/infer.py
浏览文件 @
86d75e9e
...
...
@@ -23,7 +23,7 @@ from PIL import Image
import
cv2
import
numpy
as
np
import
paddle
from
preprocess
import
preprocess
,
Resize
Op
,
NormalizeImageOp
,
PermuteOp
,
PadStride
from
preprocess
import
preprocess
,
Resize
,
NormalizeImage
,
Permute
,
PadStride
from
visualize
import
visualize_box_mask
from
paddle.inference
import
Config
from
paddle.inference
import
create_predictor
...
...
@@ -196,22 +196,22 @@ class DetectorSOLOv2(Detector):
self
.
predictor
.
run
()
output_names
=
self
.
predictor
.
get_output_names
()
np_label
=
self
.
predictor
.
get_output_handle
(
output_names
[
0
]).
copy_to_cpu
()
np_score
=
self
.
predictor
.
get_output_handle
(
output_names
[
1
]).
copy_to_cpu
()
np_s
egms
=
self
.
predictor
.
get_output_handle
(
output_names
[
np_s
core
=
self
.
predictor
.
get_output_handle
(
output_names
[
2
]).
copy_to_cpu
()
np_segms
=
self
.
predictor
.
get_output_handle
(
output_names
[
3
]).
copy_to_cpu
()
t1
=
time
.
time
()
for
i
in
range
(
repeats
):
self
.
predictor
.
run
()
output_names
=
self
.
predictor
.
get_output_names
()
np_label
=
self
.
predictor
.
get_output_handle
(
output_names
[
0
]).
copy_to_cpu
()
np_score
=
self
.
predictor
.
get_output_handle
(
output_names
[
1
]).
copy_to_cpu
()
np_s
egms
=
self
.
predictor
.
get_output_handle
(
output_names
[
np_s
core
=
self
.
predictor
.
get_output_handle
(
output_names
[
2
]).
copy_to_cpu
()
np_segms
=
self
.
predictor
.
get_output_handle
(
output_names
[
3
]).
copy_to_cpu
()
t2
=
time
.
time
()
ms
=
(
t2
-
t1
)
*
1000.0
/
repeats
print
(
"Inference: {} ms per batch image"
.
format
(
ms
))
...
...
dygraph/deploy/python/preprocess.py
浏览文件 @
86d75e9e
...
...
@@ -38,7 +38,7 @@ def decode_image(im_file, im_info):
return
im
,
im_info
class
Resize
Op
(
object
):
class
Resize
(
object
):
"""resize image by target_size and max_size
Args:
target_size (int): the target size of image
...
...
@@ -115,7 +115,7 @@ class ResizeOp(object):
return
im_scale_y
,
im_scale_x
class
NormalizeImage
Op
(
object
):
class
NormalizeImage
(
object
):
"""normalize image
Args:
mean (list): im - mean
...
...
@@ -150,7 +150,7 @@ class NormalizeImageOp(object):
return
im
,
im_info
class
Permute
Op
(
object
):
class
Permute
(
object
):
"""permute image
Args:
to_bgr (bool): whether convert RGB to BGR
...
...
@@ -158,7 +158,7 @@ class PermuteOp(object):
"""
def
__init__
(
self
,
):
super
(
Permute
Op
,
self
).
__init__
()
super
(
Permute
,
self
).
__init__
()
def
__call__
(
self
,
im
,
im_info
):
"""
...
...
dygraph/deploy/python/visualize.py
浏览文件 @
86d75e9e
...
...
@@ -173,7 +173,7 @@ def draw_segm(im,
clsid2color
=
{}
np_segms
=
np_segms
.
astype
(
np
.
uint8
)
for
i
in
range
(
np_segms
.
shape
[
0
]):
mask
,
score
,
clsid
=
np_segms
[
i
],
np_score
[
i
],
np_label
[
i
]
+
1
mask
,
score
,
clsid
=
np_segms
[
i
],
np_score
[
i
],
np_label
[
i
]
if
score
<
threshold
:
continue
...
...
dygraph/docs/tutorials/INSTALL_cn.md
浏览文件 @
86d75e9e
...
...
@@ -12,7 +12,7 @@
**环境需求:**
-
PaddlePaddle
每日版本
-
PaddlePaddle
2.0.1 或 PaddlePaddle release/2.0分支最新编译安装包
-
OS 64位操作系统
-
Python 3(3.5.1+/3.6/3.7),64位版本
-
pip/pip3(9.0.1+),64位版本
...
...
dygraph/ppdet/engine/export_utils.py
浏览文件 @
86d75e9e
...
...
@@ -52,7 +52,7 @@ def _parse_reader(reader_cfg, dataset_cfg, metric, arch, image_shape):
for
st
in
sample_transforms
[
1
:]:
for
key
,
value
in
st
.
items
():
p
=
{
'type'
:
key
}
if
key
==
'Resize
Op
'
:
if
key
==
'Resize'
:
if
value
.
get
(
'keep_ratio'
,
False
)
and
image_shape
[
1
]
is
not
None
:
max_size
=
max
(
image_shape
[
1
:])
...
...
@@ -65,7 +65,7 @@ def _parse_reader(reader_cfg, dataset_cfg, metric, arch, image_shape):
methods
=
[
list
(
bt
.
keys
())[
0
]
for
bt
in
batch_transforms
]
for
bt
in
batch_transforms
:
for
key
,
value
in
bt
.
items
():
if
key
==
'PadBatch
Op
'
:
if
key
==
'PadBatch'
:
preprocess_list
.
append
({
'type'
:
'PadStride'
})
preprocess_list
[
-
1
].
update
({
'stride'
:
value
[
'pad_to_stride'
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录