Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
6d6f9317
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
6d6f9317
编写于
8月 29, 2018
作者:
G
guochaorong
提交者:
GitHub
8月 29, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1205 from baiyfbupt/ce
Refine ce
上级
c3ada25f
654b535a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
16 deletion
+16
-16
fluid/object_detection/_ce.py
fluid/object_detection/_ce.py
+5
-5
fluid/object_detection/train.py
fluid/object_detection/train.py
+11
-11
未找到文件。
fluid/object_detection/_ce.py
浏览文件 @
6d6f9317
...
@@ -8,11 +8,11 @@ from kpi import CostKpi, DurationKpi, AccKpi
...
@@ -8,11 +8,11 @@ from kpi import CostKpi, DurationKpi, AccKpi
#### NOTE kpi.py should shared in models in some way!!!!
#### NOTE kpi.py should shared in models in some way!!!!
train_cost_kpi
=
CostKpi
(
'train_cost'
,
0.02
,
0
,
actived
=
True
)
train_cost_kpi
=
CostKpi
(
'train_cost'
,
0.02
,
0
,
actived
=
True
)
test_acc_kpi
=
AccKpi
(
'test_acc'
,
0.01
,
0
,
actived
=
Fals
e
)
test_acc_kpi
=
AccKpi
(
'test_acc'
,
0.01
,
0
,
actived
=
Tru
e
)
train_speed_kpi
=
AccKpi
(
'train_speed'
,
0.
2
,
0
,
actived
=
Fals
e
)
train_speed_kpi
=
AccKpi
(
'train_speed'
,
0.
1
,
0
,
actived
=
Tru
e
)
train_cost_card4_kpi
=
CostKpi
(
'train_cost_card4'
,
0.02
,
0
,
actived
=
Fals
e
)
train_cost_card4_kpi
=
CostKpi
(
'train_cost_card4'
,
0.02
,
0
,
actived
=
Tru
e
)
test_acc_card4_kpi
=
AccKpi
(
'test_acc_card4'
,
0.01
,
0
,
actived
=
Fals
e
)
test_acc_card4_kpi
=
AccKpi
(
'test_acc_card4'
,
0.01
,
0
,
actived
=
Tru
e
)
train_speed_card4_kpi
=
AccKpi
(
'train_speed_card4'
,
0.
2
,
0
,
actived
=
True
)
train_speed_card4_kpi
=
AccKpi
(
'train_speed_card4'
,
0.
1
,
0
,
actived
=
True
)
tracking_kpis
=
[
tracking_kpis
=
[
train_cost_kpi
,
train_cost_kpi
,
...
...
fluid/object_detection/train.py
浏览文件 @
6d6f9317
...
@@ -45,9 +45,12 @@ def build_program(is_train, main_prog, startup_prog, args, data_args,
...
@@ -45,9 +45,12 @@ def build_program(is_train, main_prog, startup_prog, args, data_args,
num_classes
=
21
num_classes
=
21
def
get_optimizer
():
def
get_optimizer
():
optimizer
=
fluid
.
optimizer
.
RMSProp
(
if
not
args
.
enable_ce
:
learning_rate
=
fluid
.
layers
.
piecewise_decay
(
boundaries
,
values
),
optimizer
=
fluid
.
optimizer
.
RMSProp
(
regularization
=
fluid
.
regularizer
.
L2Decay
(
0.00005
),
)
learning_rate
=
fluid
.
layers
.
piecewise_decay
(
boundaries
,
values
),
regularization
=
fluid
.
regularizer
.
L2Decay
(
0.00005
),
)
else
:
optimizer
=
fluid
.
optimizer
.
RMSProp
(
learning_rate
=
0.001
)
return
optimizer
return
optimizer
with
fluid
.
program_guard
(
main_prog
,
startup_prog
):
with
fluid
.
program_guard
(
main_prog
,
startup_prog
):
...
@@ -197,12 +200,10 @@ def train(args,
...
@@ -197,12 +200,10 @@ def train(args,
print
(
"Pass {0}, test map {1}"
.
format
(
pass_id
,
test_map
))
print
(
"Pass {0}, test map {1}"
.
format
(
pass_id
,
test_map
))
return
best_map
,
mean_map
return
best_map
,
mean_map
total_time
=
0.0
for
pass_id
in
range
(
num_passes
):
for
pass_id
in
range
(
num_passes
):
epoch_idx
=
pass_id
+
1
batch_begin
=
time
.
time
()
start_time
=
time
.
time
()
start_time
=
time
.
time
()
train_py_reader
.
start
()
train_py_reader
.
start
()
prev_start_time
=
start_time
every_pass_loss
=
[]
every_pass_loss
=
[]
batch_id
=
0
batch_id
=
0
try
:
try
:
...
@@ -224,23 +225,22 @@ def train(args,
...
@@ -224,23 +225,22 @@ def train(args,
break
break
except
fluid
.
core
.
EOFException
:
except
fluid
.
core
.
EOFException
:
train_py_reader
.
reset
()
train_py_reader
.
reset
()
batch_end
=
time
.
time
()
end_time
=
time
.
time
()
best_map
,
mean_map
=
test
(
pass_id
,
best_map
)
best_map
,
mean_map
=
test
(
pass_id
,
best_map
)
if
args
.
enable_ce
and
pass_id
==
num_passes
-
1
:
if
args
.
enable_ce
and
pass_id
==
num_passes
-
1
:
total_time
+=
end_time
-
start_time
total_time
=
batch_end
-
batch_begin
train_avg_loss
=
np
.
mean
(
every_pass_loss
)
train_avg_loss
=
np
.
mean
(
every_pass_loss
)
if
devices_num
==
1
:
if
devices_num
==
1
:
print
(
"kpis train_cost %s"
%
train_avg_loss
)
print
(
"kpis train_cost %s"
%
train_avg_loss
)
print
(
"kpis test_acc %s"
%
mean_map
)
print
(
"kpis test_acc %s"
%
mean_map
)
print
(
"kpis train_speed %s"
%
(
total_time
/
epoch_idx
))
print
(
"kpis train_speed %s"
%
(
epocs
/
total_time
))
else
:
else
:
print
(
"kpis train_cost_card%s %s"
%
print
(
"kpis train_cost_card%s %s"
%
(
devices_num
,
train_avg_loss
))
(
devices_num
,
train_avg_loss
))
print
(
"kpis test_acc_card%s %s"
%
print
(
"kpis test_acc_card%s %s"
%
(
devices_num
,
mean_map
))
(
devices_num
,
mean_map
))
print
(
"kpis train_speed_card%s %f"
%
print
(
"kpis train_speed_card%s %f"
%
(
devices_num
,
t
otal_time
/
epoch_idx
))
(
devices_num
,
t
est_epocs
/
total_time
))
if
pass_id
%
10
==
0
or
pass_id
==
num_passes
-
1
:
if
pass_id
%
10
==
0
or
pass_id
==
num_passes
-
1
:
save_model
(
str
(
pass_id
),
train_prog
)
save_model
(
str
(
pass_id
),
train_prog
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录