Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

训练的时候是否需要指定batch_size呢 #7

Open
ZZHHogan opened this issue Oct 2, 2020 · 1 comment
Open

训练的时候是否需要指定batch_size呢 #7

ZZHHogan opened this issue Oct 2, 2020 · 1 comment

Comments

@ZZHHogan
Copy link

ZZHHogan commented Oct 2, 2020

你好,我在train.py中看到model.fit( x=train_generator, steps_per_epoch=cfg.STEPS_PER_EPOCH, initial_epoch=cfg.INITIAL_EPOCH, epochs=cfg.EPOCHS, verbose=1, callbacks=callbacks, validation_data=val_generator, validation_steps=cfg.VALIDATION_STEPS )
其中fit函数并没指定batch_size,那么STEPS_PER_EPOCH依旧是数据集的大小,并没有除以batch_size吗;但是在generator中却有指定了batch_size,也就是说数据集会除以batch_size。那么在训练的过程是否会出现在同一个epoch中,队某个样本进行重复训练?

@zonasw
Copy link
Owner

zonasw commented Oct 2, 2020

你好,我在train.py中看到model.fit( x=train_generator, steps_per_epoch=cfg.STEPS_PER_EPOCH, initial_epoch=cfg.INITIAL_EPOCH, epochs=cfg.EPOCHS, verbose=1, callbacks=callbacks, validation_data=val_generator, validation_steps=cfg.VALIDATION_STEPS )
其中fit函数并没指定batch_size,那么STEPS_PER_EPOCH依旧是数据集的大小,并没有除以batch_size吗;但是在generator中却有指定了batch_size,也就是说数据集会除以batch_size。那么在训练的过程是否会出现在同一个epoch中,队某个样本进行重复训练?

STEPS_PER_EPOCH的值应该设定为 总数据量//batch_size, 训练时仅指定steps_per_epoch即可,无需在fit中指定batch_size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants