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

Doubt when calculating mBIOU #62

Open
YZsZY opened this issue Nov 4, 2024 · 0 comments
Open

Doubt when calculating mBIOU #62

YZsZY opened this issue Nov 4, 2024 · 0 comments

Comments

@YZsZY
Copy link

YZsZY commented Nov 4, 2024

Hello author, I think there are some problems in calculating the mBIOU.

def mask_to_boundary(mask, dilation_ratio=0.02):
    h, w = mask.shape
    img_diag = np.sqrt(h ** 2 + w ** 2)
    dilation = int(round(dilation_ratio * img_diag))
    if dilation < 1:
        dilation = 1
    # Pad image so mask truncated by the image border is also considered as boundary.
    new_mask = cv2.copyMakeBorder(mask, 1, 1, 1, 1, cv2.BORDER_CONSTANT, value=0)
    kernel = np.ones((3, 3), dtype=np.uint8)
    new_mask_erode = cv2.erode(new_mask, kernel, iterations=dilation)
    mask_erode = new_mask_erode[1: h + 1, 1: w + 1]
    # G_d intersects G in the paper.
    return mask - mask_erode

The dilation_ratio is set as 0.02, for a image with Height 700 X Width 900,the dilation iterations will be 24! The final mask will be an empty mask as shown below:
image
The binary you get at the end is actually the same as the input Mask (with erode 20x->empty mask), then the calculated mBIOU is actually the same as the mIOU.
Looking for your reply~

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