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 panic in layout analysis when average word spacing in a line is negative #20

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

robertknight
Copy link
Owner

@robertknight robertknight commented Jan 15, 2024

Word detection can produce words which have a small overlap. This is because the detection model predicts boxes which are slightly shrunk from their true size, and post-processing then pads the boxes to recover the "true" size.

This means it is possible for the average inter-word spacing in a line to be negative. When this happens a panic occurred when converting the spacing from signed to unsigned.

The fix is just to clamp the computed average spacing to be >= 0.

Fixes #19

…egative

Word detection can produce words which have a small overlap. This is because the
detection model predicts boxes which are slightly shrunk from their true size,
and post-processing then pads the boxes to recover the "true" size.

This means it is possible for the average inter-word spacing in a line to be
negative. When this happens a panic occurred when converting the spacing from
signed to unsigned.

Fixes #19
@robertknight robertknight merged commit 9c3cf1c into main Jan 15, 2024
2 checks passed
@robertknight robertknight deleted the fix-panic-on-overlapping-words branch January 15, 2024 07:54
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.

Panic in layout analysis when recognizing image
1 participant