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

Fix char error rate calculation #14

Merged
merged 3 commits into from
Mar 3, 2024
Merged

Fix char error rate calculation #14

merged 3 commits into from
Mar 3, 2024

Conversation

robertknight
Copy link
Owner

@robertknight robertknight commented Mar 3, 2024

This fixes an issue with calculating the character error rate and generating model previews during recognition model training, due to mis-handling of padding in the inputs. The reported rate was higher than it should have been. See commits for details.

Also fix a warning about use of deprecated verbose flag for PyTorch schedulers.

When decoding outputs from a model to preview or compute the char error rate,
the part of the output that corresponds to the padding region of the input needs
to be ignored. The loss function only takes into consideration the un-padded
part of the input.

This fixes an issue where predictions had spurious extra characters on the end
and the calculated char error rate was higher than it should have been.
Since the model output downsamples the input image width by 4x, the size
increment for target vectors can be smaller than the size increment for inputs.
Also make the image width step a power of 2, since such sizes are generally more
optimal in various layers of the ML runtime.
 - Add `lr` flag to set initial LR, making it easier to experiment with
   different values.
 - Remove use of deprecated `verbose` kwarg for `ReduceLROnPlateau` and
   instead of `get_last_lr` to log the learning rate.
@robertknight robertknight merged commit ed2f430 into main Mar 3, 2024
1 check passed
@robertknight robertknight deleted the char-error-rate branch March 3, 2024 07:04
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.

1 participant