Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Score calculation as a product of the bbox and maskiou probability #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions layers/output_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ def postprocess(det_output, w, h, batch_idx=0, interpolation_mode='bilinear',

if dets is None:
return [torch.Tensor()] * 4 # Warning, this is 4 copies of the same thing

if score_threshold > 0:
keep = dets['score'] > score_threshold

for k in dets:
if k != 'proto':
dets[k] = dets[k][keep]

if dets['score'].size(0) == 0:
return [torch.Tensor()] * 4

if not cfg.use_maskiou and not cfg.rescore_mask and not cfg.rescore_bbox:
if score_threshold > 0:
keep = dets['score'] > score_threshold

for k in dets:
if k != 'proto':
dets[k] = dets[k][keep]

if dets['score'].size(0) == 0:
return [torch.Tensor()] * 4

# Actually extract everything from dets now
classes = dets['class']
Expand Down Expand Up @@ -84,6 +85,24 @@ def postprocess(det_output, w, h, batch_idx=0, interpolation_mode='bilinear',
if cfg.rescore_mask:
if cfg.rescore_bbox:
scores = scores * maskiou_p

dets['score'] = scores

if score_threshold > 0:
keep = dets['score'] > score_threshold

for k in dets:
if k != 'proto':
dets[k] = dets[k][keep]

if dets['score'].size(0) == 0:
return [torch.Tensor()] * 4

classes = dets['class']
boxes = dets['box']
scores = dets['score']
masks = dets['mask']

else:
scores = [scores, scores * maskiou_p]

Expand Down