Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
a4f2e728
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看板
提交
a4f2e728
编写于
8月 17, 2020
作者:
M
ms_yan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
repair vgg precision problem
上级
81833943
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
9 deletion
+10
-9
model_zoo/official/cv/vgg16/eval.py
model_zoo/official/cv/vgg16/eval.py
+1
-1
model_zoo/official/cv/vgg16/src/config.py
model_zoo/official/cv/vgg16/src/config.py
+1
-1
model_zoo/official/cv/vgg16/src/vgg.py
model_zoo/official/cv/vgg16/src/vgg.py
+5
-4
model_zoo/official/cv/vgg16/train.py
model_zoo/official/cv/vgg16/train.py
+3
-3
未找到文件。
model_zoo/official/cv/vgg16/eval.py
浏览文件 @
a4f2e728
...
...
@@ -158,7 +158,7 @@ def test(cloud_args=None):
args
.
models
=
[
args
.
pre_trained
,]
for
model
in
args
.
models
:
dataset
=
classification_dataset
(
args
.
data_path
,
args
.
image_size
,
args
.
per_batch_size
)
dataset
=
classification_dataset
(
args
.
data_path
,
args
.
image_size
,
args
.
per_batch_size
,
mode
=
'eval'
)
eval_dataloader
=
dataset
.
create_tuple_iterator
()
network
=
vgg16
(
args
.
num_classes
,
args
,
phase
=
"test"
)
...
...
model_zoo/official/cv/vgg16/src/config.py
浏览文件 @
a4f2e728
...
...
@@ -64,7 +64,7 @@ imagenet_cfg = edict({
"image_size"
:
'224,224'
,
"pad_mode"
:
'pad'
,
"padding"
:
1
,
"has_bias"
:
Tru
e
,
"has_bias"
:
Fals
e
,
"batch_norm"
:
False
,
"keep_checkpoint_max"
:
10
,
"initialize_mode"
:
"KaimingNormal"
,
...
...
model_zoo/official/cv/vgg16/src/vgg.py
浏览文件 @
a4f2e728
...
...
@@ -31,10 +31,11 @@ def _make_layer(base, args, batch_norm):
if
v
==
'M'
:
layers
+=
[
nn
.
MaxPool2d
(
kernel_size
=
2
,
stride
=
2
)]
else
:
weight_shape
=
(
v
,
in_channels
,
3
,
3
)
weight
=
initializer
(
'XavierUniform'
,
shape
=
weight_shape
,
dtype
=
mstype
.
float32
).
to_tensor
()
if
args
.
initialize_mode
==
"KaimingNormal"
:
weight
=
'normal'
weight
=
'ones'
if
args
.
initialize_mode
==
"XavierUniform"
:
weight_shape
=
(
v
,
in_channels
,
3
,
3
)
weight
=
initializer
(
'XavierUniform'
,
shape
=
weight_shape
,
dtype
=
mstype
.
float32
).
to_tensor
()
conv2d
=
nn
.
Conv2d
(
in_channels
=
in_channels
,
out_channels
=
v
,
kernel_size
=
3
,
...
...
model_zoo/official/cv/vgg16/train.py
浏览文件 @
a4f2e728
...
...
@@ -127,7 +127,7 @@ def parse_args(cloud_args=None):
# logging and checkpoint related
parser
.
add_argument
(
'--log_interval'
,
type
=
int
,
default
=
100
,
help
=
'logging interval'
)
parser
.
add_argument
(
'--ckpt_path'
,
type
=
str
,
default
=
'outputs/'
,
help
=
'checkpoint save location'
)
parser
.
add_argument
(
'--ckpt_interval'
,
type
=
int
,
default
=
2
,
help
=
'ckpt_interval'
)
parser
.
add_argument
(
'--ckpt_interval'
,
type
=
int
,
default
=
5
,
help
=
'ckpt_interval'
)
parser
.
add_argument
(
'--is_save_on_master'
,
type
=
int
,
default
=
1
,
help
=
'save ckpt on master or all rank'
)
# distributed related
...
...
@@ -200,12 +200,12 @@ if __name__ == '__main__':
device_num
=
args
.
group_size
context
.
reset_auto_parallel_context
()
context
.
set_auto_parallel_context
(
device_num
=
device_num
,
parallel_mode
=
ParallelMode
.
DATA_PARALLEL
,
mirror_mean
=
True
)
parameter_broadcast
=
True
,
mirror_mean
=
True
)
else
:
context
.
set_context
(
device_id
=
args
.
device_id
)
context
.
set_context
(
mode
=
context
.
GRAPH_MODE
,
device_target
=
args
.
device_target
)
# select for master rank save ckpt or all rank save, compati
a
ble for model parallel
# select for master rank save ckpt or all rank save, compatible for model parallel
args
.
rank_save_ckpt_flag
=
0
if
args
.
is_save_on_master
:
if
args
.
rank
==
0
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录