Skip to content

Is it possible to use Unet for multi-output prediction? #3731

Answered by ericspod
Minxiangliu asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think it's a straight forward question of what to do with the existing UNet architecture to do something like this. The network in the blog is composed of two distinct branches and has two outputs, so the equivalent idea here could be to have distinct UNet instances for the tasks you want, and wrap these in a class that broadcasts the inputs to each. This class is what you'd pass to the training engine, and similarly you could have a wrapper around the loss functions you want to use so that they appear as one. Something like this perhaps:

class NetWrapper(nn.module):
    def __init__(self, nets):
        self.nets=nets
    def forward(self, x):
        return tuple(net(x) for net in 

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@LaiaHumbertVidan
Comment options

@ericspod
Comment options

Answer selected by Minxiangliu
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
5 participants
Converted from issue

This discussion was converted from issue #3721 on January 27, 2022 19:56.