facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.95k forks source link

Question about Using ConvTranspose for Upsampling #1482

Open chengchihyu opened 6 years ago

chengchihyu commented 6 years ago

Hello,

I'm trying to use caffe2's ConvTranpose and set stride > 1 for resolution upsampling. What is the algorithm of the upsampling ? (bilinear, nearest neighbor, or just fill 0) i.e. the algorithm of deriving the white grid value in the figure in follow link (which is the case of transpose convolution with 3x3 kernel and stride = 2). https://i.stack.imgur.com/f2RiP.gif

Thanks

rribani commented 6 years ago

I have the same question. I'm trying to implement an autoencoder using ConvTranspose, but there is no unpooling or upsample operation. How to do that?

rribani commented 6 years ago

I did this by performing 2 conv_transpose operations, the first one for the deconvolution itself and the second one for upscaling (using kernel=2 and stride=2):

upconv1 = brew.conv_transpose(model, in_blob, "upconv1", dim_in=64, dim_out=1, kernel=3, pad=1)
upsample1 = brew.conv_transpose(model, upconv1, "upsample1", dim_in=1, dim_out=1, kernel=2, stride=2)
sefira commented 6 years ago

Maybe UpsampleNearestOp is what you need~