Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mr.Vain
Mace
提交
8b739bdc
Mace
项目概览
Mr.Vain
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
1
Fork
0
代码
文件
提交
分支
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8b739bdc
编写于
3月 12, 2018
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix converte vgg caffe model bug.
上级
b1ce72f9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
8 deletion
+29
-8
generate_data.py
generate_data.py
+0
-3
generate_model_code.sh
generate_model_code.sh
+1
-1
mace_tools.py
mace_tools.py
+24
-1
validate_tools.sh
validate_tools.sh
+4
-3
未找到文件。
generate_data.py
浏览文件 @
8b739bdc
import
argparse
import
sys
import
os
import
os.path
import
numpy
as
np
import
re
from
scipy
import
spatial
# Validation Flow:
# 1. Generate input data
...
...
generate_model_code.sh
浏览文件 @
8b739bdc
...
...
@@ -10,7 +10,7 @@ if [ ${DSP_MODE} ]; then
DSP_MODE_FLAG
=
"--dsp_mode=
${
DSP_MODE
}
"
fi
bazel-bin/lib/python/tools/converter
--platform
=
${
PLATFORM
}
\
PYTHONUNBUFFERED
=
1
bazel-bin/lib/python/tools/converter
--platform
=
${
PLATFORM
}
\
--model_file
=
${
MODEL_FILE_PATH
}
\
--weight_file
=
${
WEIGHT_FILE_PATH
}
\
--model_checksum
=
${
MODEL_SHA256_CHECKSUM
}
\
...
...
mace_tools.py
浏览文件 @
8b739bdc
...
...
@@ -17,6 +17,29 @@ import yaml
from
ConfigParser
import
ConfigParser
def
run_command_real_time
(
command
):
print
(
"Run command: {}"
.
format
(
command
))
process
=
subprocess
.
Popen
(
command
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
while
True
:
std_err
=
process
.
stderr
.
readline
()
if
std_err
==
''
and
process
.
poll
()
is
not
None
:
break
if
std_err
:
print
std_err
.
strip
()
while
True
:
std_out
=
process
.
stdout
.
readline
()
if
std_out
==
''
and
process
.
poll
()
is
not
None
:
break
if
std_out
:
print
std_out
.
strip
()
ret_code
=
process
.
poll
()
if
ret_code
!=
0
:
raise
Exception
(
"Exit not 0 from bash with code: {}, command: {}"
.
format
(
ret_code
,
command
))
def
run_command
(
command
):
print
(
"Run command: {}"
.
format
(
command
))
result
=
subprocess
.
Popen
(
...
...
@@ -71,7 +94,7 @@ def generate_random_input(model_output_dir):
def
generate_model_code
():
command
=
"bash tools/generate_model_code.sh"
run_command
(
command
)
run_command
_real_time
(
command
)
def
build_mace_run
(
production_mode
,
model_output_dir
,
hexagon_mode
):
...
...
validate_tools.sh
浏览文件 @
8b739bdc
...
...
@@ -24,7 +24,7 @@ if [ "$GENERATE_DATA_OR_NOT" = 1 ]; then
FORMATTED_NAME
=
$(
sed
s/[^[:alnum:]]/_/g
<<<
${
NAME
}
)
rm
-rf
${
MODEL_OUTPUT_DIR
}
/
${
INPUT_FILE_NAME
}
_
${
FORMATTED_NAME
}
done
python tools/generate_data.py
--input_node
=
${
INPUT_NODES
}
\
python
-u
tools/generate_data.py
--input_node
=
${
INPUT_NODES
}
\
--input_file
=
${
MODEL_OUTPUT_DIR
}
/
${
INPUT_FILE_NAME
}
\
--input_shape
=
"
${
INPUT_SHAPES
}
"
||
exit
1
exit
0
...
...
@@ -38,7 +38,7 @@ if [ "$PLATFORM" == "tensorflow" ];then
adb pull
${
PHONE_DATA_DIR
}
/
${
OUTPUT_FILE_NAME
}
_
${
FORMATTED_NAME
}
${
MODEL_OUTPUT_DIR
}
>
/dev/null
done
fi
python tools/validate.py
--platform
=
tensorflow
\
python
-u
tools/validate.py
--platform
=
tensorflow
\
--model_file
${
MODEL_FILE_PATH
}
\
--input_file
${
MODEL_OUTPUT_DIR
}
/
${
INPUT_FILE_NAME
}
\
--mace_out_file
${
MODEL_OUTPUT_DIR
}
/
${
OUTPUT_FILE_NAME
}
\
...
...
@@ -90,7 +90,8 @@ elif [ "$PLATFORM" == "caffe" ];then
docker
cp
tools/validate.py
${
CONTAINER_NAME
}
:/mace
docker
cp
${
MODEL_FILE_PATH
}
${
CONTAINER_NAME
}
:/mace
docker
cp
${
WEIGHT_FILE_PATH
}
${
CONTAINER_NAME
}
:/mace
docker
exec
-it
${
CONTAINER_NAME
}
python /mace/validate.py
--platform
=
caffe
\
docker
exec
-it
${
CONTAINER_NAME
}
python
-u
/mace/validate.py
\
--platform
=
caffe
\
--model_file
/mace/
${
MODEL_FILE_NAME
}
\
--weight_file
/mace/
${
WEIGHT_FILE_NAME
}
\
--input_file
/mace/
${
INPUT_FILE_NAME
}
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录