Keras-FCN icon indicating copy to clipboard operation
Keras-FCN copied to clipboard

ValueError: Error when checking target: expected bilinear_up_sampling2d_1 to have shape (None, 320, 320, 21) but got array with shape (16, 320, 320, 1)

Open d13g0 opened this issue 7 years ago • 6 comments

I am running your code (train.py) "as is" without any modification from the repo and after downloading the VOC dataset (following your instructions).

I am getting the error:

ValueError: Error when checking target: expected bilinear_up_sampling2d_1 to have shape (None, 320, 320, 21) but got array with shape (16, 320, 320, 1)

inside fit_generator > train_on_batch > _standarize_input_data (keras.engine.training)

Can you comment on this problem? thanks.

d13g0 avatar Jan 11 '18 23:01 d13g0

I have exactly the same problem. Right now I'm trying with different versions of tensorflow-gpu/Keras, in case that it be a version issue. Regards.

Edit: the error was solved installing a version of Keras >=2.1.2

F951 avatar Jun 19 '18 14:06 F951

Same problem here. Currently using Keras 2.2.4. Does anyone know how to fix this? Thanks a lot.

musematics avatar Nov 13 '18 02:11 musematics

Um... I ve just found that the format of my training labels (which contains only one channel) is inconsistent with the network. If training a binary classifier, an additional conv layer would help.

musematics avatar Nov 13 '18 12:11 musematics

I use keras == 2.1.6, error was solved.[my environment: python3.5, tf-1.4.2]

SuperBlc avatar Dec 20 '18 07:12 SuperBlc

Um... I ve just found that the format of my training labels (which contains only one channel) is inconsistent with the network. If training a binary classifier, an additional conv layer would help.

Hi,I am also using this network to train binary segmentation and I also get a similar error. Can you give me some points about adding an additional conv layer? Many thanks...

shiliu0111 avatar Jun 13 '19 15:06 shiliu0111

Um... I ve just found that the format of my training labels (which contains only one channel) is inconsistent with the network. If training a binary classifier, an additional conv layer would help.

Hi,I am also using this network to train binary segmentation and I also get a similar error. Can you give me some points about adding an additional conv layer? Many thanks...

This error might be caused by different issues. Here is my case. I added the following line: x = Conv2D(1, 1, activation = 'sigmoid')(x) above the line: model = Model(img_input, x) in model.py Hope it helps!

musematics avatar Jun 14 '19 02:06 musematics