Commit d38ade04 authored by max0x's avatar max0x Committed by Facebook Github Bot

Add Soft-NMS for testing RetinaNet. (#670)

Summary:
Soft-NMS is present in test.py, but it is missing in test_retinanet.py.
Pull Request resolved: https://github.com/facebookresearch/Detectron/pull/670

Reviewed By: rbgirshick

Differential Revision: D10035825

Pulled By: ir413

fbshipit-source-id: c49ac7e595b32d2ac757815df4add1c644a34027
parent cf1c54ae
...@@ -164,8 +164,17 @@ def im_detect_bbox(model, im, timers=None): ...@@ -164,8 +164,17 @@ def im_detect_bbox(model, im, timers=None):
for cls, boxes in boxes_all.items(): for cls, boxes in boxes_all.items():
cls_dets = np.vstack(boxes).astype(dtype=np.float32) cls_dets = np.vstack(boxes).astype(dtype=np.float32)
# do class specific nms here # do class specific nms here
keep = box_utils.nms(cls_dets, cfg.TEST.NMS) if cfg.TEST.SOFT_NMS.ENABLED:
cls_dets = cls_dets[keep, :] cls_dets, keep = box_utils.soft_nms(
cls_dets,
sigma=cfg.TEST.SOFT_NMS.SIGMA,
overlap_thresh=cfg.TEST.NMS,
score_thresh=0.0001,
method=cfg.TEST.SOFT_NMS.METHOD
)
else:
keep = box_utils.nms(cls_dets, cfg.TEST.NMS)
cls_dets = cls_dets[keep, :]
out = np.zeros((len(keep), 6)) out = np.zeros((len(keep), 6))
out[:, 0:5] = cls_dets out[:, 0:5] = cls_dets
out[:, 5].fill(cls) out[:, 5].fill(cls)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment