Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
f660553d
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看板
提交
f660553d
编写于
1月 18, 2019
作者:
J
jerrywgz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enhance nms for mask rcnn, test=develop
上级
88ee56d0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
6 deletion
+7
-6
paddle/fluid/operators/detection/multiclass_nms_op.cc
paddle/fluid/operators/detection/multiclass_nms_op.cc
+1
-2
python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py
...on/paddle/fluid/tests/unittests/test_multiclass_nms_op.py
+6
-4
未找到文件。
paddle/fluid/operators/detection/multiclass_nms_op.cc
浏览文件 @
f660553d
...
@@ -405,7 +405,7 @@ class MultiClassNMSKernel : public framework::OpKernel<T> {
...
@@ -405,7 +405,7 @@ class MultiClassNMSKernel : public framework::OpKernel<T> {
if
(
num_kept
==
0
)
{
if
(
num_kept
==
0
)
{
T
*
od
=
outs
->
mutable_data
<
T
>
({
1
,
1
},
ctx
.
GetPlace
());
T
*
od
=
outs
->
mutable_data
<
T
>
({
1
,
1
},
ctx
.
GetPlace
());
od
[
0
]
=
-
1
;
od
[
0
]
=
-
1
;
batch_starts
.
back
()
=
1
;
batch_starts
=
{
0
,
1
}
;
}
else
{
}
else
{
outs
->
mutable_data
<
T
>
({
num_kept
,
out_dim
},
ctx
.
GetPlace
());
outs
->
mutable_data
<
T
>
({
num_kept
,
out_dim
},
ctx
.
GetPlace
());
if
(
score_dims
.
size
()
==
3
)
{
if
(
score_dims
.
size
()
==
3
)
{
...
@@ -443,7 +443,6 @@ class MultiClassNMSKernel : public framework::OpKernel<T> {
...
@@ -443,7 +443,6 @@ class MultiClassNMSKernel : public framework::OpKernel<T> {
framework
::
LoD
lod
;
framework
::
LoD
lod
;
lod
.
emplace_back
(
batch_starts
);
lod
.
emplace_back
(
batch_starts
);
LOG
(
ERROR
)
<<
"c++ lod: "
<<
lod
;
outs
->
set_lod
(
lod
);
outs
->
set_lod
(
lod
);
}
}
...
...
python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py
浏览文件 @
f660553d
...
@@ -173,13 +173,15 @@ def lod_multiclass_nms(boxes, scores, background, score_threshold,
...
@@ -173,13 +173,15 @@ def lod_multiclass_nms(boxes, scores, background, score_threshold,
normalized
,
normalized
,
shared
=
False
)
shared
=
False
)
if
nmsed_num
==
0
:
if
nmsed_num
==
0
:
lod
.
append
(
1
)
#
lod.append(1)
continue
continue
lod
.
append
(
nmsed_num
)
lod
.
append
(
nmsed_num
)
for
c
,
indices
in
nmsed_outs
.
items
():
for
c
,
indices
in
nmsed_outs
.
items
():
for
idx
in
indices
:
for
idx
in
indices
:
xmin
,
ymin
,
xmax
,
ymax
=
box
[
idx
,
c
,
:]
xmin
,
ymin
,
xmax
,
ymax
=
box
[
idx
,
c
,
:]
det_outs
.
append
([
c
,
score
[
idx
][
c
],
xmin
,
ymin
,
xmax
,
ymax
])
det_outs
.
append
([
c
,
score
[
idx
][
c
],
xmin
,
ymin
,
xmax
,
ymax
])
if
len
(
lod
)
==
0
:
lod
.
append
(
1
)
return
det_outs
,
lod
return
det_outs
,
lod
...
@@ -208,7 +210,7 @@ def batched_multiclass_nms(boxes,
...
@@ -208,7 +210,7 @@ def batched_multiclass_nms(boxes,
normalized
,
normalized
,
shared
=
True
)
shared
=
True
)
if
nmsed_num
==
0
:
if
nmsed_num
==
0
:
lod
.
append
(
1
)
#
lod.append(1)
continue
continue
lod
.
append
(
nmsed_num
)
lod
.
append
(
nmsed_num
)
...
@@ -221,7 +223,8 @@ def batched_multiclass_nms(boxes,
...
@@ -221,7 +223,8 @@ def batched_multiclass_nms(boxes,
sorted_det_out
=
sorted
(
sorted_det_out
=
sorted
(
tmp_det_out
,
key
=
lambda
tup
:
tup
[
0
],
reverse
=
False
)
tmp_det_out
,
key
=
lambda
tup
:
tup
[
0
],
reverse
=
False
)
det_outs
.
extend
(
sorted_det_out
)
det_outs
.
extend
(
sorted_det_out
)
if
len
(
lod
)
==
0
:
lod
+=
[
1
]
return
det_outs
,
lod
return
det_outs
,
lod
...
@@ -259,7 +262,6 @@ class TestMulticlassNMSOp(OpTest):
...
@@ -259,7 +262,6 @@ class TestMulticlassNMSOp(OpTest):
nmsed_outs
,
lod
=
batched_multiclass_nms
(
boxes
,
scores
,
background
,
nmsed_outs
,
lod
=
batched_multiclass_nms
(
boxes
,
scores
,
background
,
score_threshold
,
nms_threshold
,
score_threshold
,
nms_threshold
,
nms_top_k
,
keep_top_k
)
nms_top_k
,
keep_top_k
)
print
(
'python lod: '
,
lod
)
nmsed_outs
=
[
-
1
]
if
not
nmsed_outs
else
nmsed_outs
nmsed_outs
=
[
-
1
]
if
not
nmsed_outs
else
nmsed_outs
nmsed_outs
=
np
.
array
(
nmsed_outs
).
astype
(
'float32'
)
nmsed_outs
=
np
.
array
(
nmsed_outs
).
astype
(
'float32'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录