gluon-cv icon indicating copy to clipboard operation
gluon-cv copied to clipboard

Error in calculating bbox_iou

Open ksellesk opened this issue 6 years ago • 2 comments

https://github.com/dmlc/gluon-cv/blob/master/gluoncv/utils/bbox.py#L30

Seems area_a = np.prod(bbox_a[:, 2:4] - bbox_a[:, :2], axis=1)

should be:

area_a = np.prod(bbox_a[:, 2:4] - bbox_a[:, :2] + 1, axis=1)

ksellesk avatar Jun 25 '18 12:06 ksellesk

see https://github.com/dmlc/gluon-cv/pull/186 whether adding 1px is still debating and not valid if box is normalized, but I've added an option to allow such convention.

zhreshold avatar Jun 26 '18 19:06 zhreshold

For an image of size (h, w, c) = (300, 400, 3), the maximum box (xmin, ymin, xmax, ymax) is (0, 0, 399, 299) if represented in integer box and (0.0, 0.0, 400.0, 300.0) if represented floating point box. Adding 1px is used for integer box but not for floating point box. Such usage can be verified with segmentation annotation.

ijkguo avatar Aug 07 '18 17:08 ijkguo