Skip to content

Instantly share code, notes, and snippets.

View ajhanwar's full-sized avatar

Aditya Jhanwar ajhanwar

  • San Francisco, California, USA
View GitHub Profile
@mkocabas
mkocabas / nms_pytorch.py
Created June 1, 2018 04:56
Pytorch NMS implementation
import torch
# Original author: Francisco Massa:
# https://github.com/fmassa/object-detection.torch
# Ported to PyTorch by Max deGroot (02/01/2017)
def nms(boxes, scores, overlap=0.5, top_k=200):
"""Apply non-maximum suppression at test time to avoid detecting too many
overlapping bounding boxes for a given object.
Args:
boxes: (tensor) The location preds for the img, Shape: [num_priors,4].