Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
0f289989
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0f289989
编写于
8月 29, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 29, 2020
浏览文件
操作
浏览文件
下载
差异文件
!5471 Remove bool type arg of script
Merge pull request !5471 from chenfei_mindspore/rm-bool-arg-of-script
上级
b4caf21f
40580cc7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
4 addition
and
13 deletion
+4
-13
model_zoo/official/cv/lenet_quant/eval_quant.py
model_zoo/official/cv/lenet_quant/eval_quant.py
+1
-3
model_zoo/official/cv/lenet_quant/export.py
model_zoo/official/cv/lenet_quant/export.py
+0
-2
model_zoo/official/cv/lenet_quant/train_quant.py
model_zoo/official/cv/lenet_quant/train_quant.py
+1
-3
model_zoo/official/cv/mobilenetv2_quant/eval.py
model_zoo/official/cv/mobilenetv2_quant/eval.py
+2
-4
model_zoo/official/cv/mobilenetv2_quant/scripts/run_infer_quant.sh
.../official/cv/mobilenetv2_quant/scripts/run_infer_quant.sh
+0
-1
未找到文件。
model_zoo/official/cv/lenet_quant/eval_quant.py
浏览文件 @
0f289989
...
...
@@ -38,8 +38,6 @@ parser.add_argument('--data_path', type=str, default="./MNIST_Data",
help
=
'path where the dataset is saved'
)
parser
.
add_argument
(
'--ckpt_path'
,
type
=
str
,
default
=
""
,
help
=
'if mode is test, must provide path where the trained ckpt file'
)
parser
.
add_argument
(
'--dataset_sink_mode'
,
type
=
bool
,
default
=
True
,
help
=
'dataset_sink_mode is False or True'
)
args
=
parser
.
parse_args
()
if
__name__
==
"__main__"
:
...
...
@@ -67,5 +65,5 @@ if __name__ == "__main__":
raise
ValueError
(
"Load param into net fail!"
)
print
(
"============== Starting Testing =============="
)
acc
=
model
.
eval
(
ds_eval
,
dataset_sink_mode
=
args
.
dataset_sink_mod
e
)
acc
=
model
.
eval
(
ds_eval
,
dataset_sink_mode
=
Tru
e
)
print
(
"============== {} =============="
.
format
(
acc
))
model_zoo/official/cv/lenet_quant/export.py
浏览文件 @
0f289989
...
...
@@ -36,8 +36,6 @@ parser.add_argument('--data_path', type=str, default="./MNIST_Data",
help
=
'path where the dataset is saved'
)
parser
.
add_argument
(
'--ckpt_path'
,
type
=
str
,
default
=
""
,
help
=
'if mode is test, must provide path where the trained ckpt file'
)
parser
.
add_argument
(
'--dataset_sink_mode'
,
type
=
bool
,
default
=
True
,
help
=
'dataset_sink_mode is False or True'
)
args
=
parser
.
parse_args
()
if
__name__
==
"__main__"
:
...
...
model_zoo/official/cv/lenet_quant/train_quant.py
浏览文件 @
0f289989
...
...
@@ -41,8 +41,6 @@ parser.add_argument('--data_path', type=str, default="./MNIST_Data",
help
=
'path where the dataset is saved'
)
parser
.
add_argument
(
'--ckpt_path'
,
type
=
str
,
default
=
""
,
help
=
'if mode is test, must provide path where the trained ckpt file'
)
parser
.
add_argument
(
'--dataset_sink_mode'
,
type
=
bool
,
default
=
True
,
help
=
'dataset_sink_mode is False or True'
)
args
=
parser
.
parse_args
()
if
__name__
==
"__main__"
:
...
...
@@ -76,5 +74,5 @@ if __name__ == "__main__":
print
(
"============== Starting Training =============="
)
model
.
train
(
cfg
[
'epoch_size'
],
ds_train
,
callbacks
=
[
ckpt_callback
,
LossMonitor
()],
dataset_sink_mode
=
args
.
dataset_sink_mod
e
)
dataset_sink_mode
=
Tru
e
)
print
(
"============== End Training =============="
)
model_zoo/official/cv/mobilenetv2_quant/eval.py
浏览文件 @
0f289989
...
...
@@ -32,7 +32,6 @@ parser = argparse.ArgumentParser(description='Image classification')
parser
.
add_argument
(
'--checkpoint_path'
,
type
=
str
,
default
=
None
,
help
=
'Checkpoint file path'
)
parser
.
add_argument
(
'--dataset_path'
,
type
=
str
,
default
=
None
,
help
=
'Dataset path'
)
parser
.
add_argument
(
'--device_target'
,
type
=
str
,
default
=
None
,
help
=
'Run device target'
)
parser
.
add_argument
(
'--quantization_aware'
,
type
=
bool
,
default
=
False
,
help
=
'Use quantization aware training'
)
args_opt
=
parser
.
parse_args
()
if
__name__
==
'__main__'
:
...
...
@@ -51,9 +50,8 @@ if __name__ == '__main__':
# define fusion network
network
=
mobilenetV2
(
num_classes
=
config_device_target
.
num_classes
)
if
args_opt
.
quantization_aware
:
# convert fusion network to quantization aware network
network
=
quant
.
convert_quant_network
(
network
,
bn_fold
=
True
,
per_channel
=
[
True
,
False
],
symmetric
=
[
True
,
False
])
# convert fusion network to quantization aware network
network
=
quant
.
convert_quant_network
(
network
,
bn_fold
=
True
,
per_channel
=
[
True
,
False
],
symmetric
=
[
True
,
False
])
# define network loss
loss
=
nn
.
SoftmaxCrossEntropyWithLogits
(
is_grad
=
False
,
sparse
=
True
,
reduction
=
'mean'
)
...
...
model_zoo/official/cv/mobilenetv2_quant/scripts/run_infer_quant.sh
浏览文件 @
0f289989
...
...
@@ -50,5 +50,4 @@ python ${BASEPATH}/../eval.py \
--device_target
=
$1
\
--dataset_path
=
$2
\
--checkpoint_path
=
$3
\
--quantization_aware
=
True
\
&> infer.log &
# dataset val folder path
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录