Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
Models
提交
79b64608
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看板
未验证
提交
79b64608
编写于
7月 27, 2020
作者:
W
Wang Feng
提交者:
GitHub
7月 27, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore(gpu_nms): use a better implemention (#51)
上级
dd76c1f9
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
10 addition
and
11 deletion
+10
-11
official/vision/detection/tools/gpu_nms.py
official/vision/detection/tools/gpu_nms.py
+10
-11
未找到文件。
official/vision/detection/tools/gpu_nms.py
浏览文件 @
79b64608
...
...
@@ -11,24 +11,23 @@ import megengine.functional as F
from
megengine._internal.craniotome
import
CraniotomeBase
from
megengine.core.tensor
import
wrap_io_tensor
_so_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"lib_nms.so"
)
_current_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
_so_path
=
os
.
path
.
join
(
_current_path
,
"lib_nms.so"
)
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
)
import
subprocess
mge_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
mge
.
__file__
),
"_internal"
,
"include"
)
assert
os
.
path
.
exists
(
mge_path
),
"{} file not found"
.
format
(
mge_path
)
src_file
=
os
.
path
.
join
(
_current_path
,
"gpu_nms"
,
"nms.cu"
)
assert
os
.
path
.
exists
(
src_file
),
"{} file not found"
.
format
(
src_file
)
cmd
=
(
"nvcc -I {} -shared -o {} -Xcompiler '-fno-strict-aliasing -fPIC' {}"
.
format
(
mge_path
,
dst_file
,
src_file
mge_path
,
_so_path
,
src_file
)
)
os
.
system
(
cmd
)
subprocess
.
check_call
(
cmd
,
shell
=
True
)
_so_lib
=
ctypes
.
CDLL
(
_so_path
)
_TYPE_POINTER
=
ctypes
.
c_void_p
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录