I'm trying to make a multichannel neural network that has 2 input models that pipeline into a single model (see image: https://i.stack.imgur.com/b6V7x.png ).

I need the first (top/left) channel to take in one tensor, and the second channel to take in three tensors. Of course, in doing so, I'm running into the issue of ambiguous data cardinality, because I'm comparing the output to the y_train set which is only 1 tensor.

Here's the error I'm getting:

ValueError: Data cardinality is ambiguous: x sizes: 1, 3 y sizes: 2

What's the best way to make this work?

Here's essentially what I have at the moment for fitting the data to the model:

model_history = trmodel.fit((np.array([model_images[0]], dtype=np.float32), np.array([model_images[1], model_images[2], model_images[3]], dtype=np.float32)), np.array(labels_seconds, dtype=np.float32), batch_size=32, epochs=2000, validation_data=(labels_seconds,), callbacks=[checkpoint])

It's been some time since I've worked with Keras, and I've never needed a multichannel network until now, so my apologies for my rustiness in the process. I can post the full code if that would help, also.

More Daniel Szelogowski's questions See All
Similar questions and discussions