Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSeg
提交
11e1c767
P
PaddleSeg
项目概览
PaddlePaddle
/
PaddleSeg
通知
286
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看板
提交
11e1c767
编写于
6月 23, 2020
作者:
C
chenguowei01
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dygraph' of github.com:wuyefeilin/PaddleSeg into dygraph
上级
4e55315e
d3183617
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
5 deletion
+13
-5
dygraph/train.py
dygraph/train.py
+2
-2
dygraph/val.py
dygraph/val.py
+11
-3
未找到文件。
dygraph/train.py
浏览文件 @
11e1c767
...
...
@@ -183,12 +183,12 @@ def train(model,
loss
.
backward
()
optimizer
.
minimize
(
loss
)
model
.
clear_gradients
()
avg_loss
+=
loss
.
numpy
()
avg_loss
+=
loss
.
numpy
()
[
0
]
lr
=
optimizer
.
current_step_lr
()
if
step
%
log_steps
==
0
:
avg_loss
/=
log_steps
time_step
=
timer
.
elapsed_time
()
/
log_steps
remain_step
=
(
num_epochs
-
epoch
)
*
steps_per_epoch
-
step
+
1
remain_step
=
(
num_epochs
-
epoch
)
*
steps_per_epoch
-
step
-
1
logging
.
info
(
"[TRAIN] Epoch={}/{}, Step={}/{}, loss={:.4f}, lr={:.6f}, sec/step={:.4f} | ETA {}"
.
format
(
epoch
+
1
,
num_epochs
,
step
+
1
,
steps_per_epoch
,
...
...
dygraph/val.py
浏览文件 @
11e1c767
...
...
@@ -29,6 +29,7 @@ import models
import
utils.logging
as
logging
from
utils
import
get_environ_info
from
utils
import
ConfusionMatrix
from
utils
import
Timer
,
calculate_eta
def
parse_args
():
...
...
@@ -96,12 +97,14 @@ def evaluate(model,
places
=
places
,
return_list
=
True
,
)
total_steps
=
math
.
ceil
(
len
(
eval_dataset
)
*
1.0
/
batch_size
)
total_steps
=
len
(
batch_sampler
)
conf_mat
=
ConfusionMatrix
(
num_classes
,
streaming
=
True
)
logging
.
info
(
"Start to evaluating(total_samples={}, total_steps={})..."
.
format
(
len
(
eval_dataset
),
total_steps
))
timer
=
Timer
()
timer
.
start
()
for
step
,
data
in
enumerate
(
loader
):
images
=
data
[
0
]
labels
=
data
[
1
].
astype
(
'int64'
)
...
...
@@ -113,8 +116,13 @@ def evaluate(model,
conf_mat
.
calculate
(
pred
=
pred
,
label
=
labels
,
ignore
=
mask
)
_
,
iou
=
conf_mat
.
mean_iou
()
logging
.
info
(
"[EVAL] Epoch={}, Step={}/{}, iou={}"
.
format
(
epoch_id
,
step
+
1
,
total_steps
,
iou
))
time_step
=
timer
.
elapsed_time
()
remain_step
=
total_steps
-
step
-
1
logging
.
info
(
"[EVAL] Epoch={}, Step={}/{}, iou={}, sec/step={:.4f} | ETA {}"
.
format
(
epoch_id
,
step
+
1
,
total_steps
,
iou
,
time_step
,
calculate_eta
(
remain_step
,
time_step
)))
timer
.
restart
()
category_iou
,
miou
=
conf_mat
.
mean_iou
()
category_acc
,
macc
=
conf_mat
.
accuracy
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录