Getting that error in Keras. Scenario: Input:
- Images with train shape as (50000, 32, 32, 3)
- Aux input with shape (50000, 1)
- Ground truth: (50000, 1)
This is model fit code
x_train_input = Input(shape=(32,32,3))
aux_rand_input = Input(shape=(1,))
out = model_inst.build_model(x_train_input, aux_rand_input)
model = Model(inputs=[x_train_input, aux_rand_input], outputs=[out])
model.fit(x=[x_train, aux_input], y=y_train, batch_size=batch_size, steps_per_epoch=x_train.shape[0] // batch_size, epochs=maxepoches, validation_data=(x_test, y_test), callbacks=[reduce_lr, tensorboard], verbose=2)
Got this error when running this.
Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 2 array(s), but instead got the following list of 1 arrays:
And this is how build_model's last few layers look like.
flatten = Flatten()(drop_5)
# aux_input = Input(shape=(1,))
concat = Concatenate(axis=1)([flatten, aux_input])
fc1 = Dense(512, kernel_regularizer=regularizers.l2(weight_decay))(concat)
fc1 = Activation('relu')(fc1)
fc1 = BatchNormalization()(fc1)
fc1_drop = Dropout(0.5)(fc1)
fc2 = Dense(self.num_classes)(fc1_drop)
out = Activation('softmax')(fc2)
return out