sunset1995 / HorizonNet

Pytorch implementation of HorizonNet: Learning Room Layout with 1D Representation and Pano Stretch Data Augmentation.
https://sunset1995.github.io/HorizonNet/
MIT License
324 stars 88 forks source link

3D IoU evaluation bug in `eval_general.py` #17

Closed sunset1995 closed 3 years ago

sunset1995 commented 4 years ago

Let:

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:

As B >= I and Ha >= Hb, my 3D IoU is less or equal to the correct 3D IoU.

sunset1995 commented 4 years ago

The fix: commit 2291a6