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
b71a1210
Commit
b71a1210
authored
Sep 25, 2018
by
Kai Chen
Browse files
move from models to core
parent
d04fa0f3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
18 deletions
+8
-18
mmdet/core/utils/misc.py
mmdet/core/utils/misc.py
+8
-8
mmdet/models/utils/__init__.py
mmdet/models/utils/__init__.py
+0
-1
mmdet/models/utils/misc.py
mmdet/models/utils/misc.py
+0
-9
No files found.
mmdet/core/utils/misc.py
View file @
b71a1210
from
functools
import
partial
import
mmcv
import
mmcv
import
numpy
as
np
import
numpy
as
np
import
torch
from
six.moves
import
map
,
zip
__all__
=
[
'tensor2imgs'
,
'
unique
'
,
'unmap'
,
'results2json'
]
__all__
=
[
'tensor2imgs'
,
'
multi_apply
'
,
'unmap'
,
'results2json'
]
def
tensor2imgs
(
tensor
,
mean
=
(
0
,
0
,
0
),
std
=
(
1
,
1
,
1
),
to_rgb
=
True
):
def
tensor2imgs
(
tensor
,
mean
=
(
0
,
0
,
0
),
std
=
(
1
,
1
,
1
),
to_rgb
=
True
):
...
@@ -17,12 +19,10 @@ def tensor2imgs(tensor, mean=(0, 0, 0), std=(1, 1, 1), to_rgb=True):
...
@@ -17,12 +19,10 @@ def tensor2imgs(tensor, mean=(0, 0, 0), std=(1, 1, 1), to_rgb=True):
return
imgs
return
imgs
def
unique
(
tensor
):
def
multi_apply
(
func
,
*
args
,
**
kwargs
):
if
tensor
.
is_cuda
:
pfunc
=
partial
(
func
,
**
kwargs
)
if
kwargs
else
func
u_tensor
=
np
.
unique
(
tensor
.
cpu
().
numpy
())
map_results
=
map
(
pfunc
,
*
args
)
return
tensor
.
new_tensor
(
u_tensor
)
return
tuple
(
map
(
list
,
zip
(
*
map_results
)))
else
:
return
torch
.
unique
(
tensor
)
def
unmap
(
data
,
count
,
inds
,
fill
=
0
):
def
unmap
(
data
,
count
,
inds
,
fill
=
0
):
...
...
mmdet/models/utils/__init__.py
View file @
b71a1210
from
.conv_module
import
ConvModule
from
.conv_module
import
ConvModule
from
.norm
import
build_norm_layer
from
.norm
import
build_norm_layer
from
.misc
import
*
from
.weight_init
import
*
from
.weight_init
import
*
__all__
=
[
'ConvModule'
,
'build_norm_layer'
]
__all__
=
[
'ConvModule'
,
'build_norm_layer'
]
mmdet/models/utils/misc.py
deleted
100644 → 0
View file @
d04fa0f3
from
functools
import
partial
from
six.moves
import
map
,
zip
def
multi_apply
(
func
,
*
args
,
**
kwargs
):
pfunc
=
partial
(
func
,
**
kwargs
)
if
kwargs
else
func
map_results
=
map
(
pfunc
,
*
args
)
return
tuple
(
map
(
list
,
zip
(
*
map_results
)))
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