Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in calculating IoU #6

Open
zhigangjiang opened this issue Sep 20, 2021 · 0 comments
Open

Error in calculating IoU #6

zhigangjiang opened this issue Sep 20, 2021 · 0 comments

Comments

@zhigangjiang
Copy link

zhigangjiang commented Sep 20, 2021

HI, Thanks for your work.
However, I recently found that there are unreasonable situations in calculating IoU, which may lead to errors.

Use image to calculate IoU in your code:

def IoU_2D(pred, gt, dummy_height1=None, dummy_height2=None):
    intersect = np.sum(np.logical_and(pred, gt))
    union = np.sum(np.logical_or(pred, gt))
    iou_2d = intersect / union

    return iou_2d

Calculate IoU using polygon in HorizonNet code:

dt_poly = Polygon(dt_floor_xy)
gt_poly = Polygon(gt_floor_xy)

# 2D IoU
area_dt = dt_poly.area
area_gt = gt_poly.area
area_inter = dt_poly.intersection(gt_poly).area
iou2d = area_inter / (area_gt + area_dt - area_inter)

When I set fp_meters=20 in config file:

image
Use the floor plan image to calculate IoU2D: 0.8690
Use the floor plan polygon to calculate IoU2D: 0.8722


image
Use the floor plan image to calculate IoU2D: 0.7491
Use the floor plan polygon to calculate IoU2D: 0.6429

It can be found that there is error in the different calculation.My test results show that the IOU calculated using images is generally greater than that calculated using polygon in Matterport3D's test dataset. I think one reason is that the radius of many layouts stored in the test set exceeds fp_meters, so they are not included in the floor plan image.


I tried to modify fp_meters to a larger value, but the error caused by pixel rounding is enlarged. When I set fp_meters=50 in config file:

image
Use the floor plan image to calculate IoU2D: 0.8934
Use the floor plan polygon to calculate IoU2D:0.8722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant