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

UpSampling operator throw error:deconvolution-inl.h:75: Check failed: (pad_y) >= (target_shape[0]) too big target shape #2823

Closed
dianyancao opened this issue Jul 24, 2016 · 8 comments

Comments

@dianyancao
Copy link

I am using UpSampling operator for image segmentation,but got this error when I add UpSampling operator:
/deconvolution-inl.h:75: Check failed: (pad_y) >= (target_shape[0]) too big target shape
The following is test code:

# coding:utf-8

import mxnet as mx
import numpy as np
import logging

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

data = mx.symbol.Variable('data')
upsample = mx.symbol.UpSampling(data,num_filter=3,scale=1,sample_type='bilinear',num_args=2,name='upsample')
softmax = mx.symbol.SoftmaxOutput(data=upsample,multi_output=True, name='softmax')

#The next two lines can work
#data = mx.symbol.Variable('data')
#softmax = mx.symbol.SoftmaxOutput(data=data,multi_output=True, name='softmax')

X = np.random.sample((100, 3, 16, 16))
Y = np.random.random_integers(0, 2, (100, 16, 16))
X_train = X[:90]
X_test = X[90:]
Y_train = Y[:90]
Y_test = Y[90:]

batch_size = 10
train_iter = mx.io.NDArrayIter(X_train, Y_train, batch_size=batch_size)
test_iter = mx.io.NDArrayIter(X_test, Y_test, batch_size=batch_size)

model = mx.model.FeedForward(
    ctx=mx.cpu(0),  # Run on GPU 0
    symbol=softmax,  # Use the network we just defined
    num_epoch=10,  # Train for 10 epochs
    learning_rate=0.1,  # Learning rate
    momentum=0.9,  # Momentum for SGD with momentum
    wd=0.00001)  # Weight decay for regularization
model.fit(
    X=train_iter,  # Training data set
    eval_data=test_iter,  # Testing data set. MXNet computes scores on test set every epoch
    batch_end_callback=mx.callback.Speedometer(batch_size, 10))  # Logging module to print out progress

How to fix this error?(The mxnet DEBUG version I can't use for debug due to this error:
#2810)

@tornadomeet
Copy link
Contributor

@dianyancao this should be a bug in deconvlution-inl.h, should wait for fix it. another, if you set num_filter=3, the the shape of Y is your example should be like (100, 3, 16, 16)

@tqchen @piiswrong
i found a strange in paramter set_defalut(), i.e. https://github.com/dmlc/mxnet/blob/master/src/operator/deconvolution-inl.h#L53
when using cout to debug, the target_shape is not (0,0) after set_default() function, but the adj is (0, 0).

@dianyancao
Copy link
Author

I now use sample_type='nearest' in UpSampling it works.I use multi_output=True in SoftmaxOutput so the shape of Y will discard channel dimension.I also print out the target_shape and adj with sample_type='bilinear',the output value sometimes changes every time when I run my big model.
Waiting for fix the bug.Thanks.@tornadomeet

@tornadomeet
Copy link
Contributor

i don't know why the default init is not work when using set_default()

@tqchen
Copy link
Member

tqchen commented Jul 28, 2016

The set_default only works after the Init function, the default value was not set to the structure after set_default.

@horserma
Copy link

horserma commented Dec 5, 2016

Any update on this? I still get the same problem

1 similar comment
@wangxuewen99
Copy link

Any update on this? I still get the same problem

@back2yes
Copy link

.........I worked on this for a whole day before realizing it was a bug.

@yajiedesign
Copy link
Contributor

This issue is closed due to lack of activity in the last 90 days. Feel free to reopen if this is still an active issue. Thanks!

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

No branches or pull requests

7 participants