Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
28e19603
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看板
提交
28e19603
编写于
9月 17, 2019
作者:
W
wangguanzhong
提交者:
GitHub
9月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update prune interface (#3336)
上级
0be30344
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
6 deletion
+7
-6
tools/infer.py
tools/infer.py
+7
-6
未找到文件。
tools/infer.py
浏览文件 @
28e19603
...
@@ -106,12 +106,12 @@ def prune_feed_vars(feeded_var_names, target_vars, prog):
...
@@ -106,12 +106,12 @@ def prune_feed_vars(feeded_var_names, target_vars, prog):
"""
"""
exist_var_names
=
[]
exist_var_names
=
[]
prog
=
prog
.
clone
()
prog
=
prog
.
clone
()
prog
=
prog
.
_prune
(
targets
=
target_vars
)
prog
=
prog
.
_prune
(
feeded_var_names
,
targets
=
target_vars
)
global_block
=
prog
.
global_block
()
global_block
=
prog
.
global_block
()
for
name
in
feeded_var_names
:
for
name
in
feeded_var_names
:
try
:
try
:
v
=
global_block
.
var
(
name
)
v
=
global_block
.
var
(
name
)
exist_var_names
.
append
(
v
.
name
)
exist_var_names
.
append
(
v
.
name
.
encode
(
'utf-8'
)
)
except
Exception
:
except
Exception
:
logger
.
info
(
'save_inference_model pruned unused feed '
logger
.
info
(
'save_inference_model pruned unused feed '
'variables {}'
.
format
(
name
))
'variables {}'
.
format
(
name
))
...
@@ -127,8 +127,9 @@ def save_infer_model(FLAGS, exe, feed_vars, test_fetches, infer_prog):
...
@@ -127,8 +127,9 @@ def save_infer_model(FLAGS, exe, feed_vars, test_fetches, infer_prog):
feeded_var_names
=
prune_feed_vars
(
feeded_var_names
,
target_vars
,
feeded_var_names
=
prune_feed_vars
(
feeded_var_names
,
target_vars
,
infer_prog
)
infer_prog
)
logger
.
info
(
"Save inference model to {}, input: {}, output: "
logger
.
info
(
"Save inference model to {}, input: {}, output: "
"{}..."
.
format
(
save_dir
,
feeded_var_names
,
"{}..."
.
format
(
save_dir
,
feeded_var_names
,
[
[
var
.
name
for
var
in
target_vars
]))
var
.
name
.
encode
(
'utf-8'
)
for
var
in
target_vars
]))
fluid
.
io
.
save_inference_model
(
fluid
.
io
.
save_inference_model
(
save_dir
,
save_dir
,
feeded_var_names
=
feeded_var_names
,
feeded_var_names
=
feeded_var_names
,
...
@@ -216,7 +217,7 @@ def main():
...
@@ -216,7 +217,7 @@ def main():
from
tb_paddle
import
SummaryWriter
from
tb_paddle
import
SummaryWriter
tb_writer
=
SummaryWriter
(
FLAGS
.
tb_log_dir
)
tb_writer
=
SummaryWriter
(
FLAGS
.
tb_log_dir
)
tb_image_step
=
0
tb_image_step
=
0
tb_image_frame
=
0
# each frame can display ten pictures at most.
tb_image_frame
=
0
# each frame can display ten pictures at most.
imid2path
=
reader
.
imid2path
imid2path
=
reader
.
imid2path
for
iter_id
,
data
in
enumerate
(
reader
()):
for
iter_id
,
data
in
enumerate
(
reader
()):
...
@@ -257,7 +258,7 @@ def main():
...
@@ -257,7 +258,7 @@ def main():
int
(
im_id
),
catid2name
,
int
(
im_id
),
catid2name
,
FLAGS
.
draw_threshold
,
bbox_results
,
FLAGS
.
draw_threshold
,
bbox_results
,
mask_results
)
mask_results
)
# use tb-paddle to log image with bbox
# use tb-paddle to log image with bbox
if
FLAGS
.
use_tb
:
if
FLAGS
.
use_tb
:
infer_image_np
=
np
.
array
(
image
)
infer_image_np
=
np
.
array
(
image
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录