Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
a9fdbbf6
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看板
未验证
提交
a9fdbbf6
编写于
5月 18, 2020
作者:
W
wangguanzhong
提交者:
GitHub
5月 18, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ext_op (#714)
上级
a65bf31e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
16 deletion
+21
-16
ppdet/ext_op/README.md
ppdet/ext_op/README.md
+2
-5
ppdet/ext_op/test/test_corner_pool.py
ppdet/ext_op/test/test_corner_pool.py
+9
-6
ppdet/modeling/anchor_heads/corner_head.py
ppdet/modeling/anchor_heads/corner_head.py
+10
-5
未找到文件。
ppdet/ext_op/README.md
浏览文件 @
a9fdbbf6
...
@@ -59,12 +59,9 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`python -c 'import paddle; print(paddle.
...
@@ -59,12 +59,9 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`python -c 'import paddle; print(paddle.
执行下列单测,确保自定义算子可在网络中正确使用:
执行下列单测,确保自定义算子可在网络中正确使用:
```
```
# 回到 ext_op 目录,
添加 PYTHONPATH
# 回到 ext_op 目录,
运行单测
cd ..
cd ..
export PYTHONPATH=$PYTHONPATH:`pwd`
python test/test_corner_pool.py
# 运行单测
python test/test_corner_op.py
```
```
单测运行成功会输出提示信息,如下所示:
单测运行成功会输出提示信息,如下所示:
...
...
ppdet/ext_op/test/test_corner_pool.py
浏览文件 @
a9fdbbf6
...
@@ -17,7 +17,14 @@ from __future__ import print_function
...
@@ -17,7 +17,14 @@ from __future__ import print_function
import
unittest
import
unittest
import
numpy
as
np
import
numpy
as
np
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
import
cornerpool_lib
import
os
import
sys
# add python path of PadleDetection to sys.path
parent_path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
__file__
,
*
([
'..'
]
*
4
)))
if
parent_path
not
in
sys
.
path
:
sys
.
path
.
append
(
parent_path
)
from
ppdet.ext_op
import
cornerpool_lib
def
bottom_pool_np
(
x
):
def
bottom_pool_np
(
x
):
...
@@ -83,11 +90,7 @@ class TestRightPoolOp(unittest.TestCase):
...
@@ -83,11 +90,7 @@ class TestRightPoolOp(unittest.TestCase):
place
=
fluid
.
CUDAPlace
(
0
)
place
=
fluid
.
CUDAPlace
(
0
)
with
fluid
.
program_guard
(
tp
,
sp
):
with
fluid
.
program_guard
(
tp
,
sp
):
x
=
fluid
.
data
(
x
=
fluid
.
data
(
name
=
self
.
name
,
shape
=
x_shape
,
dtype
=
x_type
)
name
=
self
.
name
,
shape
=
x_shape
,
dtype
=
x_type
,
append_batch_size
=
False
)
y
=
self
.
func_map
[
self
.
name
][
0
](
x
)
y
=
self
.
func_map
[
self
.
name
][
0
](
x
)
np
.
random
.
seed
(
0
)
np
.
random
.
seed
(
0
)
...
...
ppdet/modeling/anchor_heads/corner_head.py
浏览文件 @
a9fdbbf6
...
@@ -243,11 +243,6 @@ class CornerHead(object):
...
@@ -243,11 +243,6 @@ class CornerHead(object):
ae_threshold
=
1
,
ae_threshold
=
1
,
num_dets
=
1000
,
num_dets
=
1000
,
top_k
=
100
):
top_k
=
100
):
try
:
import
cornerpool_lib
except
:
logger
.
error
(
"cornerpool_lib not found, compile in ppdet/ext_op at first"
)
self
.
train_batch_size
=
train_batch_size
self
.
train_batch_size
=
train_batch_size
self
.
test_batch_size
=
test_batch_size
self
.
test_batch_size
=
test_batch_size
self
.
num_classes
=
num_classes
self
.
num_classes
=
num_classes
...
@@ -279,6 +274,11 @@ class CornerHead(object):
...
@@ -279,6 +274,11 @@ class CornerHead(object):
return
conv1
return
conv1
def
get_output
(
self
,
input
):
def
get_output
(
self
,
input
):
try
:
from
ppdet.ext_op
import
cornerpool_lib
except
:
logger
.
error
(
"cornerpool_lib not found, compile in ppdet/ext_op at first"
)
for
ind
in
range
(
self
.
stack
):
for
ind
in
range
(
self
.
stack
):
cnv
=
input
[
ind
]
cnv
=
input
[
ind
]
tl_modules
=
corner_pool
(
tl_modules
=
corner_pool
(
...
@@ -455,6 +455,11 @@ class CornerHead(object):
...
@@ -455,6 +455,11 @@ class CornerHead(object):
return
{
'loss'
:
loss
}
return
{
'loss'
:
loss
}
def
get_prediction
(
self
,
input
):
def
get_prediction
(
self
,
input
):
try
:
from
ppdet.ext_op
import
cornerpool_lib
except
:
logger
.
error
(
"cornerpool_lib not found, compile in ppdet/ext_op at first"
)
ind
=
self
.
stack
-
1
ind
=
self
.
stack
-
1
tl_modules
=
corner_pool
(
tl_modules
=
corner_pool
(
input
,
input
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录