aim-uofa / AdelaiDet

AdelaiDet is an open source toolbox for multiple instance-level detection and recognition tasks.

Home Page:https://git.io/AdelaiDet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question for compute_iou

redleaf-kim opened this issue · comments

Firstly thanks for the greatest work.

If I got iou equation correctly, I need to get W and H for each predicted bounding boxes and target boxes and overlapping boxes respectively to calculate iou score. And here W, H is boxes[:, 2] - boxes[:, 0] and boxes[:, 3] - boxes[:, 1] respectively.

But compute_iou function below take W, H as boxes[:, 2] + boxes[:, 0] and boxes[:, 3] + boxes[:, 1] respectively.
Here is the question. Is there any specific reason for calculating iou scores like below or am I get wrong about iou score equation?

target_aera = (target_left + target_right) * \
(target_top + target_bottom)
pred_aera = (pred_left + pred_right) * \
(pred_top + pred_bottom)
w_intersect = torch.min(pred_left, target_left) + \
torch.min(pred_right, target_right)
h_intersect = torch.min(pred_bottom, target_bottom) + \
torch.min(pred_top, target_top)
g_w_intersect = torch.max(pred_left, target_left) + \
torch.max(pred_right, target_right)
g_h_intersect = torch.max(pred_bottom, target_bottom) + \
torch.max(pred_top, target_top)

I got it... for FCOS l∗, t∗, r*,b∗ are the distances from the location to the four sides of the bound-ing box.