What is the correct way to zip multiple inputs into a


I have a multi input model with a single target variable

After a lot of trial and error (and countless hours on SO) I’ve come this far

#reads in filepaths to images from dataframe train

images =

#converts labels to one hot encoding vector

target = tf.keras.utils.to_categorical(

train.Label.to_numpy(), num_classes=n_class, dtype=’float32′


#reads in the image and resizes it


#zips the former according to


input_1 =, target))

dataset =, target))

and I think this is almost the solution, but the second input shape get’s distorted.

Because I get a warning that input expected is (None, n_class)

But it received an input of (n_class, 1)

And an error:

ValueError: Shapes (n_class, 1) and (n_class, n_class) are incompatible

I checked though, the shapes from to_categorical is correct, it’s num_examples, n_class

Could someone help an utterly confused me out?

Thanks a lot!

submitted by /u/obolli
[visit reddit] [comments]

Leave a Reply

Your email address will not be published. Required fields are marked *