Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSeg
提交
867d4a5b
P
PaddleSeg
项目概览
PaddlePaddle
/
PaddleSeg
通知
285
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
867d4a5b
编写于
5月 24, 2020
作者:
hbclc
提交者:
GitHub
5月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Read and use items of "use_pr" in deploy configuration files (deploy.yaml ) (#264)
Co-authored-by:
N
陈亮
<
chenliang@daheng-image.com
>
上级
e0a9f0c0
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
7 addition
and
4 deletion
+7
-4
deploy/python/infer.py
deploy/python/infer.py
+7
-4
未找到文件。
deploy/python/infer.py
浏览文件 @
867d4a5b
...
...
@@ -29,7 +29,6 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
gflags
.
DEFINE_string
(
"conf"
,
default
=
""
,
help
=
"Configuration File Path"
)
gflags
.
DEFINE_string
(
"input_dir"
,
default
=
""
,
help
=
"Directory of Input Images"
)
gflags
.
DEFINE_boolean
(
"use_pr"
,
default
=
False
,
help
=
"Use optimized model"
)
gflags
.
DEFINE_string
(
"trt_mode"
,
default
=
""
,
help
=
"Use optimized model"
)
gflags
.
DEFINE_string
(
"ext"
,
default
=
".jpeg|.jpg"
,
help
=
"Input Image File Extensions"
)
...
...
@@ -104,6 +103,9 @@ class DeployConfig:
self
.
batch_size
=
deploy_conf
[
"BATCH_SIZE"
]
# 9. channels
self
.
channels
=
deploy_conf
[
"CHANNELS"
]
# 10. use_pr
self
.
use_pr
=
deploy_conf
[
"USE_PR"
]
class
ImageReader
:
...
...
@@ -258,23 +260,24 @@ class Predictor:
# record starting time point
total_start
=
time
.
time
()
batch_size
=
self
.
config
.
batch_size
use_pr
=
self
.
config
.
use_pr
for
i
in
range
(
0
,
len
(
images
),
batch_size
):
real_batch_size
=
batch_size
if
i
+
batch_size
>=
len
(
images
):
real_batch_size
=
len
(
images
)
-
i
reader_start
=
time
.
time
()
img_datas
=
self
.
image_reader
.
process
(
images
[
i
:
i
+
real_batch_size
],
gflags
.
FLAGS
.
use_pr
)
use_pr
)
input_data
=
np
.
concatenate
([
item
[
1
]
for
item
in
img_datas
])
input_data
=
self
.
create_tensor
(
input_data
,
real_batch_size
,
use_pr
=
gflags
.
FLAGS
.
use_pr
)
input_data
,
real_batch_size
,
use_pr
=
use_pr
)
reader_end
=
time
.
time
()
infer_start
=
time
.
time
()
output_data
=
self
.
predictor
.
run
(
input_data
)[
0
]
infer_end
=
time
.
time
()
output_data
=
output_data
.
as_ndarray
()
post_start
=
time
.
time
()
self
.
output_result
(
img_datas
,
output_data
,
gflags
.
FLAGS
.
use_pr
)
self
.
output_result
(
img_datas
,
output_data
,
use_pr
)
post_end
=
time
.
time
()
reader_time
+=
(
reader_end
-
reader_start
)
infer_time
+=
(
infer_end
-
infer_start
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录