Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Example on Deconvolution Layer's Configuration #1514

Closed
tmquan opened this issue Feb 21, 2016 · 5 comments
Closed

Example on Deconvolution Layer's Configuration #1514

tmquan opened this issue Feb 21, 2016 · 5 comments

Comments

@tmquan
Copy link

tmquan commented Feb 21, 2016

Dear mxnet community,

The current documentation on Deconvolution layer is somehow difficult to catch up.
In particular, I want to reproduce u-net (for image segmentation purpose) available at http://lmb.informatik.uni-freiburg.de/people/ronneber/u-net/
alt text

I stopped by the example https://github.com/dmlc/mxnet/blob/master/example/fcn-xs/symbol_fcnxs.py
and its utilization is still fuzzy, too.

Could you give me some direction (or example) how to use Deconvolution layer for such image segmentation task as follows:
I have a collection of n training volume images (t+xy) and their associative segmentation
(n, 64, 128, 128) ~> (n, 64, 128, 128)
where n is number of training instances, 64 is the temporal dimension, 128 is the spatial dimension.
How to construct a simple fully convolutional network using mxnet on this problem?
data ~> convolutional layer ~> pooling (downsample by 2) ~> deconvolutional layer ~> Upsampling by 2 ~> segmentation?

Thanks a lot

@piiswrong
Copy link
Contributor

deconvolution with 2x upsampling can be done like this:

scale = 2
pred1 = mx.symbol.Deconvolution(data=pred1, kernel=(2*scale, 2*scale), stride=(scale, scale), pad=(scale/2, scale/2), num_filter=33, no_bias=True, workspace=workspace, name=prefix+'deconv_pred1')

@tmquan tmquan closed this as completed Feb 23, 2016
@tmquan tmquan reopened this Feb 23, 2016
@tmquan
Copy link
Author

tmquan commented Feb 23, 2016

Thanks @piiswrong ,
I have another question regarding to the prediction.
My prediction is a segmented image (256x256) which has 2 classes (membrane at value 0 and non-membrane at value 255). In this case, how to write a softmax layer? (as the network can output the right image)

alt text

I appreciate your helps a lot.

Sincerely,

@ascust
Copy link

ascust commented Mar 15, 2016

I think you should define your label as 0 and 1, where 0 is membrane and 1 is not. It is not a good option to use 255 unless you want this label to be ignored. @tmquan

@tmquan
Copy link
Author

tmquan commented Mar 15, 2016

@ascust
Thank you for response in this thread.
Actually, I tried that too as following:
I set the output from the network as (30,2,512,512) where (30,:0:,512,512) is the label of non-membrane and (30,:1:,512,512) for membrane classification.

Then I set the deconvolutional output as a LogisticRegressionOutput as following:
sm = mx.symbol.LogisticRegressionOutput(data=deconv_out, name="softmax")

In contrast, the example on fcn-xs folder said that I should use the SoftmaxOutput layer to make a prediction on entire segmentation.

It confused me and I am struggling with that issue quite a bit.

Best regards,

@ascust
Copy link

ascust commented Mar 15, 2016

LogisticRegressionOutput is for binary classification, it is supposed to work. Since I never use this layer before, I can not say much about it. Anyway, SoftmaxOutput is for Multiclass classification and binary classification is only a special case, I am sure this will work. Just like your settings, if 30 is your batch size, there is a (2, 512, 512) score map for each image in the batch. For prediction task, you can simply choose use argmax along the first axis.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants