Discussion:
[theano-users] Implementing Deconvolution layer for Upsampling
sidharth manohar
2016-06-04 10:41:59 UTC
Permalink
Hi all,
I've been trying to assemble the FCN32s network(*this one
<http://people.eecs.berkeley.edu/%7Ejonlong/long_shelhamer_fcn.pdf>*) by J
Long et al. in Theano . I downloaded the caffe model from *here
<https://github.com/shelhamer/fcn.berkeleyvision.org>*. I exported the
weights of all the layers from caffe to theano. It is possible to replicate
the same results till the 'score_fr' layer. What I cannot implement is the
Deconvolution Layer. From the prototext file of the Caffe Model, the
deconvolution layer is:

layer {
name: "upscore"
type: "Deconvolution"
bottom: "score_fr"
top: "upscore"
param {
lr_mult: 0
}
convolution_param {
num_output: 21
bias_term: false
kernel_size: 64
stride: 32
}
}
.

So, I have the filter corresponding to this layer( of size (21,21,64,64) ).
Is there a way to implement this layer in Theano?
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Pascal Lamblin
2016-06-04 22:37:16 UTC
Permalink
What Caffe calls deconvolution is actually transposed convolution,
corresponding to the gradient of a convolution wrt its inputs.

It can be implemented using conv2d_grad_wrt_inputs [1]. Actually,
Lasagne (at least) has such an implementation. You just have to make
sure the the filter is used in the same way (be careful of convolution
vs. cross-correlation, or "filter flipping").

[1] https://github.com/Theano/Theano/blob/master/theano/tensor/nnet/abstract_conv.py#L141
Post by sidharth manohar
Hi all,
I've been trying to assemble the FCN32s network(*this one
<http://people.eecs.berkeley.edu/%7Ejonlong/long_shelhamer_fcn.pdf>*) by J
Long et al. in Theano . I downloaded the caffe model from *here
<https://github.com/shelhamer/fcn.berkeleyvision.org>*. I exported the
weights of all the layers from caffe to theano. It is possible to replicate
the same results till the 'score_fr' layer. What I cannot implement is the
Deconvolution Layer. From the prototext file of the Caffe Model, the
layer {
name: "upscore"
type: "Deconvolution"
bottom: "score_fr"
top: "upscore"
param {
lr_mult: 0
}
convolution_param {
num_output: 21
bias_term: false
kernel_size: 64
stride: 32
}
}
.
So, I have the filter corresponding to this layer( of size (21,21,64,64) ).
Is there a way to implement this layer in Theano?
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
For more options, visit https://groups.google.com/d/optout.
--
Pascal
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
sidharth manohar
2016-06-10 09:26:27 UTC
Permalink
Thank you so much Pascal.
I was finally able to implement the Deconvolution Layer in theano.This
replicates the deconvolution layer in caffe:

deconv_op =
T.nnet.abstract_conv.AbstractConv2d_gradInputs(imshp=output_shape,
kshp=filter_shape, border_mode='valid', subsample=(32,32), filter_flip =
False)

output = deconv_op(filters, input, output_shape[2:])
Post by Pascal Lamblin
What Caffe calls deconvolution is actually transposed convolution,
corresponding to the gradient of a convolution wrt its inputs.
It can be implemented using conv2d_grad_wrt_inputs [1]. Actually,
Lasagne (at least) has such an implementation. You just have to make
sure the the filter is used in the same way (be careful of convolution
vs. cross-correlation, or "filter flipping").
[1]
https://github.com/Theano/Theano/blob/master/theano/tensor/nnet/abstract_conv.py#L141
Post by sidharth manohar
Hi all,
I've been trying to assemble the FCN32s network(*this one
<http://people.eecs.berkeley.edu/%7Ejonlong/long_shelhamer_fcn.pdf>*)
by J
Post by sidharth manohar
Long et al. in Theano . I downloaded the caffe model from *here
<https://github.com/shelhamer/fcn.berkeleyvision.org>*. I exported the
weights of all the layers from caffe to theano. It is possible to
replicate
Post by sidharth manohar
the same results till the 'score_fr' layer. What I cannot implement is
the
Post by sidharth manohar
Deconvolution Layer. From the prototext file of the Caffe Model, the
layer {
name: "upscore"
type: "Deconvolution"
bottom: "score_fr"
top: "upscore"
param {
lr_mult: 0
}
convolution_param {
num_output: 21
bias_term: false
kernel_size: 64
stride: 32
}
}
.
So, I have the filter corresponding to this layer( of size (21,21,64,64)
).
Post by sidharth manohar
Is there a way to implement this layer in Theano?
--
---
You received this message because you are subscribed to the Google
Groups "theano-users" group.
Post by sidharth manohar
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Pascal
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...