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
51bf54a8
Commit
51bf54a8
authored
Jan 28, 2020
by
tyomj
Committed by
Kai Chen
Jan 28, 2020
Browse files
options for FCNMaskHead during testtime (#2013)
* options for mask during testtime * handle comments
parent
8457bbab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
mmdet/models/mask_heads/fcn_mask_head.py
mmdet/models/mask_heads/fcn_mask_head.py
+13
-5
No files found.
mmdet/models/mask_heads/fcn_mask_head.py
View file @
51bf54a8
...
...
@@ -170,14 +170,22 @@ class FCNMaskHead(nn.Module):
mask_pred_
=
mask_pred
[
i
,
label
,
:,
:]
else
:
mask_pred_
=
mask_pred
[
i
,
0
,
:,
:]
im_mask
=
np
.
zeros
((
img_h
,
img_w
),
dtype
=
np
.
uint8
)
bbox_mask
=
mmcv
.
imresize
(
mask_pred_
,
(
w
,
h
))
bbox_mask
=
(
bbox_mask
>
rcnn_test_cfg
.
mask_thr_binary
).
astype
(
np
.
uint8
)
im_mask
[
bbox
[
1
]:
bbox
[
1
]
+
h
,
bbox
[
0
]:
bbox
[
0
]
+
w
]
=
bbox_mask
rle
=
mask_util
.
encode
(
np
.
array
(
im_mask
[:,
:,
np
.
newaxis
],
order
=
'F'
))[
0
]
cls_segms
[
label
-
1
].
append
(
rle
)
if
rcnn_test_cfg
.
get
(
'crop_mask'
,
False
):
im_mask
=
bbox_mask
else
:
im_mask
=
np
.
zeros
((
img_h
,
img_w
),
dtype
=
np
.
uint8
)
im_mask
[
bbox
[
1
]:
bbox
[
1
]
+
h
,
bbox
[
0
]:
bbox
[
0
]
+
w
]
=
bbox_mask
if
rcnn_test_cfg
.
get
(
'rle_mask_encode'
,
True
):
rle
=
mask_util
.
encode
(
np
.
array
(
im_mask
[:,
:,
np
.
newaxis
],
order
=
'F'
))[
0
]
cls_segms
[
label
-
1
].
append
(
rle
)
else
:
cls_segms
[
label
-
1
].
append
(
im_mask
)
return
cls_segms
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