Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
5d45eb06
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
5d45eb06
编写于
4月 16, 2019
作者:
K
Kaipeng Deng
提交者:
GitHub
4月 16, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16858 from heavengate/fix_yolo_param
Fix yolo param
上级
102fc859
7b1702d9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
25 deletion
+25
-25
paddle/fluid/API.spec
paddle/fluid/API.spec
+1
-1
python/paddle/fluid/layers/detection.py
python/paddle/fluid/layers/detection.py
+18
-18
python/paddle/fluid/tests/test_detection.py
python/paddle/fluid/tests/test_detection.py
+6
-6
未找到文件。
paddle/fluid/API.spec
浏览文件 @
5d45eb06
...
...
@@ -358,7 +358,7 @@ paddle.fluid.layers.generate_mask_labels (ArgSpec(args=['im_info', 'gt_classes',
paddle.fluid.layers.iou_similarity (ArgSpec(args=['x', 'y', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '587845f60c5d97ffdf2dfd21da52eca1'))
paddle.fluid.layers.box_coder (ArgSpec(args=['prior_box', 'prior_box_var', 'target_box', 'code_type', 'box_normalized', 'name', 'axis'], varargs=None, keywords=None, defaults=('encode_center_size', True, None, 0)), ('document', '032d0f4b7d8f6235ee5d91e473344f0e'))
paddle.fluid.layers.polygon_box_transform (ArgSpec(args=['input', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '0e5ac2507723a0b5adec473f9556799b'))
paddle.fluid.layers.yolov3_loss (ArgSpec(args=['x', 'gt
box', 'gtlabel', 'anchors', 'anchor_mask', 'class_num', 'ignore_thresh', 'downsample_ratio', 'gtscore', 'use_label_smooth', 'name'], varargs=None, keywords=None, defaults=(None, True, None)), ('document', '57fa96922e42db8f064c3fb77f2255e8
'))
paddle.fluid.layers.yolov3_loss (ArgSpec(args=['x', 'gt
_box', 'gt_label', 'anchors', 'anchor_mask', 'class_num', 'ignore_thresh', 'downsample_ratio', 'gt_score', 'use_label_smooth', 'name'], varargs=None, keywords=None, defaults=(None, True, None)), ('document', '059021025283ad1ee6f4d32228cf3e4e
'))
paddle.fluid.layers.yolo_box (ArgSpec(args=['x', 'img_size', 'anchors', 'class_num', 'conf_thresh', 'downsample_ratio', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '5566169a5ab993d177792c023c7fb340'))
paddle.fluid.layers.box_clip (ArgSpec(args=['input', 'im_info', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '397e9e02b451d99c56e20f268fa03f2e'))
paddle.fluid.layers.multiclass_nms (ArgSpec(args=['bboxes', 'scores', 'score_threshold', 'nms_top_k', 'keep_top_k', 'nms_threshold', 'normalized', 'nms_eta', 'background_label', 'name'], varargs=None, keywords=None, defaults=(0.3, True, 1.0, 0, None)), ('document', 'ca7d1107b6c5d2d6d8221039a220fde0'))
...
...
python/paddle/fluid/layers/detection.py
浏览文件 @
5d45eb06
...
...
@@ -509,14 +509,14 @@ def polygon_box_transform(input, name=None):
@
templatedoc
(
op_type
=
"yolov3_loss"
)
def
yolov3_loss
(
x
,
gtbox
,
gtlabel
,
gt
_
box
,
gt
_
label
,
anchors
,
anchor_mask
,
class_num
,
ignore_thresh
,
downsample_ratio
,
gtscore
=
None
,
gt
_
score
=
None
,
use_label_smooth
=
True
,
name
=
None
):
"""
...
...
@@ -524,12 +524,12 @@ def yolov3_loss(x,
Args:
x (Variable): ${x_comment}
gtbox (Variable): groud truth boxes, should be in shape of [N, B, 4],
gt
_
box (Variable): groud truth boxes, should be in shape of [N, B, 4],
in the third dimenstion, x, y, w, h should be stored
and x, y, w, h should be relative value of input image.
N is the batch number and B is the max box number in
an image.
gtlabel (Variable): class id of ground truth boxes, shoud be in shape
gt
_
label (Variable): class id of ground truth boxes, shoud be in shape
of [N, B].
anchors (list|tuple): ${anchors_comment}
anchor_mask (list|tuple): ${anchor_mask_comment}
...
...
@@ -537,7 +537,7 @@ def yolov3_loss(x,
ignore_thresh (float): ${ignore_thresh_comment}
downsample_ratio (int): ${downsample_ratio_comment}
name (string): the name of yolov3 loss. Default None.
gtscore (Variable): mixup score of ground truth boxes, shoud be in shape
gt
_
score (Variable): mixup score of ground truth boxes, shoud be in shape
of [N, B]. Default None.
use_label_smooth (bool): ${use_label_smooth_comment}
...
...
@@ -558,13 +558,13 @@ def yolov3_loss(x,
.. code-block:: python
x = fluid.layers.data(name='x', shape=[255, 13, 13], dtype='float32')
gt
box = fluid.layers.data(name='gt
box', shape=[6, 4], dtype='float32')
gt
label = fluid.layers.data(name='gt
label', shape=[6], dtype='int32')
gt
score = fluid.layers.data(name='gt
score', shape=[6], dtype='float32')
gt
_box = fluid.layers.data(name='gt_
box', shape=[6, 4], dtype='float32')
gt
_label = fluid.layers.data(name='gt_
label', shape=[6], dtype='int32')
gt
_score = fluid.layers.data(name='gt_
score', shape=[6], dtype='float32')
anchors = [10, 13, 16, 30, 33, 23, 30, 61, 62, 45, 59, 119, 116, 90, 156, 198, 373, 326]
anchor_mask = [0, 1, 2]
loss = fluid.layers.yolov3_loss(x=x, gt
box=gtbox, gtlabel=gt
label,
gt
score=gt
score, anchors=anchors,
loss = fluid.layers.yolov3_loss(x=x, gt
_box=gt_box, gt_label=gt_
label,
gt
_score=gt_
score, anchors=anchors,
anchor_mask=anchor_mask, class_num=80,
ignore_thresh=0.7, downsample_ratio=32)
"""
...
...
@@ -572,11 +572,11 @@ def yolov3_loss(x,
if
not
isinstance
(
x
,
Variable
):
raise
TypeError
(
"Input x of yolov3_loss must be Variable"
)
if
not
isinstance
(
gtbox
,
Variable
):
if
not
isinstance
(
gt
_
box
,
Variable
):
raise
TypeError
(
"Input gtbox of yolov3_loss must be Variable"
)
if
not
isinstance
(
gtlabel
,
Variable
):
if
not
isinstance
(
gt
_
label
,
Variable
):
raise
TypeError
(
"Input gtlabel of yolov3_loss must be Variable"
)
if
gt
score
is
not
None
and
not
isinstance
(
gt
score
,
Variable
):
if
gt
_score
is
not
None
and
not
isinstance
(
gt_
score
,
Variable
):
raise
TypeError
(
"Input gtscore of yolov3_loss must be Variable"
)
if
not
isinstance
(
anchors
,
list
)
and
not
isinstance
(
anchors
,
tuple
):
raise
TypeError
(
"Attr anchors of yolov3_loss must be list or tuple"
)
...
...
@@ -602,11 +602,11 @@ def yolov3_loss(x,
inputs
=
{
"X"
:
x
,
"GTBox"
:
gtbox
,
"GTLabel"
:
gtlabel
,
"GTBox"
:
gt
_
box
,
"GTLabel"
:
gt
_
label
,
}
if
gtscore
:
inputs
[
"GTScore"
]
=
gtscore
if
gt
_
score
:
inputs
[
"GTScore"
]
=
gt
_
score
attrs
=
{
"anchors"
:
anchors
,
...
...
python/paddle/fluid/tests/test_detection.py
浏览文件 @
5d45eb06
...
...
@@ -474,17 +474,17 @@ class TestYoloDetection(unittest.TestCase):
program
=
Program
()
with
program_guard
(
program
):
x
=
layers
.
data
(
name
=
'x'
,
shape
=
[
30
,
7
,
7
],
dtype
=
'float32'
)
gt
box
=
layers
.
data
(
name
=
'gt
box'
,
shape
=
[
10
,
4
],
dtype
=
'float32'
)
gt
label
=
layers
.
data
(
name
=
'gt
label'
,
shape
=
[
10
],
dtype
=
'int32'
)
gt
score
=
layers
.
data
(
name
=
'gt
score'
,
shape
=
[
10
],
dtype
=
'float32'
)
gt
_box
=
layers
.
data
(
name
=
'gt_
box'
,
shape
=
[
10
,
4
],
dtype
=
'float32'
)
gt
_label
=
layers
.
data
(
name
=
'gt_
label'
,
shape
=
[
10
],
dtype
=
'int32'
)
gt
_score
=
layers
.
data
(
name
=
'gt_
score'
,
shape
=
[
10
],
dtype
=
'float32'
)
loss
=
layers
.
yolov3_loss
(
x
,
gtbox
,
gtlabel
,
[
10
,
13
,
30
,
13
],
[
0
,
1
],
gt
_
box
,
gt
_
label
,
[
10
,
13
,
30
,
13
],
[
0
,
1
],
10
,
0.7
,
32
,
gt
score
=
gt
score
,
gt
_score
=
gt_
score
,
use_label_smooth
=
False
)
self
.
assertIsNotNone
(
loss
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录