Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting an error #19

Closed
alimsvn opened this issue Apr 20, 2019 · 3 comments
Closed

getting an error #19

alimsvn opened this issue Apr 20, 2019 · 3 comments

Comments

@alimsvn
Copy link

alimsvn commented Apr 20, 2019

after running the training model.fit ... I'v got this error :
ValueError: Error when checking target: expected sigmoid to have shape (None, None, 1) but got array with shape (256, 256, 3)

@mahfuzmohammad
Copy link
Collaborator

You have configured your model to have 1 class as output but your ground truth has 3 channels which are considered as 3 classes. Please use classes parameter to set the correct number of classes.

Or maybe your ground truth has only one class but your ground truth is in RGB. In that case, you need to change it to grayscale.

Hope it helps!

@alimsvn
Copy link
Author

alimsvn commented Apr 21, 2019

Thank you for your prompt reply;
My training data and its ground truth are both grayscale and the output is 1 class. When I insert grayscale images and classes parameter is 1 , I receive this error :
ValueError: Error when checking input: expected data to have shape (None, None, 3) but got array with shape (128, 128, 1)
and when I Convert images to RGB I get the first one.
Would you please give me an example of simple loader which loads grayscale png pictures and masks as x_train and y_train or the code you used to convert and save pictures as npy format.
Greate Thanks.

@jcarta
Copy link

jcarta commented Jul 20, 2020

I am having the same issue. My images are (256,256,1) grayscale and I am only predicting foreground vs background.

Here is my error: Error when checking input: expected data to have shape (None, None, 3) but got array with shape (256, 256, 1)

Do we have to update these flags?

def Xnet(backbone_name='vgg16', input_shape=(None, None, 3), input_tensor=None, encoder_weights='imagenet', freeze_encoder=False, skip_connections='default', decoder_block_type='upsampling', decoder_filters=(256,128,64,32,16), decoder_use_batchnorm=True, n_upsample_blocks=5, upsample_rates=(2,2,2,2,2), classes=1, activation='sigmoid'):

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

No branches or pull requests

3 participants