Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
SOLOv2-pytorch
Commits
559b0558
Unverified
Commit
559b0558
authored
Nov 23, 2018
by
Kai Chen
Committed by
GitHub
Nov 23, 2018
Browse files
Merge pull request #119 from youansheng/patch-3
Update nms_wrapper.py
parents
3f5df4f0
5f9ca54d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
mmdet/ops/nms/nms_wrapper.py
mmdet/ops/nms/nms_wrapper.py
+4
-2
No files found.
mmdet/ops/nms/nms_wrapper.py
View file @
559b0558
...
...
@@ -9,7 +9,9 @@ from .cpu_soft_nms import cpu_soft_nms
def
nms
(
dets
,
thresh
,
device_id
=
None
):
"""Dispatch to either CPU or GPU NMS implementations."""
tensor_device
=
None
if
isinstance
(
dets
,
torch
.
Tensor
):
tensor_device
=
dets
.
device
if
dets
.
is_cuda
:
device_id
=
dets
.
get_device
()
dets
=
dets
.
detach
().
cpu
().
numpy
()
...
...
@@ -21,8 +23,8 @@ def nms(dets, thresh, device_id=None):
inds
=
(
gpu_nms
(
dets
,
thresh
,
device_id
=
device_id
)
if
device_id
is
not
None
else
cpu_nms
(
dets
,
thresh
))
if
isinstance
(
dets
,
torch
.
Tensor
)
:
return
dets
.
new_tensor
(
inds
,
dtype
=
torch
.
long
)
if
tensor_device
:
return
torch
.
Tensor
(
inds
).
long
().
to
(
tensor_device
)
else
:
return
np
.
array
(
inds
,
dtype
=
np
.
int
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment