Repository navigation
test LSTM choice wrapping independently of OCR scores - #392
Merged
Merged
Conversation
The test still requires the page-level choice list to have the same length as the recognized words, and that length must be greater than zero. It also walks the word iterator, collects each word's LSTM choices, and requires that list to equal the page-level result. Score bounds and rebuilding each word from its top symbol are removed. Both results are checked as lists of per-word lists of per-timestep (symbol, score) pairs, with the symbol a string and the score a float; empty inner lists are allowed, and the fixture must yield at least one pair. Refs sirfz#295
Owner
|
Thanks |
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.
Background
The LSTM symbol-choice test fails on Tesseract 5 when an alternative score is about 3.6, which is above a hard ceiling of 2. The same check passes with Tesseract 4.1. On some Tesseract 4 setups the test instead errors because a timestep comes back with no alternatives.
The test treated recognizer output as part of the wrapper contract. Every score had to fall inside a fixed range, and each word was rebuilt by taking the first symbol of every timestep and compared with the recognized text.
Those ratings and characters come from the engine and its model, and Tesseract 5 reports larger raw ratings, so the old ceiling fails. The first-symbol read also assumes every timestep list is non-empty. In the tree being changed that ceiling is already commented out, while the remaining score floor and string comparison still follow OCR results.
Summary of the fix
Verification
Tests for the tesserocr change live in
tests/test_api.py.Fixes #295