Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
90f41cce
Mace
项目概览
Xiaomi
/
Mace
通知
107
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
90f41cce
编写于
4月 20, 2018
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix validation wrong input file bug.
上级
83623605
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
7 addition
and
6 deletion
+7
-6
tools/validate.py
tools/validate.py
+7
-6
未找到文件。
tools/validate.py
浏览文件 @
90f41cce
...
...
@@ -28,7 +28,7 @@ def load_data(file):
return
np
.
empty
([
0
])
def
format_
output_
name
(
name
):
def
format_name
(
name
):
return
re
.
sub
(
'[^0-9a-zA-Z]+'
,
'_'
,
name
)
...
...
@@ -71,7 +71,7 @@ def validate_tf_model(input_names, input_shapes, output_names):
input_dict
=
{}
for
i
in
range
(
len
(
input_names
)):
input_value
=
load_data
(
FLAGS
.
input_file
+
"_"
+
input_names
[
i
]
)
FLAGS
.
input_file
+
"_"
+
format_name
(
input_names
[
i
])
)
input_value
=
input_value
.
reshape
(
input_shapes
[
i
])
input_node
=
graph
.
get_tensor_by_name
(
input_names
[
i
]
+
':0'
)
...
...
@@ -84,7 +84,7 @@ def validate_tf_model(input_names, input_shapes, output_names):
output_values
=
session
.
run
(
output_nodes
,
feed_dict
=
input_dict
)
for
i
in
range
(
len
(
output_names
)):
output_file_name
=
FLAGS
.
mace_out_file
+
"_"
+
\
format_
output_
name
(
output_names
[
i
])
format_name
(
output_names
[
i
])
mace_out_value
=
load_data
(
output_file_name
)
compare_output
(
output_names
[
i
],
mace_out_value
,
output_values
[
i
])
...
...
@@ -92,7 +92,7 @@ def validate_tf_model(input_names, input_shapes, output_names):
def
validate_caffe_model
(
input_names
,
input_shapes
,
output_names
,
output_shapes
):
os
.
environ
[
'GLOG_minloglevel'
]
=
'1'
# sup
r
ress Caffe verbose prints
os
.
environ
[
'GLOG_minloglevel'
]
=
'1'
# sup
p
ress Caffe verbose prints
import
caffe
if
not
os
.
path
.
isfile
(
FLAGS
.
model_file
):
print
(
"Input graph file '"
+
FLAGS
.
model_file
+
"' does not exist!"
)
...
...
@@ -106,7 +106,8 @@ def validate_caffe_model(input_names, input_shapes, output_names,
net
=
caffe
.
Net
(
FLAGS
.
model_file
,
caffe
.
TEST
,
weights
=
FLAGS
.
weight_file
)
for
i
in
range
(
len
(
input_names
)):
input_value
=
load_data
(
FLAGS
.
input_file
+
"_"
+
input_names
[
i
])
input_value
=
load_data
(
FLAGS
.
input_file
+
"_"
+
format_name
(
input_names
[
i
]))
input_value
=
input_value
.
reshape
(
input_shapes
[
i
]).
transpose
((
0
,
3
,
1
,
2
))
input_blob_name
=
input_names
[
i
]
...
...
@@ -125,7 +126,7 @@ def validate_caffe_model(input_names, input_shapes, output_names,
out_shape
[
1
],
out_shape
[
2
],
out_shape
[
3
]
=
out_shape
[
3
],
out_shape
[
1
],
out_shape
[
2
]
value
=
value
.
reshape
(
out_shape
).
transpose
((
0
,
2
,
3
,
1
))
output_file_name
=
FLAGS
.
mace_out_file
+
"_"
+
format_
output_
name
(
output_file_name
=
FLAGS
.
mace_out_file
+
"_"
+
format_name
(
output_names
[
i
])
mace_out_value
=
load_data
(
output_file_name
)
compare_output
(
output_names
[
i
],
mace_out_value
,
value
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录