Repository navigation
Conversation
New option length_buckets, e.g. [15, 40, 60]: adds acc_len_*, ned_len_* and n_len_* for buckets 0-15, 16-40, 41-60, 61+ (by label length; empty buckets are not reported). Without the option the metric dict is unchanged.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
RecMetricreports one accuracy and one normalized edit distance over all lines. A model that reads short lineswell and long ones badly looks fine in that number. This is how a training problem on long text lines (CTC length,
see #18420) stayed hidden in our runs. The training log and
tools/eval.pygive no way to see accuracy by linelength.
Change
New optional
RecMetricargumentlength_buckets: increasing upper bounds of the label length.For every non-empty bucket the metric dict gets three more keys:
acc_len_<lo>_<hi>: line accuracy;ned_len_<lo>_<hi>: 1 − normalized edit distance;n_len_<lo>_<hi>: number of lines;for example
acc_len_0_15,acc_len_61_inf. They appear in the training log and intools/eval.pylike theexisting keys.
length_bucketsthe metric dict is exactly as before;main_indicatorand best-model selection do notchange.
ignore_space: True(the default)spaces are not counted, and with
is_filter: Truethe filtered label is used.length_bucketsis passed through**kwargslike the otherRecMetricoptions, so the metric wrappers that buildRecMetricfrom config get it too.Example from
tools/eval.py(PP-OCRv6 small, 4 241 real Russian/English document lines,ignore_space: False):Tests
tests/ppocr/test_rec_metric_buckets.py(15 tests):length_bucketsunchanged;ignore_space;reset()between evaluations.