Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
e6c2cb83
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看板
提交
e6c2cb83
编写于
1月 08, 2019
作者:
Z
zhengya01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ce
上级
3d8f79d6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
16 deletion
+13
-16
fluid/PaddleCV/faster_rcnn/.run_ce.sh
fluid/PaddleCV/faster_rcnn/.run_ce.sh
+2
-2
fluid/PaddleCV/faster_rcnn/train.py
fluid/PaddleCV/faster_rcnn/train.py
+11
-14
未找到文件。
fluid/PaddleCV/faster_rcnn/.run_ce.sh
浏览文件 @
e6c2cb83
...
...
@@ -7,11 +7,11 @@ export OMP_NUM_THREADS=1
cudaid
=
${
face_detection
:
=0
}
# use 0-th card as default
export
CUDA_VISIBLE_DEVICES
=
$cudaid
FLAGS_benchmark
=
true
python train.py
--model_save_dir
=
output/
--data_dir
=
dataset/coco/
--max_iter
=
20
--enable_ce
| python _ce.py
FLAGS_benchmark
=
true
python train.py
--model_save_dir
=
output/
--data_dir
=
dataset/coco/
--max_iter
=
20
--enable_ce
--pretrained_model
=
./imagenet_resnet50_fusebn
| python _ce.py
cudaid
=
${
face_detection_m
:
=0,1,2,3
}
# use 0,1,2,3 card as default
export
CUDA_VISIBLE_DEVICES
=
$cudaid
FLAGS_benchmark
=
true
python train.py
--model_save_dir
=
output/
--data_dir
=
dataset/coco/
--max_iter
=
20
--enable_ce
| python _ce.py
FLAGS_benchmark
=
true
python train.py
--model_save_dir
=
output/
--data_dir
=
dataset/coco/
--max_iter
=
20
--enable_ce
--pretrained_model
=
./imagenet_resnet50_fusebn
| python _ce.py
fluid/PaddleCV/faster_rcnn/train.py
浏览文件 @
e6c2cb83
...
...
@@ -46,11 +46,14 @@ def train():
devices_num
=
len
(
devices
.
split
(
","
))
total_batch_size
=
devices_num
*
cfg
.
TRAIN
.
im_per_batch
use_random
=
True
if
cfg
.
enable_ce
:
use_random
=
False
model
=
model_builder
.
FasterRCNN
(
add_conv_body_func
=
resnet
.
add_ResNet50_conv4_body
,
add_roi_box_head_func
=
resnet
.
add_ResNet_roi_conv5_head
,
use_pyreader
=
cfg
.
use_pyreader
,
use_random
=
True
)
use_random
=
use_random
)
model
.
build_model
(
image_shape
)
loss_cls
,
loss_bbox
,
rpn_cls_loss
,
rpn_reg_loss
=
model
.
loss
()
loss_cls
.
persistable
=
True
...
...
@@ -92,16 +95,19 @@ def train():
train_exe
=
fluid
.
ParallelExecutor
(
use_cuda
=
bool
(
cfg
.
use_gpu
),
loss_name
=
loss
.
name
)
shuffle
=
True
if
cfg
.
enable_ce
:
shuffle
=
False
if
cfg
.
use_pyreader
:
train_reader
=
reader
.
train
(
batch_size
=
cfg
.
TRAIN
.
im_per_batch
,
total_batch_size
=
total_batch_size
,
padding_total
=
cfg
.
TRAIN
.
padding_minibatch
,
shuffle
=
Tru
e
)
shuffle
=
shuffl
e
)
py_reader
=
model
.
py_reader
py_reader
.
decorate_paddle_reader
(
train_reader
)
else
:
train_reader
=
reader
.
train
(
batch_size
=
total_batch_size
,
shuffle
=
Tru
e
)
train_reader
=
reader
.
train
(
batch_size
=
total_batch_size
,
shuffle
=
shuffl
e
)
feeder
=
fluid
.
DataFeeder
(
place
=
place
,
feed_list
=
model
.
feeds
())
def
save_model
(
postfix
):
...
...
@@ -142,7 +148,7 @@ def train():
save_model
(
"model_iter{}"
.
format
(
iter_id
))
# only for ce
if
cfg
.
enable_ce
:
gpu_num
=
get_cards
(
cfg
)
gpu_num
=
devices_num
epoch_idx
=
iter_id
+
1
loss
=
last_loss
print
(
"kpis
\t
each_pass_duration_card%s
\t
%s"
%
...
...
@@ -185,7 +191,7 @@ def train():
break
# only for ce
if
cfg
.
enable_ce
:
gpu_num
=
get_cards
(
cfg
)
gpu_num
=
devices_num
epoch_idx
=
iter_id
+
1
loss
=
last_loss
print
(
"kpis
\t
each_pass_duration_card%s
\t
%s"
%
...
...
@@ -202,15 +208,6 @@ def train():
save_model
(
'model_final'
)
def
get_cards
(
cfg
):
if
cfg
.
enable_ce
:
cards
=
os
.
environ
.
get
(
'CUDA_VISIBLE_DEVICES'
)
num
=
len
(
cards
.
split
(
","
))
return
num
else
:
return
cfg
.
num_devices
if
__name__
==
'__main__'
:
args
=
parse_args
()
print_arguments
(
args
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录