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

Is it able to output a probability or confidence for the segmentation result at every pixel? #318

Open
wen-monster opened this issue Sep 19, 2024 · 1 comment

Comments

@wen-monster
Copy link

Limited by VRam, my mulit-obj tracking job need to be split. As a result, some objects may overlap. Therefore, can the model export not only 0or1 but also an float evaluation standard for later decision.

@heyoeyo
Copy link

heyoeyo commented Sep 23, 2024

The raw output of the model (referred to as out_mask_logits in the video notebook) is already a sort of confidence score for each pixel, where large positive values represent higher confidence. To make it more like a probability, you can pass it through a sigmoid function, to map it between 0.0 and 1.0:

# Video segmentation loop
for out_frame_idx, out_obj_ids, out_mask_logits in predictor.propagate_in_video(inference_state):
  per_pixel_mask_prob = torch.sigmoid(out_mask_logits)

Written this way, the binary masked pixels would come from checking pixels with a value > 0.5. That is:

binary_mask = torch.sigmoid(out_mask_logits) > 0.5

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

2 participants