pythonnumpytensorflowtensorflow2.0non-maximum-suppression

Plus one in calculating area of rectangle


areas = (end_x - start_x + 1) * (end_y - start_y + 1)

Above is what use in calculating area of rectangle for non-max-suppression in two different links below, why there is a need for plus one?

https://github.com/amusi/Non-Maximum-Suppression/blob/master/nms.py https://www.pyimagesearch.com/2014/11/17/non-maximum-suppression-object-detection-python/


Solution

  • I guess that plus one is just used to get the exact area. For example, width begin in pixel 2, end in pixel 4. The exact width is 3 (pixel 2, 3, 4). A 3 equals to 4 - 2 + 1.

    But in my opion, it's not essential to care about that. Just make sure you cal every area in the same standard.