Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OPTHREE
Paddle
提交
466a10dc
P
Paddle
项目概览
OPTHREE
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
466a10dc
编写于
1月 25, 2019
作者:
J
jerrywgz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine code, test=develop
上级
9eb2d7b3
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
16 addition
and
13 deletion
+16
-13
paddle/fluid/operators/detection/multiclass_nms_op.cc
paddle/fluid/operators/detection/multiclass_nms_op.cc
+1
-1
python/paddle/fluid/layers/detection.py
python/paddle/fluid/layers/detection.py
+8
-4
python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py
...on/paddle/fluid/tests/unittests/test_multiclass_nms_op.py
+7
-8
未找到文件。
paddle/fluid/operators/detection/multiclass_nms_op.cc
浏览文件 @
466a10dc
...
...
@@ -520,7 +520,7 @@ independently for each class. The outputs is a 2-D LoDTenosr, for each
image, the offsets in first dimension of LoDTensor are called LoD, the number
of offset is N + 1, where N is the batch size. If LoD[i + 1] - LoD[i] == 0,
means there is no detected bbox for this image. If there is no detected boxes
for all images, all the elements in LoD are set to {
0,
1}, and the Out only
for all images, all the elements in LoD are set to {1}, and the Out only
contains one value which is -1.
)DOC"
);
}
...
...
python/paddle/fluid/layers/detection.py
浏览文件 @
466a10dc
...
...
@@ -263,8 +263,10 @@ def detection_output(loc,
number is N + 1, N is the batch size. The i-th image has
`LoD[i + 1] - LoD[i]` detected results, if it is 0, the i-th image
has no detected results. If all images have not detected results,
all the elements in LoD are 0
, and output tensor only contains one
LoD will be set to {1}
, and output tensor only contains one
value, which is -1.
(After version 1.3, when no boxes detected, the lod is changed
from {0} to {1}.)
Examples:
.. code-block:: python
...
...
@@ -1967,8 +1969,8 @@ def multiclass_nms(bboxes,
scores
,
score_threshold
,
nms_top_k
,
nms_threshold
,
keep_top_k
,
nms_threshold
=
0.3
,
normalized
=
True
,
nms_eta
=
1.
,
background_label
=
0
,
...
...
@@ -2035,8 +2037,10 @@ def multiclass_nms(bboxes,
Each row has 10 values:
[label, confidence, x1, y1, x2, y2, x3, y3, x4, y4]. No is the
total number of detections. If there is no detected boxes for all
images, lod will be set to {
0,
1} and Out only contains one value
images, lod will be set to {1} and Out only contains one value
which is -1.
(After version 1.3, when no boxes detected, the lod is changed
from {0} to {1})
Examples:
.. code-block:: python
...
...
python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py
浏览文件 @
466a10dc
...
...
@@ -19,7 +19,7 @@ import copy
from
op_test
import
OpTest
def
iou
(
box_a
,
box_b
,
norm
alized
):
def
iou
(
box_a
,
box_b
,
norm
):
"""Apply intersection-over-union overlap between box_a and box_b
"""
xmin_a
=
min
(
box_a
[
0
],
box_a
[
2
])
...
...
@@ -32,10 +32,10 @@ def iou(box_a, box_b, normalized):
xmax_b
=
max
(
box_b
[
0
],
box_b
[
2
])
ymax_b
=
max
(
box_b
[
1
],
box_b
[
3
])
area_a
=
(
ymax_a
-
ymin_a
+
(
norm
alized
==
False
))
*
\
(
xmax_a
-
xmin_a
+
(
normalized
==
False
))
area_b
=
(
ymax_b
-
ymin_b
+
(
norm
alized
==
False
))
*
\
(
xmax_b
-
xmin_b
+
(
normalized
==
False
))
area_a
=
(
ymax_a
-
ymin_a
+
(
norm
==
False
))
*
(
xmax_a
-
xmin_a
+
(
norm
==
False
))
area_b
=
(
ymax_b
-
ymin_b
+
(
norm
==
False
))
*
(
xmax_b
-
xmin_b
+
(
norm
==
False
))
if
area_a
<=
0
and
area_b
<=
0
:
return
0.0
...
...
@@ -44,8 +44,8 @@ def iou(box_a, box_b, normalized):
xb
=
min
(
xmax_a
,
xmax_b
)
yb
=
min
(
ymax_a
,
ymax_b
)
inter_area
=
max
(
xb
-
xa
+
(
norm
alized
==
False
),
0.0
)
*
\
max
(
yb
-
ya
+
(
normalized
==
False
),
0.0
)
inter_area
=
max
(
xb
-
xa
+
(
norm
==
False
),
0.0
)
*
max
(
yb
-
ya
+
(
norm
==
False
),
0.0
)
iou_ratio
=
inter_area
/
(
area_a
+
area_b
-
inter_area
)
...
...
@@ -210,7 +210,6 @@ def batched_multiclass_nms(boxes,
normalized
,
shared
=
True
)
if
nmsed_num
==
0
:
# lod.append(1)
continue
lod
.
append
(
nmsed_num
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录