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

Add 2D bilinear upsampling layer #857

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

christopher-beckham
Copy link

Hi,

After being frustrated so many times with deconvolution artifacts, I decided to try out bilinear upsampling and it turns out this already existed in Theano, so I thought it would be reasonable to contribute this as a layer to Lasagne. I have tried this so far with some of my research involving pix2pix (conditional image-to-image translation with GANs), and the use of this + followed by a shape-preserving convolution (i.e., a conv with padding=same) gave me much better outputs than simply using deconv!

You can read more about it here:

http://distill.pub/2016/deconv-checkerboard/

Admittedly, my unit test test_get_output_for is a bit crude -- it simply checks the output shape, and not against a Numpy implementation of bilinear upsampling. Apart from that, everything seems to look ok. Feel free to offer suggestions, etc. I'd love to see this kind of layer upstream.

@f0k
Copy link
Member

f0k commented Jul 31, 2017

Thank you for the contribution and sorry for the late reply, I've been busy with my thesis.

gave me much better outputs than simply using deconv!

The easier / more efficient solution that popped up in between may be #862.

Still, bilinear upsampling would be nice. What about adding this as a different mode to Upscale2DLayer instead? We could have "bilinear" for all-in-one and "bilinear1d" for separate passes per dimension. It's nice that the complexity of creating the kernels and convolution expressions is hidden away in Theano.

@christopher-beckham
Copy link
Author

Interesting, yes, I think it would be cleaner to have this as an option for Upscale2D. I'll have a look at that paper too.

@f0k
Copy link
Member

f0k commented Aug 1, 2017

Interesting, yes, I think it would be cleaner to have this as an option for Upscale2D.

Would you like to work on this?

@christopher-beckham
Copy link
Author

Hi f0k, gahhh sorry for that one month delay... looks like we've both been swamped. Yes, absolutely, I'd be happy to. Let me try get back to you next week.

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

Successfully merging this pull request may close these issues.

None yet

2 participants