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

Clipping [0,1] as postprocessing step #149

Open
mg515 opened this issue Feb 21, 2024 · 1 comment
Open

Clipping [0,1] as postprocessing step #149

mg515 opened this issue Feb 21, 2024 · 1 comment

Comments

@mg515
Copy link

mg515 commented Feb 21, 2024

Hey. I was hoping someone can explain the reasoning behind [0,1] clipping as a postprocessing step in order to obtain "the mask with the probability of the presence of the class in the image". It seems to me that uncontrolled clipping the model outputs can be rather dangerous, since the logits that come out of the model are unconstrained. In case there is a softmax layer applied already within onnx graph, clipping does nothing either way.

Context: I am trying out different probability thresholds from within the UI and can not observe much of a difference between setting 0.01 and 0.99 (I have a binary segmentation task). What is the recommended way to prepare the model to enable this?

labels = np.clip(model_output[0], 0, 1)

@przemyslaw-aszkowski
Copy link
Contributor

Hi
The assumption for the segmentation model is it should return the probability in the range 0 - 1.
I think you may be right, the clip is not needed. Regarding the issue you described - if you have only one output class, then this class will be always picked as the most probably, even while having 0 probability, as we have argmax at the end.
To achieve what you described, you should add another output class to your model ("background" class at output number 0).
Cheers
Przemek

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