关于keras fit_generator中steps_per_epoch的定义,有几个SO问题,但是没有一个明确地回答这个问题。为了达到每个时期相同的训练量,steps_per_epoch是否应与GPU的数量成比例?
阅读的文档
Total number of steps (batches of samples) before declaring one epoch finished and starting the next epoch
此线程在这里: https://github.com/matterport/Mask_RCNN/issues/875
建议
BATCH_SIZE = GPU_COUNT * IMAGES_PER_GPU.
Images per epoch = STEPS_PER_EPOCH * IMAGES_PER_GPU * GPU_COUNT
这让我感到惊讶。
如果我有100张图像,批处理大小为1和1 GPU,并且我想训练每个时期的完整数据集。我将设置steps_per_epoch = 100
如果我增加到两个GPU是
batch_size = 2
steps_per_epoch = 100 / 2 images per batch = 50
或
batch_size = 2
steps_per_epoch = 100 images / 2 images / 2 GPU = 25
以实现相同数量的样本。 step_per_epoch是否与每个GPU或将数据传递给GPU的生成器有关?