Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleX
提交
a8926fb3
P
PaddleX
项目概览
PaddlePaddle
/
PaddleX
通知
136
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
43
列表
看板
标记
里程碑
合并请求
5
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
43
Issue
43
列表
看板
标记
里程碑
合并请求
5
合并请求
5
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a8926fb3
编写于
6月 02, 2020
作者:
J
jiangjiajun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify warmup error info
上级
15ca3ccf
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
47 addition
and
29 deletion
+47
-29
docs/appendix/parameters.md
docs/appendix/parameters.md
+1
-1
paddlex/cv/models/classifier.py
paddlex/cv/models/classifier.py
+5
-3
paddlex/cv/models/faster_rcnn.py
paddlex/cv/models/faster_rcnn.py
+14
-9
paddlex/cv/models/mask_rcnn.py
paddlex/cv/models/mask_rcnn.py
+14
-9
paddlex/cv/models/yolo_v3.py
paddlex/cv/models/yolo_v3.py
+13
-7
未找到文件。
docs/appendix/parameters.md
浏览文件 @
a8926fb3
...
...
@@ -38,7 +38,7 @@ Batch Size指模型在训练过程中,一次性处理的样本数量, 如若
`lr_decay_epochs`
用于让学习率在模型训练后期逐步衰减,它一般是一个list,如[6, 8, 10],表示学习率在第6个epoch时衰减一次,第8个epoch时再衰减一次,第10个epoch时再衰减一次。每次学习率衰减为之前的学习率
*
lr_decay_gamma
###
PaddleX中的warmup_steps和lr_decay_epochs
###
Notice
在PaddleX中,限制warmup需要在第一个学习率decay衰减前结束,因此要满足下面的公式
```
...
...
paddlex/cv/models/classifier.py
浏览文件 @
a8926fb3
...
...
@@ -96,10 +96,12 @@ class BaseClassifier(BaseAPI):
"In function train(), parameters should satisfy: warmup_steps <= lr_decay_epochs[0]*num_samples_in_train_dataset"
,
exit
=
False
)
logging
.
error
(
"See this doc for more information: xxxx"
,
exit
=
False
)
"See this doc for more information: https://github.com/PaddlePaddle/PaddleX/blob/develop/docs/appendix/parameters.md#notice"
,
exit
=
False
)
logging
.
error
(
"warmup_steps should less than {}, please modify 'lr_decay_epochs' or 'warmup_steps' in train function"
.
format
(
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
))
"warmup_steps should less than {} or lr_decay_epochs[0] greater than {}, please modify 'lr_decay_epochs' or 'warmup_steps' in train function"
.
format
(
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
,
warmup_steps
//
num_steps_each_epoch
))
lr_decay
=
fluid
.
layers
.
linear_lr_warmup
(
learning_rate
=
lr_decay
,
...
...
paddlex/cv/models/faster_rcnn.py
浏览文件 @
a8926fb3
...
...
@@ -138,8 +138,16 @@ class FasterRCNN(BaseAPI):
lr_decay_epochs
,
lr_decay_gamma
,
num_steps_each_epoch
):
if
warmup_steps
>
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
:
raise
Exception
(
"warmup_steps should less than {}"
.
format
(
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
))
logging
.
error
(
"In function train(), parameters should satisfy: warmup_steps <= lr_decay_epochs[0]*num_samples_in_train_dataset"
,
exit
=
False
)
logging
.
error
(
"See this doc for more information: https://github.com/PaddlePaddle/PaddleX/blob/develop/docs/appendix/parameters.md#notice"
,
exit
=
False
)
logging
.
error
(
"warmup_steps should less than {} or lr_decay_epochs[0] greater than {}, please modify 'lr_decay_epochs' or 'warmup_steps' in train function"
.
format
(
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
,
warmup_steps
//
num_steps_each_epoch
))
boundaries
=
[
b
*
num_steps_each_epoch
for
b
in
lr_decay_epochs
]
values
=
[(
lr_decay_gamma
**
i
)
*
learning_rate
for
i
in
range
(
len
(
lr_decay_epochs
)
+
1
)]
...
...
@@ -282,8 +290,7 @@ class FasterRCNN(BaseAPI):
eval_details为dict,包含关键字:'bbox',对应元素预测结果列表,每个预测结果由图像id、
预测框类别id、预测框坐标、预测框得分;’gt‘:真实标注框相关信息。
"""
self
.
arrange_transforms
(
transforms
=
eval_dataset
.
transforms
,
mode
=
'eval'
)
self
.
arrange_transforms
(
transforms
=
eval_dataset
.
transforms
,
mode
=
'eval'
)
if
metric
is
None
:
if
hasattr
(
self
,
'metric'
)
and
self
.
metric
is
not
None
:
metric
=
self
.
metric
...
...
@@ -302,14 +309,12 @@ class FasterRCNN(BaseAPI):
logging
.
warning
(
"Faster RCNN supports batch_size=1 only during evaluating, so batch_size is forced to be set to 1."
)
dataset
=
eval_dataset
.
generator
(
batch_size
=
batch_size
,
drop_last
=
False
)
dataset
=
eval_dataset
.
generator
(
batch_size
=
batch_size
,
drop_last
=
False
)
total_steps
=
math
.
ceil
(
eval_dataset
.
num_samples
*
1.0
/
batch_size
)
results
=
list
()
logging
.
info
(
"Start to evaluating(total_samples={}, total_steps={})..."
.
format
(
eval_dataset
.
num_samples
,
total_steps
))
logging
.
info
(
"Start to evaluating(total_samples={}, total_steps={})..."
.
format
(
eval_dataset
.
num_samples
,
total_steps
))
for
step
,
data
in
tqdm
.
tqdm
(
enumerate
(
dataset
()),
total
=
total_steps
):
images
=
np
.
array
([
d
[
0
]
for
d
in
data
]).
astype
(
'float32'
)
im_infos
=
np
.
array
([
d
[
1
]
for
d
in
data
]).
astype
(
'float32'
)
...
...
paddlex/cv/models/mask_rcnn.py
浏览文件 @
a8926fb3
...
...
@@ -97,8 +97,16 @@ class MaskRCNN(FasterRCNN):
lr_decay_epochs
,
lr_decay_gamma
,
num_steps_each_epoch
):
if
warmup_steps
>
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
:
raise
Exception
(
"warmup_step should less than {}"
.
format
(
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
))
logging
.
error
(
"In function train(), parameters should satisfy: warmup_steps <= lr_decay_epochs[0]*num_samples_in_train_dataset"
,
exit
=
False
)
logging
.
error
(
"See this doc for more information: https://github.com/PaddlePaddle/PaddleX/blob/develop/docs/appendix/parameters.md#notice"
,
exit
=
False
)
logging
.
error
(
"warmup_steps should less than {} or lr_decay_epochs[0] greater than {}, please modify 'lr_decay_epochs' or 'warmup_steps' in train function"
.
format
(
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
,
warmup_steps
//
num_steps_each_epoch
))
boundaries
=
[
b
*
num_steps_each_epoch
for
b
in
lr_decay_epochs
]
values
=
[(
lr_decay_gamma
**
i
)
*
learning_rate
for
i
in
range
(
len
(
lr_decay_epochs
)
+
1
)]
...
...
@@ -244,8 +252,7 @@ class MaskRCNN(FasterRCNN):
预测框坐标、预测框得分;'mask',对应元素预测区域结果列表,每个预测结果由图像id、
预测区域类别id、预测区域坐标、预测区域得分;’gt‘:真实标注框和标注区域相关信息。
"""
self
.
arrange_transforms
(
transforms
=
eval_dataset
.
transforms
,
mode
=
'eval'
)
self
.
arrange_transforms
(
transforms
=
eval_dataset
.
transforms
,
mode
=
'eval'
)
if
metric
is
None
:
if
hasattr
(
self
,
'metric'
)
and
self
.
metric
is
not
None
:
metric
=
self
.
metric
...
...
@@ -266,9 +273,8 @@ class MaskRCNN(FasterRCNN):
total_steps
=
math
.
ceil
(
eval_dataset
.
num_samples
*
1.0
/
batch_size
)
results
=
list
()
logging
.
info
(
"Start to evaluating(total_samples={}, total_steps={})..."
.
format
(
eval_dataset
.
num_samples
,
total_steps
))
logging
.
info
(
"Start to evaluating(total_samples={}, total_steps={})..."
.
format
(
eval_dataset
.
num_samples
,
total_steps
))
for
step
,
data
in
tqdm
.
tqdm
(
enumerate
(
data_generator
()),
total
=
total_steps
):
images
=
np
.
array
([
d
[
0
]
for
d
in
data
]).
astype
(
'float32'
)
...
...
@@ -310,8 +316,7 @@ class MaskRCNN(FasterRCNN):
zip
([
'bbox_map'
,
'segm_map'
],
[
ap_stats
[
0
][
1
],
ap_stats
[
1
][
1
]]))
else
:
metrics
=
OrderedDict
(
zip
([
'bbox_map'
,
'segm_map'
],
[
0.0
,
0.0
]))
metrics
=
OrderedDict
(
zip
([
'bbox_map'
,
'segm_map'
],
[
0.0
,
0.0
]))
elif
metric
==
'COCO'
:
if
isinstance
(
ap_stats
[
0
],
np
.
ndarray
)
and
isinstance
(
ap_stats
[
1
],
np
.
ndarray
):
...
...
paddlex/cv/models/yolo_v3.py
浏览文件 @
a8926fb3
...
...
@@ -128,8 +128,16 @@ class YOLOv3(BaseAPI):
lr_decay_epochs
,
lr_decay_gamma
,
num_steps_each_epoch
):
if
warmup_steps
>
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
:
raise
Exception
(
"warmup_steps should less than {}"
.
format
(
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
))
logging
.
error
(
"In function train(), parameters should satisfy: warmup_steps <= lr_decay_epochs[0]*num_samples_in_train_dataset"
,
exit
=
False
)
logging
.
error
(
"See this doc for more information: https://github.com/PaddlePaddle/PaddleX/blob/develop/docs/appendix/parameters.md#notice"
,
exit
=
False
)
logging
.
error
(
"warmup_steps should less than {} or lr_decay_epochs[0] greater than {}, please modify 'lr_decay_epochs' or 'warmup_steps' in train function"
.
format
(
lr_decay_epochs
[
0
]
*
num_steps_each_epoch
,
warmup_steps
//
num_steps_each_epoch
))
boundaries
=
[
b
*
num_steps_each_epoch
for
b
in
lr_decay_epochs
]
values
=
[(
lr_decay_gamma
**
i
)
*
learning_rate
for
i
in
range
(
len
(
lr_decay_epochs
)
+
1
)]
...
...
@@ -277,8 +285,7 @@ class YOLOv3(BaseAPI):
eval_details为dict,包含关键字:'bbox',对应元素预测结果列表,每个预测结果由图像id、
预测框类别id、预测框坐标、预测框得分;’gt‘:真实标注框相关信息。
"""
self
.
arrange_transforms
(
transforms
=
eval_dataset
.
transforms
,
mode
=
'eval'
)
self
.
arrange_transforms
(
transforms
=
eval_dataset
.
transforms
,
mode
=
'eval'
)
if
metric
is
None
:
if
hasattr
(
self
,
'metric'
)
and
self
.
metric
is
not
None
:
metric
=
self
.
metric
...
...
@@ -298,9 +305,8 @@ class YOLOv3(BaseAPI):
data_generator
=
eval_dataset
.
generator
(
batch_size
=
batch_size
,
drop_last
=
False
)
logging
.
info
(
"Start to evaluating(total_samples={}, total_steps={})..."
.
format
(
eval_dataset
.
num_samples
,
total_steps
))
logging
.
info
(
"Start to evaluating(total_samples={}, total_steps={})..."
.
format
(
eval_dataset
.
num_samples
,
total_steps
))
for
step
,
data
in
tqdm
.
tqdm
(
enumerate
(
data_generator
()),
total
=
total_steps
):
images
=
np
.
array
([
d
[
0
]
for
d
in
data
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录