How to find how many Image Generated By ImageDataGenerator

前端 未结 1 513
别跟我提以往
别跟我提以往 2021-02-04 11:12

Hi I want to ask you a question about Keras ImageDataGenerator. Can I determine how many augmented image will create? or how can find training image set size after augmentation.

相关标签:
1条回答
  • 2021-02-04 11:44

    What you are saying is correct, you can generate an infinite number from one image. This is normal in fact, consider just the number of images you can generate by rotation from the intial, it is infinite, because for each value of rotation angle you can generate a different image. To confirm this I will show this code from keras documentation

    for e in range(epochs):
        print('Epoch', e)
        batches = 0
        for x_batch, y_batch in datagen.flow(x_train, y_train, batch_size=32):
            model.fit(x_batch, y_batch)
            batches += 1
            if batches >= len(x_train) / 32:
                # we need to break the loop by hand because
                # the generator loops indefinitely
                break
    

    Note that they are saying that the generator loops indifinitely, which confirms that an infinite amount of images is generated

    0 讨论(0)
提交回复
热议问题