Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
b1e7799b
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看板
提交
b1e7799b
编写于
4月 15, 2019
作者:
D
dengkaipeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix yolov3_loss param name. test=develop
上级
1237dfa6
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
17 addition
and
17 deletion
+17
-17
python/paddle/fluid/layers/detection.py
python/paddle/fluid/layers/detection.py
+17
-17
未找到文件。
python/paddle/fluid/layers/detection.py
浏览文件 @
b1e7799b
...
@@ -509,14 +509,14 @@ def polygon_box_transform(input, name=None):
...
@@ -509,14 +509,14 @@ def polygon_box_transform(input, name=None):
@
templatedoc
(
op_type
=
"yolov3_loss"
)
@
templatedoc
(
op_type
=
"yolov3_loss"
)
def
yolov3_loss
(
x
,
def
yolov3_loss
(
x
,
gtbox
,
gt
_
box
,
gtlabel
,
gt
_
label
,
anchors
,
anchors
,
anchor_mask
,
anchor_mask
,
class_num
,
class_num
,
ignore_thresh
,
ignore_thresh
,
downsample_ratio
,
downsample_ratio
,
gtscore
=
None
,
gt
_
score
=
None
,
use_label_smooth
=
True
,
use_label_smooth
=
True
,
name
=
None
):
name
=
None
):
"""
"""
...
@@ -524,12 +524,12 @@ def yolov3_loss(x,
...
@@ -524,12 +524,12 @@ def yolov3_loss(x,
Args:
Args:
x (Variable): ${x_comment}
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
in the third dimenstion, x, y, w, h should be stored
and x, y, w, h should be relative value of input image.
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
N is the batch number and B is the max box number in
an image.
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].
of [N, B].
anchors (list|tuple): ${anchors_comment}
anchors (list|tuple): ${anchors_comment}
anchor_mask (list|tuple): ${anchor_mask_comment}
anchor_mask (list|tuple): ${anchor_mask_comment}
...
@@ -537,7 +537,7 @@ def yolov3_loss(x,
...
@@ -537,7 +537,7 @@ def yolov3_loss(x,
ignore_thresh (float): ${ignore_thresh_comment}
ignore_thresh (float): ${ignore_thresh_comment}
downsample_ratio (int): ${downsample_ratio_comment}
downsample_ratio (int): ${downsample_ratio_comment}
name (string): the name of yolov3 loss. Default None.
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.
of [N, B]. Default None.
use_label_smooth (bool): ${use_label_smooth_comment}
use_label_smooth (bool): ${use_label_smooth_comment}
...
@@ -558,13 +558,13 @@ def yolov3_loss(x,
...
@@ -558,13 +558,13 @@ def yolov3_loss(x,
.. code-block:: python
.. code-block:: python
x = fluid.layers.data(name='x', shape=[255, 13, 13], dtype='float32')
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
_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
_label = fluid.layers.data(name='gt_
label', shape=[6], dtype='int32')
gt
score = fluid.layers.data(name='gt
score', shape=[6], dtype='float32')
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]
anchors = [10, 13, 16, 30, 33, 23, 30, 61, 62, 45, 59, 119, 116, 90, 156, 198, 373, 326]
anchor_mask = [0, 1, 2]
anchor_mask = [0, 1, 2]
loss = fluid.layers.yolov3_loss(x=x, gt
box=gtbox, gtlabel=gt
label,
loss = fluid.layers.yolov3_loss(x=x, gt
_box=gt_box, gt_label=gt_
label,
gt
score=gt
score, anchors=anchors,
gt
_score=gt_
score, anchors=anchors,
anchor_mask=anchor_mask, class_num=80,
anchor_mask=anchor_mask, class_num=80,
ignore_thresh=0.7, downsample_ratio=32)
ignore_thresh=0.7, downsample_ratio=32)
"""
"""
...
@@ -572,11 +572,11 @@ def yolov3_loss(x,
...
@@ -572,11 +572,11 @@ def yolov3_loss(x,
if
not
isinstance
(
x
,
Variable
):
if
not
isinstance
(
x
,
Variable
):
raise
TypeError
(
"Input x of yolov3_loss must be 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"
)
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"
)
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"
)
raise
TypeError
(
"Input gtscore of yolov3_loss must be Variable"
)
if
not
isinstance
(
anchors
,
list
)
and
not
isinstance
(
anchors
,
tuple
):
if
not
isinstance
(
anchors
,
list
)
and
not
isinstance
(
anchors
,
tuple
):
raise
TypeError
(
"Attr anchors of yolov3_loss must be list or tuple"
)
raise
TypeError
(
"Attr anchors of yolov3_loss must be list or tuple"
)
...
@@ -602,11 +602,11 @@ def yolov3_loss(x,
...
@@ -602,11 +602,11 @@ def yolov3_loss(x,
inputs
=
{
inputs
=
{
"X"
:
x
,
"X"
:
x
,
"GTBox"
:
gtbox
,
"GTBox"
:
gt
_
box
,
"GTLabel"
:
gtlabel
,
"GTLabel"
:
gt
_
label
,
}
}
if
gtscore
:
if
gtscore
:
inputs
[
"GTScore"
]
=
gtscore
inputs
[
"GTScore"
]
=
gt
_
score
attrs
=
{
attrs
=
{
"anchors"
:
anchors
,
"anchors"
:
anchors
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录