• Brian Hart's avatar
    improve consistency among box IoU calculations (#2072) · f6a3e0c3
    Brian Hart authored
    Torchvision includes at least 3 bits of code that calculate
    box Intersection over Union values (and usually compare to
    a threshold):
    
    - box_iou in torchvision/ops/boxes.py
    - devIoU in torchvision/csrc/cuda/nms_cuda.cu
    - nms_cpu_kernel in torchvision/csrc/cpu/nms_cpu.cpp
    
    The calculations were performed slightly differently between
    those, leading to occasional differences in results.
    
    Update devIoU to use the same method as the others for better
    consistency.
    
    This change improves agreement between the CPU and CUDA
    calculations but the results can still differ slightly.
    Setting NVCC_FLAGS to include "--fmad=true" would provide
    still better agreement, but with likely cost to performance.
    f6a3e0c3
nms_cuda.cu 4.2 KB