Example #1
0
def nms(dets, thresh, force_cpu=False):
    """Dispatch to either CPU or GPU NMS implementations."""
    if dets.shape[0] == 0:
        return []
    # ---numpy version---
    # original: return gpu_nms(dets, thresh, device_id=cfg.GPU_ID)
    # ---pytorch version---
    return nms_gpu(dets, thresh)
def nms(dets, thresh, force_cpu=False):
    """Dispatch to either CPU or GPU NMS implementations."""
    if dets.shape[0] == 0:
        return []
    if cfg.USE_GPU_NMS and not force_cpu:
        # ---numpy version---
        # original: return gpu_nms(dets, thresh, device_id=cfg.GPU_ID)
        # ---pytorch version---
        return nms_gpu(dets, thresh)
    else:
        keep = cpu_nms(dets.numpy(), thresh)

        return torch.Tensor(keep)
def nms(dets, thresh, force_cpu=False):
    """Dispatch to either CPU or GPU NMS implementations."""
    if dets.shape[0] == 0:
        print("dets shape is 0...!!!!!!!!!!!!!!!!!!!!!!!")
        return []
    # ---numpy version---
    # original: return gpu_nms(dets, thresh, device_id=cfg.GPU_ID)
    # ---pytorch version---
    if not force_cpu:
        return nms_gpu(dets, thresh)
    else:
        dets = dets.numpy()
        keep=cpu_nms(dets, thresh)
        return torch.from_numpy(np.array(keep)).float().to("cuda:1")  #converting to float tensor tensor 
Example #4
0
def nms(dets, thresh, force_cpu=False):
    """Dispatch to either CPU or GPU NMS implementations."""
    if dets.shape[0] == 0:
        return []
    # ---numpy version---
    # original: return gpu_nms(dets, thresh, device_id=cfg.GPU_ID)
    # ---pytorch version---

    # Force nms_gpu Compile check
    try:
        return nms_gpu(dets, thresh) if force_cpu == False else nms_cpu(
            dets, thresh)
    except NameError:
        return nms_cpu(dets, thresh)