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

Prediction to image #14

Closed
lfangyu09 opened this issue Dec 7, 2020 · 3 comments
Closed

Prediction to image #14

lfangyu09 opened this issue Dec 7, 2020 · 3 comments

Comments

@lfangyu09
Copy link

Hi,

Thanks a lot for providing this very useful code. I have a question about your code. Because I saw you used different thresholds to binarize the predicted image, I wonder how the prediction is changed to an image? prediction of the model -> sigmoid -> *255 to array -> image? Thanks!

@yhlleo
Copy link
Owner

yhlleo commented Dec 11, 2020

Hi, @lfangyu09

Do you mean that how we get the predicted images?

If yes, we call the function model.test() first, which indeed run forward(). Then you can find the predicted results from the model: codes. Given the outputs of sigmoid function are with the range of [0, 1], I transformed it to be with the range of [-1, 1] (util. tensor2im requires the input images are with the range [-1, 1]).

In this inference procedure, we don't binarize the image with any thresholds. The thresholds are selected through the PR curve in the evaluation procedure.

@lfangyu09
Copy link
Author

Hi,

Thanks a lot for your reply. If you change the outputs into the range of [-1,1], how do you save these outputs into images? Because I want to evaluate the output by using precision, recall, and so on. Thanks!

@yhlleo
Copy link
Owner

yhlleo commented Dec 11, 2020

util.tensor2im converts the image with the range of [-1, 1] to [0, 255].

Then, you can evaluate the precision and recall with the saved images.

@yhlleo yhlleo closed this as completed Dec 11, 2020
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