Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
Models
提交
dd76c1f9
M
Models
项目概览
MegEngine 天元
/
Models
通知
6
Star
3
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
dd76c1f9
编写于
7月 23, 2020
作者:
W
Wang Feng
提交者:
GitHub
7月 23, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(gpu_nms): use lazy compile and import for gpu_nms (#50)
上级
9be38bee
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
2 deletion
+19
-2
official/vision/detection/layers/det/rpn.py
official/vision/detection/layers/det/rpn.py
+1
-1
official/vision/detection/tools/gpu_nms.py
official/vision/detection/tools/gpu_nms.py
+18
-1
未找到文件。
official/vision/detection/layers/det/rpn.py
浏览文件 @
dd76c1f9
...
@@ -14,7 +14,6 @@ import megengine.module as M
...
@@ -14,7 +14,6 @@ import megengine.module as M
import
megengine.random
as
rand
import
megengine.random
as
rand
from
official.vision.detection
import
layers
from
official.vision.detection
import
layers
from
official.vision.detection.tools.gpu_nms
import
batched_nms
class
RPN
(
M
.
Module
):
class
RPN
(
M
.
Module
):
...
@@ -109,6 +108,7 @@ class RPN(M.Module):
...
@@ -109,6 +108,7 @@ class RPN(M.Module):
def
find_top_rpn_proposals
(
def
find_top_rpn_proposals
(
self
,
rpn_bbox_offset_list
,
rpn_cls_score_list
,
all_anchors_list
,
im_info
self
,
rpn_bbox_offset_list
,
rpn_cls_score_list
,
all_anchors_list
,
im_info
):
):
from
official.vision.detection.tools.gpu_nms
import
batched_nms
prev_nms_top_n
=
(
prev_nms_top_n
=
(
self
.
cfg
.
train_prev_nms_top_n
self
.
cfg
.
train_prev_nms_top_n
if
self
.
training
if
self
.
training
...
...
official/vision/detection/tools/gpu_nms.py
浏览文件 @
dd76c1f9
...
@@ -12,7 +12,24 @@ from megengine._internal.craniotome import CraniotomeBase
...
@@ -12,7 +12,24 @@ from megengine._internal.craniotome import CraniotomeBase
from
megengine.core.tensor
import
wrap_io_tensor
from
megengine.core.tensor
import
wrap_io_tensor
_so_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"lib_nms.so"
)
_so_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"lib_nms.so"
)
_so_lib
=
ctypes
.
CDLL
(
_so_path
)
try
:
_so_lib
=
ctypes
.
CDLL
(
_so_path
)
except
Exception
:
MGE
=
mge
.
__file__
.
rsplit
(
"/"
,
1
)[
0
]
current_path
=
os
.
path
.
abspath
(
__file__
).
rsplit
(
"/"
,
1
)[
0
]
mge_path
=
os
.
path
.
join
(
MGE
,
"_internal/include"
)
src_file
=
os
.
path
.
join
(
current_path
,
"gpu_nms/nms.cu"
)
dst_file
=
os
.
path
.
join
(
current_path
,
"lib_nms.so"
)
assert
os
.
path
.
exists
(
mge_path
)
assert
os
.
path
.
exists
(
src_file
)
cmd
=
(
"nvcc -I {} -shared -o {} -Xcompiler '-fno-strict-aliasing -fPIC' {}"
.
format
(
mge_path
,
dst_file
,
src_file
)
)
os
.
system
(
cmd
)
_so_lib
=
ctypes
.
CDLL
(
_so_path
)
_TYPE_POINTER
=
ctypes
.
c_void_p
_TYPE_POINTER
=
ctypes
.
c_void_p
_TYPE_POINTER
=
ctypes
.
c_void_p
_TYPE_POINTER
=
ctypes
.
c_void_p
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录