目标检测中求边界框面积area = (x2 - x1 + 1) * (y2 - y1 + 1)

在非极大值抑制算法中,出现面积area = (x2 - x1 + 1) * (y2 - y1 + 1), 请问为什么会有+1操作?

0不能当分母

高端!

没有加一操作吧,不是这段代码吗

inter = (torch.min(b1_x2, b2_x2) - torch.max(b1_x1, b2_x1)).clamp(0) * \
            (torch.min(b1_y2, b2_y2) - torch.max(b1_y1, b2_y1)).clamp(0)