How to use fit_generator with multiple inputs

Try this generator: def generator_two_img(X1, X2, y, batch_size): genX1 = gen.flow(X1, y, batch_size=batch_size, seed=1) genX2 = gen.flow(X2, y, batch_size=batch_size, seed=1) while True: X1i = genX1.next() X2i = genX2.next() yield [X1i[0], X2i[0]], X1i[1] Generator for 3 inputs: def generator_three_img(X1, X2, X3, y, batch_size): genX1 = gen.flow(X1, y, batch_size=batch_size, seed=1) genX2 = gen.flow(X2, y, batch_size=batch_size, seed=1) genX3 … Read more

How can I use a pre-trained neural network with grayscale images?

The model’s architecture cannot be changed because the weights have been trained for a specific input configuration. Replacing the first layer with your own would pretty much render the rest of the weights useless. — Edit: elaboration suggested by Prune– CNNs are built so that as they go deeper, they can extract high-level features derived … Read more

What is the role of TimeDistributed layer in Keras?

In keras – while building a sequential model – usually the second dimension (one after sample dimension) – is related to a time dimension. This means that if for example, your data is 5-dim with (sample, time, width, length, channel) you could apply a convolutional layer using TimeDistributed (which is applicable to 4-dim with (sample, … Read more