Solved by benihime91 in post #5 
              
              
                @Usama_Hasan 
I was looking around the sources code of detectron-2 where I found this really simple & efficient implementation: 
I implemented it like-so: 
def batched_nms(boxes: torch.Tensor, scores: torch.Tensor, idxs: torch.Tensor, iou_threshold: float):
    """
    [
    From :
    (https://gith…