I'm studying machine learning and deep learning. I'm trying to customize this model from the Keras website https://keras.io/examples/generative/wgan_gp/
My model takes 3 512x512 images in each training iteration (from 10 different directories), which are then divided into patches used to train the generator and discriminator. These images must be consecutive and belong to the same directory. The directory can be chosen randomly in each iteration, and the 3 images must be taken from it. In summary, for each training iteration, the algorithm must select a random directory, take 3 consecutive images and divide them into patches to train the two networks.
How can I customize the way I iterate over the dataset in fit() to achieve this?
Providing solution here from the answer provided by Shubham Panchal in comment section for the benefit of the community.
You can do this using
TensorFlow
. See this tutorial on DCGAN. With theTensorFlow API
, you can create a custom training loop with any existingKeras
model. You may implement the custom training loop from the tutorial above and using use theWGAN
model you have.