0

Edit: Basically I need advice on the following:
Given a collection of 100 images (256,256,3), broken up into 4 quads of (128,128,3), how do I pass that to a model that required 4 inputs (the 4 quads)?

Edit 2: I've done some more fiddling with a more specific script. Like I originally thought, it is meant to be a list of x inputs, which are arrays with whatever shape defined. But I've modified my code to do that and it still doesn't work. Here's a dump form the console, including prints for the trainX len, the trainX[0] shape and the expected inputs:

Edit 3: Be sure to check your outputs as well as our inputs.

Using TensorFlow backend. Start Fit - round: 0 trainX length: 4 trainX[0] shape: (92, 128, 128, 3) Expected Model inputs: [<tf.Tensor 'input_1:0' shape=(?, 128, 128, 3) dtype=float32>, <tf.Tensor 'input_2:0' shape=(?, 128, 128, 3) dtype=float32>, <tf.Tensor 'input_3:0' shape=(?, 128, 128, 3) dtype=float32>, <tf.Tensor 'input_4:0' shape=(?, 128, 128, 3) dtype=float32>] Traceback (most recent call last): File "D:\Func\FuncTest.py", line 193, in <module> verbose = 1) File "D:\FtPrnt\Keras\lib\site-packages\keras\engine\training.py", line 1574, in fit batch_size=batch_size) File "D:\FtPrnt\Keras\lib\site-packages\keras\engine\training.py", line 1411, in _standardize_user_data exception_prefix='target') File "D:\FtPrnt\Keras\lib\site-packages\keras\engine\training.py", line 88, in _standardize_input_data '...') ValueError: Error when checking model target: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 1 array(s), but instead got the following list of 4 arrays: [array([[[ 255., 255., 255., ..., 255., 255., 255.], [ 255., 255., 255., ..., 255., 255., 255.], [ 255., 255., 255., ..., 255., 255., 255.], ..., [ 0....

I'm dabbling in the functional API and am playing around with multiple inputs. But I have been unable to get it to work properly.

I've tested my model with a single input and it works fine, but adding the multiple inputs and a concatenation fails.

My test is loading a single image, splitting it up into quaters, then pushing that into the network through 4 inputs.

I've tried nearly every combination of list and numpy array I can think off, but each time I'm getting.

My understanding is that I should be providing a list of (four) inputs, which are arrays with a shape of (samples, img_dim_x, img_dim_y, img_layers). But whenever I tried this, it didn't work.

After some looking around, I saw somewhere that the array should be the number of samples. So I tried that, which also failed. My current code follows this idea, with providing a list with a length of samples, containing an array with a shape of (inputs, img_dim_x, img_dim_y, img_layers)

  • What is the error? – Daniel Möller Nov 23 '17 at 03:59
  • With the code I posted, the error is: `ValueError: 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 4 array(s), but instead got the following list of 92 arrays` Fairly obvious, but other things I've tried have come back with similar errors; including "Expected 1 array, but got 4 arrays" and "Expected 4 arrays and got 1 array" I just kinda want to know what I should be passing to the fit(inputs). – Aaron Charcoal Styles Nov 23 '17 at 04:30
  • You should indeed pass a list with four numpy arrays. All arrays should have the same number of elements in the first dimension. Each array should match the shape of the respective input you listed in `Model(inputs=[input1,input2, input3,input4], ...)` – Daniel Möller Nov 23 '17 at 10:18
  • Turn out the errors weren't wrong inputs, but wrong outputs. FML – Aaron Charcoal Styles Nov 23 '17 at 21:18

0 Answers0