2
$\begingroup$

I've gone through the paper describing the UNet convolutional neural network a number of times, but am still having trouble figuring out how to connect the output of the network to the ground truth targets. Below is an image depicting the architecture of the network.

As can be seen from the figure, the output is a 388 x 388 x k matrix (where k is the number of classes). The target segmentation in this case should be 572 x 572 (same spatial dimensions as the input image). How do we match these up? Are we suppose to perform some kind of interpolation on the output feature map to get it to match the dimensionality of the input?

$\endgroup$
  • $\begingroup$ Hi, did you find any solution to this problem? One way is to use padding in the conv layers, apart from this, is there any other way? like extracting patches from the mask of the same shape as that of the output of the model or something? $\endgroup$ – Rishabh Agrahari Mar 22 '18 at 17:04
2
$\begingroup$

It depends on how your UNet architecture is constructed.

In the example image you've shown, the output of the first few layers of convolutions is cropped to 392x392 before it's copied over to the input of the final convolutional layers. Then, it's decreased to 388x388 by convolution without padding. For the example, you're probably best off cropping your image to 392x392, then scaling down to 388x388, as the lost resolution due to the convolution is more analogous to scaling than cropping.

You could also construct the network to output an image of the same dimensionality to avoid this issue. The downside to this approach is that the network will produce some strange/poor results near the boundaries of the image, so you're spending computational power on pixels you will need to disregard anyway.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.