Closed sunset1995 closed 3 years ago
Let:
A
B
I
Ha
Hb
The 3D IoU should be:
area3d_I = I * min(Ha, Hb) area3d_A = A * Ha area3d_B = B * Hb iou3d = area3d_I / (area3d_A + area3d_B - area3d_I)
However, the original implementation is wrong:
iou2d = I / (A + B - I) iouH = min(Ha, Hb) / max(Ha, Hb) iou3d = iout2d * iouH
For an easier comparison, let rewrite it into same form:
iou3d = iout2d * iouH iou3d = I / (A + B - I) * iouH iou3d = I / (A + B - I) * min(Ha, Hb) / max(Ha, Hb) iou3d = I * min(Ha, Hb) / (A + B - I) / max(Ha, Hb) iou3d = area3d_I / ((A + B - I) * max(Ha, Hb))
Without loss of generality, let say Ha >= Hb. Then the difference is:
Ha >= Hb
area3d_I / (A * Ha + B * Ha - I * Ha)
area3d_I / (A * Ha + B * Hb - I * Hb)
As B >= I and Ha >= Hb, my 3D IoU is less or equal to the correct 3D IoU.
B >= I
The fix: commit 2291a6
Let:
A
be the 2d area of predictionB
be the 2d area of ground-truthI
be the 2d area of intersection of prediction and ground-truthHa
be the layout height of predictionHb
be the layout height of ground-truthThe 3D IoU should be:
However, the original implementation is wrong:
For an easier comparison, let rewrite it into same form:
Without loss of generality, let say
Ha >= Hb
. Then the difference is:area3d_I / (A * Ha + B * Ha - I * Ha)
(my fault)area3d_I / (A * Ha + B * Hb - I * Hb)
(the correct one)As
B >= I
andHa >= Hb
, my 3D IoU is less or equal to the correct 3D IoU.