Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Swin-Transformer-Object-Detection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wanggh
Swin-Transformer-Object-Detection
Commits
cb0dd8ee
Commit
cb0dd8ee
authored
5 years ago
by
Cao Yuhang
Committed by
Kai Chen
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
support fp16 for maskiou_head (#986)
parent
713e98bc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mmdet/models/mask_heads/maskiou_head.py
+5
-0
5 additions, 0 deletions
mmdet/models/mask_heads/maskiou_head.py
with
5 additions
and
0 deletions
mmdet/models/mask_heads/maskiou_head.py
+
5
−
0
View file @
cb0dd8ee
...
...
@@ -2,6 +2,7 @@ import numpy as np
import
torch
import
torch.nn
as
nn
from
mmcv.cnn
import
kaiming_init
,
normal_init
from
mmdet.core
import
force_fp32
from
..builder
import
build_loss
from
..registry
import
HEADS
...
...
@@ -28,6 +29,7 @@ class MaskIoUHead(nn.Module):
self
.
conv_out_channels
=
conv_out_channels
self
.
fc_out_channels
=
fc_out_channels
self
.
num_classes
=
num_classes
self
.
fp16_enabled
=
False
self
.
convs
=
nn
.
ModuleList
()
for
i
in
range
(
num_convs
):
...
...
@@ -82,6 +84,7 @@ class MaskIoUHead(nn.Module):
mask_iou
=
self
.
fc_mask_iou
(
x
)
return
mask_iou
@force_fp32
(
apply_to
=
(
'
mask_iou_pred
'
,
))
def
loss
(
self
,
mask_iou_pred
,
mask_iou_targets
):
pos_inds
=
mask_iou_targets
>
0
if
pos_inds
.
sum
()
>
0
:
...
...
@@ -91,6 +94,7 @@ class MaskIoUHead(nn.Module):
loss_mask_iou
=
mask_iou_pred
*
0
return
dict
(
loss_mask_iou
=
loss_mask_iou
)
@force_fp32
(
apply_to
=
(
'
mask_pred
'
,
))
def
get_target
(
self
,
sampling_results
,
gt_masks
,
mask_pred
,
mask_targets
,
rcnn_train_cfg
):
"""
Compute target of mask IoU.
...
...
@@ -166,6 +170,7 @@ class MaskIoUHead(nn.Module):
area_ratios
=
pos_proposals
.
new_zeros
((
0
,
))
return
area_ratios
@force_fp32
(
apply_to
=
(
'
mask_iou_pred
'
,
))
def
get_mask_scores
(
self
,
mask_iou_pred
,
det_bboxes
,
det_labels
):
"""
Get the mask scores.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment