Data augmentation via permutation of the inputs

  generator, keras, python, tensorflow

My model takes as input 4 arrays and is trained using the standard keras fit function in the following way:

model.fit([train[0],train[1],train[2],train[3]], train_labels)

These 4 arrays have the same dimension and they are in fact interchangeable.
The dictionary ‘train’ is loaded into RAM.
To overcome heavy overfitting and improve the performance of the model, I would like to enhance the dataset 24 times, being 24 the number of all the possible permutations of [1,2,3,4].
Moreover, I’d like to do it in a space-efficient way: not writing it to disk and then loading it while training the model.
Is there a way to do this using some sort of custom data generator?

Source: Python Questions

LEAVE A COMMENT