Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
1e417485
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
1e417485
编写于
10月 20, 2020
作者:
W
wangguanzhong
提交者:
GitHub
10月 20, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update for paddle 2.0rc (#1583)
上级
6ac9743c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
16 addition
and
20 deletion
+16
-20
configs/yolov3_reader.yml
configs/yolov3_reader.yml
+1
-1
ppdet/modeling/head/yolo_head.py
ppdet/modeling/head/yolo_head.py
+1
-1
tools/train.py
tools/train.py
+14
-18
未找到文件。
configs/yolov3_reader.yml
浏览文件 @
1e417485
...
@@ -52,7 +52,7 @@ TrainReader:
...
@@ -52,7 +52,7 @@ TrainReader:
drop_last
:
true
drop_last
:
true
worker_num
:
4
worker_num
:
4
bufsize
:
4
bufsize
:
4
use_process
:
true
use_process
:
false
#
true
EvalReader
:
EvalReader
:
...
...
ppdet/modeling/head/yolo_head.py
浏览文件 @
1e417485
...
@@ -92,7 +92,7 @@ class YOLOFeat(nn.Layer):
...
@@ -92,7 +92,7 @@ class YOLOFeat(nn.Layer):
if
i
<
self
.
num_levels
-
1
:
if
i
<
self
.
num_levels
-
1
:
route
=
self
.
route_blocks
[
i
](
route
)
route
=
self
.
route_blocks
[
i
](
route
)
route
=
F
.
resize_nearest
(
route
,
scale
=
2.
)
route
=
F
.
interpolate
(
route
,
scale_factor
=
2.
)
return
yolo_feats
return
yolo_feats
...
...
tools/train.py
浏览文件 @
1e417485
...
@@ -23,7 +23,7 @@ from ppdet.utils.stats import TrainingStats
...
@@ -23,7 +23,7 @@ from ppdet.utils.stats import TrainingStats
from
ppdet.utils.check
import
check_gpu
,
check_version
,
check_config
from
ppdet.utils.check
import
check_gpu
,
check_version
,
check_config
from
ppdet.utils.cli
import
ArgsParser
from
ppdet.utils.cli
import
ArgsParser
from
ppdet.utils.checkpoint
import
load_dygraph_ckpt
,
save_dygraph_ckpt
from
ppdet.utils.checkpoint
import
load_dygraph_ckpt
,
save_dygraph_ckpt
from
paddle.distributed
import
ParallelEnv
import
paddle.distributed
as
dist
import
logging
import
logging
FORMAT
=
'%(asctime)s-%(levelname)s: %(message)s'
FORMAT
=
'%(asctime)s-%(levelname)s: %(message)s'
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
FORMAT
)
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
FORMAT
)
...
@@ -87,8 +87,16 @@ def parse_args():
...
@@ -87,8 +87,16 @@ def parse_args():
return
args
return
args
def
run
(
FLAGS
,
cfg
):
def
run
():
FLAGS
=
parse_args
()
cfg
=
load_config
(
FLAGS
.
config
)
merge_config
(
FLAGS
.
opt
)
check_config
(
cfg
)
check_gpu
(
cfg
.
use_gpu
)
check_version
()
env
=
os
.
environ
env
=
os
.
environ
FLAGS
.
dist
=
'PADDLE_TRAINER_ID'
in
env
and
'PADDLE_TRAINERS_NUM'
in
env
FLAGS
.
dist
=
'PADDLE_TRAINER_ID'
in
env
and
'PADDLE_TRAINERS_NUM'
in
env
if
FLAGS
.
dist
:
if
FLAGS
.
dist
:
trainer_id
=
int
(
env
[
'PADDLE_TRAINER_ID'
])
trainer_id
=
int
(
env
[
'PADDLE_TRAINER_ID'
])
...
@@ -117,7 +125,7 @@ def run(FLAGS, cfg):
...
@@ -117,7 +125,7 @@ def run(FLAGS, cfg):
load_static_weights
=
cfg
.
get
(
'load_static_weights'
,
False
))
load_static_weights
=
cfg
.
get
(
'load_static_weights'
,
False
))
# Parallel Model
# Parallel Model
if
ParallelEnv
().
nranks
>
1
:
if
dist
.
ParallelEnv
().
nranks
>
1
:
strategy
=
paddle
.
distributed
.
init_parallel_env
()
strategy
=
paddle
.
distributed
.
init_parallel_env
()
model
=
paddle
.
DataParallel
(
model
,
strategy
)
model
=
paddle
.
DataParallel
(
model
,
strategy
)
...
@@ -151,7 +159,7 @@ def run(FLAGS, cfg):
...
@@ -151,7 +159,7 @@ def run(FLAGS, cfg):
# Model Backward
# Model Backward
loss
=
outputs
[
'loss'
]
loss
=
outputs
[
'loss'
]
if
ParallelEnv
().
nranks
>
1
:
if
dist
.
ParallelEnv
().
nranks
>
1
:
loss
=
model
.
scale_loss
(
loss
)
loss
=
model
.
scale_loss
(
loss
)
loss
.
backward
()
loss
.
backward
()
model
.
apply_collective_grads
()
model
.
apply_collective_grads
()
...
@@ -163,7 +171,7 @@ def run(FLAGS, cfg):
...
@@ -163,7 +171,7 @@ def run(FLAGS, cfg):
lr
.
step
()
lr
.
step
()
optimizer
.
clear_grad
()
optimizer
.
clear_grad
()
if
ParallelEnv
().
nranks
<
2
or
ParallelEnv
().
local_rank
==
0
:
if
dist
.
ParallelEnv
().
nranks
<
2
or
dist
.
ParallelEnv
().
local_rank
==
0
:
# Log state
# Log state
if
iter_id
==
0
:
if
iter_id
==
0
:
train_stats
=
TrainingStats
(
cfg
.
log_iter
,
outputs
.
keys
())
train_stats
=
TrainingStats
(
cfg
.
log_iter
,
outputs
.
keys
())
...
@@ -185,19 +193,7 @@ def run(FLAGS, cfg):
...
@@ -185,19 +193,7 @@ def run(FLAGS, cfg):
def
main
():
def
main
():
FLAGS
=
parse_args
()
dist
.
spawn
(
run
)
cfg
=
load_config
(
FLAGS
.
config
)
merge_config
(
FLAGS
.
opt
)
check_config
(
cfg
)
check_gpu
(
cfg
.
use_gpu
)
check_version
()
place
=
paddle
.
CUDAPlace
(
ParallelEnv
().
dev_id
)
\
if
cfg
.
use_gpu
else
paddle
.
CPUPlace
()
paddle
.
disable_static
(
place
)
run
(
FLAGS
,
cfg
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录