Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSeg
提交
40950add
P
PaddleSeg
项目概览
PaddlePaddle
/
PaddleSeg
通知
289
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
40950add
编写于
6月 19, 2020
作者:
C
chenguowei01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update train.py
上级
1c06b49d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
5 deletion
+5
-5
dygraph/train.py
dygraph/train.py
+5
-5
未找到文件。
dygraph/train.py
浏览文件 @
40950add
...
@@ -144,8 +144,6 @@ def train(model,
...
@@ -144,8 +144,6 @@ def train(model,
return_list
=
True
,
return_list
=
True
,
)
)
num_steps_each_epoch
=
len
(
train_dataset
)
//
batch_size
for
epoch
in
range
(
num_epochs
):
for
epoch
in
range
(
num_epochs
):
for
step
,
data
in
enumerate
(
loader
):
for
step
,
data
in
enumerate
(
loader
):
images
=
data
[
0
]
images
=
data
[
0
]
...
@@ -165,8 +163,7 @@ def train(model,
...
@@ -165,8 +163,7 @@ def train(model,
loss
.
numpy
()))
loss
.
numpy
()))
if
((
epoch
+
1
)
%
save_interval_epochs
==
0
if
((
epoch
+
1
)
%
save_interval_epochs
==
0
or
num_steps_each_epoch
==
num_epochs
-
1
or
epoch
==
num_epochs
-
1
)
and
ParallelEnv
().
local_rank
==
0
:
)
and
ParallelEnv
().
local_rank
==
0
:
current_save_dir
=
os
.
path
.
join
(
save_dir
,
current_save_dir
=
os
.
path
.
join
(
save_dir
,
"epoch_{}"
.
format
(
epoch
+
1
))
"epoch_{}"
.
format
(
epoch
+
1
))
if
not
os
.
path
.
isdir
(
current_save_dir
):
if
not
os
.
path
.
isdir
(
current_save_dir
):
...
@@ -223,7 +220,10 @@ def main(args):
...
@@ -223,7 +220,10 @@ def main(args):
num_classes
=
train_dataset
.
num_classes
,
ignore_index
=
255
)
num_classes
=
train_dataset
.
num_classes
,
ignore_index
=
255
)
# Creat optimizer
# Creat optimizer
num_steps_each_epoch
=
len
(
train_dataset
)
//
args
.
batch_size
# todo, may less one than len(loader)
num_steps_each_epoch
=
len
(
train_dataset
)
//
(
args
.
batch_size
*
ParallelEnv
().
nranks
)
print
(
num_steps_each_epoch
,
'num_steps_each_epoch'
)
decay_step
=
args
.
num_epochs
*
num_steps_each_epoch
decay_step
=
args
.
num_epochs
*
num_steps_each_epoch
lr_decay
=
fluid
.
layers
.
polynomial_decay
(
lr_decay
=
fluid
.
layers
.
polynomial_decay
(
args
.
learning_rate
,
decay_step
,
end_learning_rate
=
0
,
power
=
0.9
)
args
.
learning_rate
,
decay_step
,
end_learning_rate
=
0
,
power
=
0.9
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录