Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
553659a5
M
models
项目概览
PaddlePaddle
/
models
大约 2 年 前同步成功
通知
232
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看板
未验证
提交
553659a5
编写于
7月 01, 2019
作者:
C
chengduo
提交者:
GitHub
7月 01, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
yolov3 is a special model, if num_trainers > 1, each process trian the completed dataset (#2605)
上级
931b0135
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
12 deletion
+13
-12
PaddleCV/yolov3/reader.py
PaddleCV/yolov3/reader.py
+9
-7
PaddleCV/yolov3/train.py
PaddleCV/yolov3/train.py
+4
-5
未找到文件。
PaddleCV/yolov3/reader.py
浏览文件 @
553659a5
...
@@ -272,13 +272,15 @@ class DataSetReader(object):
...
@@ -272,13 +272,15 @@ class DataSetReader(object):
batch_out
=
[(
im
,
im_id
,
im_shape
)]
batch_out
=
[(
im
,
im_id
,
im_shape
)]
yield
batch_out
yield
batch_out
num_trainers
=
int
(
os
.
environ
.
get
(
'PADDLE_TRAINERS_NUM'
,
1
))
# NOTE: yolov3 is a special model, if num_trainers > 1, each process
if
mode
==
'train'
and
num_trainers
>
1
:
# trian the completed dataset.
assert
shuffle_seed
is
not
None
,
\
# num_trainers = int(os.environ.get('PADDLE_TRAINERS_NUM', 1))
"If num_trainers > 1, the shuffle_seed must be set, because "
\
# if mode == 'train' and num_trainers > 1:
"the order of batch data generated by reader "
\
# assert shuffle_seed is not None, \
"must be the same in the respective processes."
# "If num_trainers > 1, the shuffle_seed must be set, because " \
reader
=
fluid
.
contrib
.
reader
.
distributed_batch_reader
(
reader
)
# "the order of batch data generated by reader " \
# "must be the same in the respective processes."
# reader = fluid.contrib.reader.distributed_batch_reader(reader)
return
reader
return
reader
...
...
PaddleCV/yolov3/train.py
浏览文件 @
553659a5
...
@@ -47,7 +47,6 @@ import dist_utils
...
@@ -47,7 +47,6 @@ import dist_utils
num_trainers
=
int
(
os
.
environ
.
get
(
'PADDLE_TRAINERS_NUM'
,
1
))
num_trainers
=
int
(
os
.
environ
.
get
(
'PADDLE_TRAINERS_NUM'
,
1
))
def
get_device_num
():
def
get_device_num
():
# NOTE(zcd): for multi-processe training, each process use one GPU card.
# NOTE(zcd): for multi-processe training, each process use one GPU card.
if
num_trainers
>
1
:
return
1
if
num_trainers
>
1
:
return
1
...
@@ -141,10 +140,10 @@ def train():
...
@@ -141,10 +140,10 @@ def train():
shuffle
=
True
shuffle
=
True
if
args
.
enable_ce
:
if
args
.
enable_ce
:
shuffle
=
False
shuffle
=
False
# NOTE: If num_trainers > 1, the shuffle_seed must be set, becaus
e
shuffle_seed
=
Non
e
#
the order of batch data generated by reader
#
NOTE: yolov3 is a special model, if num_trainers > 1, each process
#
must be the same in the respective processes
.
#
trian the completed dataset
.
shuffle_seed
=
1
if
num_trainers
>
1
else
None
# if num_trainers > 1: shuffle_seed = 1
train_reader
=
reader
.
train
(
train_reader
=
reader
.
train
(
input_size
,
input_size
,
batch_size
=
cfg
.
batch_size
,
batch_size
=
cfg
.
batch_size
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录