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

Error Training FCN model on a more simplified network structure #1789

Closed
Viswa14 opened this issue Apr 5, 2016 · 6 comments
Closed

Error Training FCN model on a more simplified network structure #1789

Viswa14 opened this issue Apr 5, 2016 · 6 comments

Comments

@Viswa14
Copy link

Viswa14 commented Apr 5, 2016

@tornadomeet @piiswrong I try to train FCN model in a somewhat more simplified way, For Example : for FCN 32 model I try to omit group4 or vgg16_pool4() method:
In code:
def fcnxs32_symbol():
{
data = mx.symbol.Variable(name="data")
pool3 = vgg16_pool3(data, workspace_default)
score = vgg16_score(pool3, numclass, workspace_default)
softmax = fcnxs_score(score, data, offset()["fcn32s_upscore"], (4,4), (1,1), numclass, workspace_default)
return softmax
}

I get an Error as
/mxnet/dmlc-core/include/dmlc/logging.h:241: [19:07:56] src/operator/./crop-inl.h:103: Check failed: (data_shape[2]) >= (out_shape[2]) data_shape'height should be larger than that of out_shape

Note: From my understanding I find the error occurs due to the following calculation
upscore = mx.symbol.Crop(*[bigscore, crop], offset=offset, name="upscore")

and I tried several values for offset even (0,0) but still get the same error. I want my Kernel Size to be so small as I am dealing with micro size objects. Appreciate your kind help in figuring out what Am I missing here?

@Viswa14
Copy link
Author

Viswa14 commented Apr 5, 2016

@tornadomeet @piiswrong

I had defined my Offset as follows

def offset():
conv1_1_fp = filter_map(kernel=3, pad=100)
conv1_2_fp = conv2_1_fp = conv2_2_fp = conv3_1_fp = conv3_2_fp = conv3_3_fp
= conv5_1_fp = conv5_2_fp
= conv5_3_fp = filter_map(kernel=3, pad=1)
pool1_fp = pool2_fp = pool3_fp = pool5_fp = filter_map(kernel=2, stride=2)
fc6_fp = filter_map(kernel=5)
fc7_fp = score_fp = score_pool3_fp = filter_map()
# for fcn-32s
fcn32s_upscore_fp = inv_fp(filter_map(kernel=4, stride=1))
fcn32s_upscore_list = [conv1_1_fp, conv1_2_fp, pool1_fp, conv2_1_fp, conv2_2_fp,
pool2_fp, conv3_1_fp, conv3_2_fp, conv3_3_fp, pool3_fp,
conv5_1_fp, conv5_2_fp, conv5_3_fp, pool5_fp, fc6_fp, fc7_fp, score_fp,
fcn32s_upscore_fp]
crop = {}
crop["fcn32s_upscore"] = (-int(round(compose_fp_list(fcn32s_upscore_list)[1])),
-int(round(compose_fp_list(fcn32s_upscore_list)[1])))
return crop

@tornadomeet
Copy link
Contributor

@Viswa14 sorry for late replay, you may use pdb to debug the return value of offset(), and make sure it is corretly for your symbol. on the other hand, i think your symbol define maybe wrong for the deconvotion kernel/stride paramter in fcnxs_score, be careful to check the kernel/stride for your use.

@Viswa14
Copy link
Author

Viswa14 commented Apr 13, 2016

@tornadomeet : How do we decide deconvolution stride or kernel ? and does Deconvolution operation by default use upsampling in Mxnet ? According to Issues #1514 @piiswrong says 2X upsampling can directly be done through using kernel = (4,4) and stride = (2,2) , is that true ? I am looking forward to construct a very simple Convolution - Pooling (downsample by two) -> Convolution - Pooling (Downsample by two) -> Special convolutions (similar to fc6 , fc7 in fcnxs to represent fully connected layer) -> Deconv (upsample by 2) -> Deconv (upsample by 2) -> SoftmaxOutput (Segmentation) ? and I am not sure how to do unpooling or upsampling for deconvolution layer ? Can you just chime in your ideas ?

@tornadomeet
Copy link
Contributor

kernel = (4,4) and stride = (2,2), pad=(1,1) can be one triple parameter used for upsampling 2X, of course, your can use other triple combination, the formula can refer to it's output shape of deconv operator:https://github.com/dmlc/mxnet/blob/master/src/operator/deconvolution-inl.h#L327-L330

@Viswa14
Copy link
Author

Viswa14 commented Apr 13, 2016

When Upsampling can be enforced using deconv operator, why do we use a separate upsample_filt method in init_fcnxs.py for deconv parameters? https://github.com/dmlc/mxnet/blob/master/example/fcn-xs/init_fcnxs.py#L40-L42

@tornadomeet
Copy link
Contributor

use bilinear interpolation for deconv init

@Viswa14 Viswa14 closed this as completed Apr 28, 2016
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

2 participants