Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
1e7557f1
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看板
提交
1e7557f1
编写于
8月 16, 2018
作者:
D
Dang Qingqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update CE.
上级
84e4cbba
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
14 addition
and
16 deletion
+14
-16
fluid/image_classification/_ce.py
fluid/image_classification/_ce.py
+11
-11
fluid/image_classification/train.py
fluid/image_classification/train.py
+3
-5
未找到文件。
fluid/image_classification/_ce.py
浏览文件 @
1e7557f1
...
@@ -7,14 +7,14 @@ from kpi import CostKpi, DurationKpi, AccKpi
...
@@ -7,14 +7,14 @@ 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_acc_top1_kpi
=
AccKpi
(
'train_acc_top1'
,
0.05
,
0
,
desc
=
'TOP1 ACC'
)
train_acc_top1_kpi
=
AccKpi
(
'train_acc_top1'
,
0.0
0
5
,
0
,
desc
=
'TOP1 ACC'
)
train_acc_top5_kpi
=
AccKpi
(
train_acc_top5_kpi
=
AccKpi
(
'train_acc_top5'
,
0.0
5
,
0
,
actived
=
Fals
e
,
desc
=
'TOP5 ACC'
)
'train_acc_top5'
,
0.0
05
,
0
,
actived
=
Tru
e
,
desc
=
'TOP5 ACC'
)
train_cost_kpi
=
CostKpi
(
'train_cost'
,
0.5
,
0
,
actived
=
True
,
desc
=
'train cost'
)
train_cost_kpi
=
CostKpi
(
'train_cost'
,
0.5
,
0
,
actived
=
True
,
desc
=
'train cost'
)
test_acc_top1_kpi
=
AccKpi
(
'test_acc_top1'
,
0.05
,
0
,
desc
=
'TOP1 ACC'
)
test_acc_top1_kpi
=
AccKpi
(
'test_acc_top1'
,
0.0
0
5
,
0
,
desc
=
'TOP1 ACC'
)
test_acc_top5_kpi
=
AccKpi
(
test_acc_top5_kpi
=
AccKpi
(
'test_acc_top5'
,
0.0
5
,
0
,
actived
=
Fals
e
,
desc
=
'TOP5 ACC'
)
'test_acc_top5'
,
0.0
05
,
0
,
actived
=
Tru
e
,
desc
=
'TOP5 ACC'
)
test_cost_kpi
=
CostKpi
(
'test_cost'
,
1.0
,
0
,
actived
=
True
,
desc
=
'train cost'
)
test_cost_kpi
=
CostKpi
(
'test_cost'
,
0.005
,
0
,
actived
=
True
,
desc
=
'train cost'
)
train_speed_kpi
=
AccKpi
(
train_speed_kpi
=
AccKpi
(
'train_speed'
,
'train_speed'
,
0.5
,
0.5
,
...
@@ -23,17 +23,17 @@ train_speed_kpi = AccKpi(
...
@@ -23,17 +23,17 @@ train_speed_kpi = AccKpi(
unit_repr
=
'seconds/image'
,
unit_repr
=
'seconds/image'
,
desc
=
'train speed in one GPU card'
)
desc
=
'train speed in one GPU card'
)
train_acc_top1_card4_kpi
=
AccKpi
(
train_acc_top1_card4_kpi
=
AccKpi
(
'train_acc_top1_card4'
,
0.05
,
0
,
desc
=
'TOP1 ACC'
)
'train_acc_top1_card4'
,
0.0
0
5
,
0
,
desc
=
'TOP1 ACC'
)
train_acc_top5_card4_kpi
=
AccKpi
(
train_acc_top5_card4_kpi
=
AccKpi
(
'train_acc_top5_card4'
,
0.0
5
,
0
,
actived
=
Fals
e
,
desc
=
'TOP5 ACC'
)
'train_acc_top5_card4'
,
0.0
05
,
0
,
actived
=
Tru
e
,
desc
=
'TOP5 ACC'
)
train_cost_card4_kpi
=
CostKpi
(
train_cost_card4_kpi
=
CostKpi
(
'train_cost_kpi'
,
0.
3
,
0
,
actived
=
True
,
desc
=
'train cost'
)
'train_cost_kpi'
,
0.
005
,
0
,
actived
=
True
,
desc
=
'train cost'
)
test_acc_top1_card4_kpi
=
AccKpi
(
test_acc_top1_card4_kpi
=
AccKpi
(
'test_acc_top1_card4'
,
0.05
,
0
,
desc
=
'TOP1 ACC'
)
'test_acc_top1_card4'
,
0.0
0
5
,
0
,
desc
=
'TOP1 ACC'
)
test_acc_top5_card4_kpi
=
AccKpi
(
test_acc_top5_card4_kpi
=
AccKpi
(
'test_acc_top5_card4'
,
0.0
5
,
0
,
actived
=
Fals
e
,
desc
=
'TOP5 ACC'
)
'test_acc_top5_card4'
,
0.0
05
,
0
,
actived
=
Tru
e
,
desc
=
'TOP5 ACC'
)
test_cost_card4_kpi
=
CostKpi
(
test_cost_card4_kpi
=
CostKpi
(
'test_cost_card4'
,
1.0
,
0
,
actived
=
True
,
desc
=
'train cost'
)
'test_cost_card4'
,
0.005
,
0
,
actived
=
True
,
desc
=
'train cost'
)
train_speed_card4_kpi
=
AccKpi
(
train_speed_card4_kpi
=
AccKpi
(
'train_speed_card4'
,
'train_speed_card4'
,
0.5
,
0.5
,
...
...
fluid/image_classification/train.py
浏览文件 @
1e7557f1
...
@@ -104,6 +104,8 @@ def train(args):
...
@@ -104,6 +104,8 @@ def train(args):
if
args
.
enable_ce
:
if
args
.
enable_ce
:
assert
model_name
==
"SE_ResNeXt50_32x4d"
assert
model_name
==
"SE_ResNeXt50_32x4d"
fluid
.
default_startup_program
().
random_seed
=
1000
model
.
params
[
"dropout_seed"
]
=
100
if
model_name
is
"GoogleNet"
:
if
model_name
is
"GoogleNet"
:
out0
,
out1
,
out2
=
model
.
net
(
input
=
image
,
class_dim
=
class_dim
)
out0
,
out1
,
out2
=
model
.
net
(
input
=
image
,
class_dim
=
class_dim
)
...
@@ -134,8 +136,6 @@ def train(args):
...
@@ -134,8 +136,6 @@ def train(args):
params
[
"num_epochs"
]
=
args
.
num_epochs
params
[
"num_epochs"
]
=
args
.
num_epochs
params
[
"learning_strategy"
][
"batch_size"
]
=
args
.
batch_size
params
[
"learning_strategy"
][
"batch_size"
]
=
args
.
batch_size
params
[
"learning_strategy"
][
"name"
]
=
args
.
lr_strategy
params
[
"learning_strategy"
][
"name"
]
=
args
.
lr_strategy
if
args
.
enable_ce
:
params
[
"dropout_seed"
]
=
10
# initialize optimizer
# initialize optimizer
optimizer
=
optimizer_setting
(
params
)
optimizer
=
optimizer_setting
(
params
)
...
@@ -144,9 +144,6 @@ def train(args):
...
@@ -144,9 +144,6 @@ def train(args):
if
with_memory_optimization
:
if
with_memory_optimization
:
fluid
.
memory_optimize
(
fluid
.
default_main_program
())
fluid
.
memory_optimize
(
fluid
.
default_main_program
())
if
args
.
enable_ce
:
fluid
.
default_startup_program
().
random_seed
=
1000
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
exe
.
run
(
fluid
.
default_startup_program
())
exe
.
run
(
fluid
.
default_startup_program
())
...
@@ -172,6 +169,7 @@ def train(args):
...
@@ -172,6 +169,7 @@ def train(args):
# but it is time consuming. For faster speed, need another dataset.
# but it is time consuming. For faster speed, need another dataset.
import
random
import
random
random
.
seed
(
0
)
random
.
seed
(
0
)
np
.
random
.
seed
(
0
)
train_reader
=
paddle
.
batch
(
train_reader
=
paddle
.
batch
(
flowers
.
train
(
use_xmap
=
False
),
batch_size
=
train_batch_size
)
flowers
.
train
(
use_xmap
=
False
),
batch_size
=
train_batch_size
)
test_reader
=
paddle
.
batch
(
test_reader
=
paddle
.
batch
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录