I want to train the multi-input model on a set of images. I use ImageDataGenerator.flow_from_directory() and fit_generator in keras.

The problem is I don't know how to use multiple generators.

This is my inputs & output generator and seeds are same:

input1 = imageDataGenerator.flow_from_directory(directory=base_data_directory + 'img/' + mode+'/', **img_generator_config)
input2 = imageDataGenerator.flow_from_directory(directory=base_data_directory + 'edge/' + mode,**edge_generator_config)
output = imageDataGenerator.flow_from_directory(directory=base_data_directory + 'label/' + mode, **label_generator_config)

How should I use fit_generator with this data?

  • $\begingroup$ The answer is provided here in StackOverflow answer $\endgroup$ Commented Nov 21, 2019 at 2:23

1 Answer 1


In my opinion, you should build the custom data generator or just use the fit function of Keras and make your input data as follows:

x = [[image1, feature1], [image2, feature1], [image3, feature1]]

y = [class1, class2, class1]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.