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

Segmentation metrics is nan when n_true_groups == 1 #2

Open
wetliu opened this issue Sep 19, 2019 · 0 comments
Open

Segmentation metrics is nan when n_true_groups == 1 #2

wetliu opened this issue Sep 19, 2019 · 0 comments

Comments

@wetliu
Copy link

wetliu commented Sep 19, 2019

Hello. According to the comment:

# The case where n_true_groups == n_pred_groups == 1 needs to be
   # special-cased (to return 1) as the above formula gives a divide-by-zero.
# This might not work when true_mask has values that do not sum to one:

I understand both_single_cluster is handling this corner case.

What I am confused is this function: https://github.com/deepmind/multi_object_datasets/blob/master/segmentation_metrics.py#L97. It seems to me it makes sense when it is applied to ground truth masks as _all_equal(true_group_ids) , but when it is applied to _all_equal(pred_group_ids), the prediction slot for object may not necessarily be "the first slot" as suggested by values[..., :1].

May I ask if it is corner case missing in this implementation?

Thank you!

More specifically, your code first finds the argmax of the tensor with shape [bs, n_pixels, n_classes] over the last axis. Assume n_classes == 3, then because my prediction for object is in slot 3, I believe that argmax will return two values, 3 for the pixels with objects and 1 for pixels exclude the object, as argmax returns 1 by default if all values are equal. It seems to me that this will lead to a wrong condition in your ARI value.

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