def nms_gpu(boxes, scores, thresh): """ :param boxes: (N, 5) [x1, y1, x2, y2, ry] :param scores: (N) :param thresh: :return: """ # areas = (x2 - x1) * (y2 - y1) # print("scores :", scores) # scores : tensor([[ -1.9006, 2.7015, -210.2983, -205.6284], # [ -1.9006, 2.7015, -210.2983, -205.6284], # [ -1.9006, 2.7015, -210.2983, -205.6284],... => sane value printed = problem! order = scores.sort(0, descending=True)[1] # print("order :", order) # order : tensor([[31, 31, 31, 31], # [30, 30, 30, 30], # [28, 28, 28, 28],... boxes = boxes[order].contiguous() # print("boxes :", boxes) # boxes : tensor([[[ 3.2608, 5.4325, 4.3231, 6.0319, 1.5068], # [ 3.2608, 5.4325, 4.3231, 6.0319, 1.5068], # [ 3.2608, 5.4325, 4.3231, 6.0319, 1.5068],... keep = torch.LongTensor(boxes.size(0)) # print("keep", keep) num_out = iou3d_cuda.nms_gpu(boxes, keep, thresh) # print("num_out :",num_out) # 6 return order[keep[:num_out].cuda()].contiguous()
def nms_gpu(boxes, scores, thresh): """ :param boxes: (N, 5) [x1, y1, x2, y2, ry] :param scores: (N) :param thresh: :return: """ # areas = (x2 - x1) * (y2 - y1) order = scores.sort(0, descending=True)[1] boxes = boxes[order].contiguous() keep = torch.LongTensor(boxes.size(0)) num_out = iou3d_cuda.nms_gpu(boxes, keep, thresh) return order[keep[:num_out].cuda()].contiguous()
def nms_gpu(boxes, scores, thresh, box_mode='wlh'): """ filter overlapped boxes based on bev iou :param boxes(torch): (N, 7), [x, y, z, h, w, l, ry], torch tensor with type float32 :param scores: (N) :param thresh: in the range [0, 1] for iou thresh :return: """ # areas = (x2 - x1) * (y2 - y1) boxes = utils.boxes3d_to_bev_torch(boxes, box_mode, rect=True) order = scores.sort(0, descending=True)[1] boxes = boxes[order].contiguous() keep = torch.LongTensor(boxes.size(0)) num_out = iou3d_cuda.nms_gpu(boxes, keep, thresh) return order[keep[:num_out].cuda()].contiguous()