Course 4, week 3: How U-net model handle odd input dimensions?

How does U-net model handle the case when the input dimensions are odd or dimensions of one of the layer during the downsampling are odd? In that case the concatenate step will have some troubles.

For example, given an input shape of (120, 120) (We ignore the 3rd dimension here), then after a certain number of MaxPooling layers to half the size of input , we will get an odd dimension. Then later on we will have troubles concatenating the skip connection to the upsampling block:

image

In this case, should we modify the U-net model (like padding) or resize our input?

An interesting question to ponder upon…give me some time and I will get back to you on this
Thanks

Can you refer to the solution given at this link and let me know if it helps
Ps:- Actual solution is independent of PyTorch Tensorflow,so dont worry about the title

Thanks

Thank you so much! I think this helps. It looks like a pretty subtle but common issue in U-net. I think it’s probably worth mentioning this in future lecture

Glad it helped you sir! I will surely pass on the recommendation to the team
Thanks and Regards,
Mayank Ghogale