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

Using "segmentation_models_pytorch" with Unet++ #4

Open
alqurri77 opened this issue Jan 28, 2024 · 5 comments
Open

Using "segmentation_models_pytorch" with Unet++ #4

alqurri77 opened this issue Jan 28, 2024 · 5 comments

Comments

@alqurri77
Copy link

was trying to use segmentation_models_pytorch with Unet++. I tried to look at the example at HuBMAP - Pytorch smp Unet++. My understanding Unet++ returns 4 outputs (as part of deep supervision). But in the example, I notice it is only returning one output. I think I'm missing something here.

@isaaccorley
Copy link
Owner

isaaccorley commented Jan 28, 2024

Hi @alqurri77, I didn't write the initial smp implementation of UNet++ or the tutorial but I think you're right that the model should be able to optionally return the intermediate outputs for deep supervision. I'll make an issue and get a PR going for this. Stay tuned!

Thanks!

@alqurri77
Copy link
Author

Thank you very much, Issac!

@notprime
Copy link

notprime commented Feb 23, 2024

Hi @alqurri77 ,

I'm commenting to add infos and specify what we need to be implement.
Yes, you are right, for deep supervision we have to store the intermediate outputs of all hidden layers, both from encoder and decoder, so that we can compute the discrepancy between the decoder block's output and the corresponding down-sampled version from the encoder block.
By the way, deep supervision can be used with any model, so we should return the ouputs if needed for each model.
Now, I believe there are different papers exploring different discrepancy losses, like MSE, Cross entropy or classic segmentation losses, there is not an heuristic on which one is better.
We can simply return the necessary feature maps and leave the loss computation in the hands of the user, what do you think @isaaccorley ?

A couple of references:

@isaaccorley
Copy link
Owner

Yes, my initial thoughts for this are to have an optional arg which tells the decoder and overall model to return the encoder and intermediate decoder outputs in the forward call.

@alqurri77
Copy link
Author

Yes, that sounds good! @notprime @isaaccorley

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

3 participants