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

Epoch is 0 indexed, add one to match from fit #8137

Merged
merged 3 commits into from
Oct 17, 2017

Conversation

smgt
Copy link
Contributor

@smgt smgt commented Oct 13, 2017

Output from callbacks include epoch, but the epoch is index 0 format. It shows up when callbacks output information about the epoch.

Example:

Epoch 1/100
2300/2300 [==============================] - 462s - loss: 3.6914 - acc: 0.7710 - val_loss: 3.7383 - val_acc: 0.7681
Epoch 2/100
2300/2300 [==============================] - 457s - loss: 3.6921 - acc: 0.7709 - val_loss: 3.7442 - val_acc: 0.7677
Epoch 3/100
2299/2300 [============================>.] - ETA: 0s - loss: 3.6904 - acc: 0.7710
Epoch 00002: reducing learning rate to 9.999999747378752e-06.

Notice how the lr reduction is showing epoch 2 instead of the correct epoch 3.

The callback ModelCheckpoint will also save checkpoints with the correct epoch number in the filename.

@fchollet
Copy link
Member

Please fix PEP8 style.

@smgt
Copy link
Contributor Author

smgt commented Oct 16, 2017

Sorry, should have checked Travis results. Added a new commit with PEP8 fixes.

@fchollet fchollet merged commit f2501c4 into keras-team:master Oct 17, 2017
@montanalow
Copy link

montanalow commented Nov 2, 2017

This change introduces an off by 1 error in other code that use the epochs from CheckpointModel, as indicated by the change to the spec. It would be nicer in the future to preserve the original behavior, and make improvements opt-in until promoting them in a minor version bump, as opposed to a patch. i.e. patches in public projects shouldn't change specs.

@hhoefener
Copy link

Isn't this introducing more problems then it solves? I am using my own callbacks additionally and now the epoch values do not match the files stored by the ModelCheckpoint anymore! For me this resulted in silently using the wrong weights for evaluation.

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

Successfully merging this pull request may close these issues.

4 participants