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
e2594f17
Commit
e2594f17
authored
Jan 16, 2019
by
Kai Chen
Browse files
Merge branch 'master' into registry
parents
bbe64038
e72a9fd5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
mmdet/core/bbox/assigners/max_iou_assigner.py
mmdet/core/bbox/assigners/max_iou_assigner.py
+5
-6
mmdet/models/anchor_heads/ssd_head.py
mmdet/models/anchor_heads/ssd_head.py
+1
-0
No files found.
mmdet/core/bbox/assigners/max_iou_assigner.py
View file @
e2594f17
...
@@ -69,7 +69,7 @@ class MaxIoUAssigner(BaseAssigner):
...
@@ -69,7 +69,7 @@ class MaxIoUAssigner(BaseAssigner):
if
bboxes
.
shape
[
0
]
==
0
or
gt_bboxes
.
shape
[
0
]
==
0
:
if
bboxes
.
shape
[
0
]
==
0
or
gt_bboxes
.
shape
[
0
]
==
0
:
raise
ValueError
(
'No gt or bboxes'
)
raise
ValueError
(
'No gt or bboxes'
)
bboxes
=
bboxes
[:,
:
4
]
bboxes
=
bboxes
[:,
:
4
]
overlaps
=
bbox_overlaps
(
bboxes
,
gt_
bboxes
)
overlaps
=
bbox_overlaps
(
gt_
bboxes
,
bboxes
)
if
(
self
.
ignore_iof_thr
>
0
)
and
(
gt_bboxes_ignore
is
not
None
)
and
(
if
(
self
.
ignore_iof_thr
>
0
)
and
(
gt_bboxes_ignore
is
not
None
)
and
(
gt_bboxes_ignore
.
numel
()
>
0
):
gt_bboxes_ignore
.
numel
()
>
0
):
...
@@ -98,19 +98,18 @@ class MaxIoUAssigner(BaseAssigner):
...
@@ -98,19 +98,18 @@ class MaxIoUAssigner(BaseAssigner):
if
overlaps
.
numel
()
==
0
:
if
overlaps
.
numel
()
==
0
:
raise
ValueError
(
'No gt or proposals'
)
raise
ValueError
(
'No gt or proposals'
)
num_
bboxe
s
,
num_
gt
s
=
overlaps
.
size
(
0
),
overlaps
.
size
(
1
)
num_
gt
s
,
num_
bboxe
s
=
overlaps
.
size
(
0
),
overlaps
.
size
(
1
)
# 1. assign -1 by default
# 1. assign -1 by default
assigned_gt_inds
=
overlaps
.
new_full
(
assigned_gt_inds
=
overlaps
.
new_full
(
(
num_bboxes
,
),
-
1
,
dtype
=
torch
.
long
)
(
num_bboxes
,
),
-
1
,
dtype
=
torch
.
long
)
assert
overlaps
.
size
()
==
(
num_bboxes
,
num_gts
)
# for each anchor, which gt best overlaps with it
# for each anchor, which gt best overlaps with it
# for each anchor, the max iou of all gts
# for each anchor, the max iou of all gts
max_overlaps
,
argmax_overlaps
=
overlaps
.
max
(
dim
=
1
)
max_overlaps
,
argmax_overlaps
=
overlaps
.
max
(
dim
=
0
)
# for each gt, which anchor best overlaps with it
# for each gt, which anchor best overlaps with it
# for each gt, the max iou of all proposals
# for each gt, the max iou of all proposals
gt_max_overlaps
,
gt_argmax_overlaps
=
overlaps
.
max
(
dim
=
0
)
gt_max_overlaps
,
gt_argmax_overlaps
=
overlaps
.
max
(
dim
=
1
)
# 2. assign negative: below
# 2. assign negative: below
if
isinstance
(
self
.
neg_iou_thr
,
float
):
if
isinstance
(
self
.
neg_iou_thr
,
float
):
...
@@ -129,7 +128,7 @@ class MaxIoUAssigner(BaseAssigner):
...
@@ -129,7 +128,7 @@ class MaxIoUAssigner(BaseAssigner):
for
i
in
range
(
num_gts
):
for
i
in
range
(
num_gts
):
if
gt_max_overlaps
[
i
]
>=
self
.
min_pos_iou
:
if
gt_max_overlaps
[
i
]
>=
self
.
min_pos_iou
:
if
self
.
gt_max_assign_all
:
if
self
.
gt_max_assign_all
:
max_iou_inds
=
overlaps
[
:
,
i
]
==
gt_max_overlaps
[
i
]
max_iou_inds
=
overlaps
[
i
,
:
]
==
gt_max_overlaps
[
i
]
assigned_gt_inds
[
max_iou_inds
]
=
i
+
1
assigned_gt_inds
[
max_iou_inds
]
=
i
+
1
else
:
else
:
assigned_gt_inds
[
gt_argmax_overlaps
[
i
]]
=
i
+
1
assigned_gt_inds
[
gt_argmax_overlaps
[
i
]]
=
i
+
1
...
...
mmdet/models/anchor_heads/ssd_head.py
View file @
e2594f17
...
@@ -146,6 +146,7 @@ class SSDHead(AnchorHead):
...
@@ -146,6 +146,7 @@ class SSDHead(AnchorHead):
self
.
target_stds
,
self
.
target_stds
,
cfg
,
cfg
,
gt_labels_list
=
gt_labels
,
gt_labels_list
=
gt_labels
,
label_channels
=
1
,
sampling
=
False
,
sampling
=
False
,
unmap_outputs
=
False
)
unmap_outputs
=
False
)
if
cls_reg_targets
is
None
:
if
cls_reg_targets
is
None
:
...
...
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