feat: Added support for per-class confidence thresholds in layout detection.#50
Merged
JaredforReal merged 2 commits intozai-org:mainfrom Feb 5, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements support for per-class confidence thresholds in layout detection. The threshold_by_class configuration option existed but was not being utilized in the code. This feature allows fine-tuning of detection confidence thresholds on a per-class basis, enabling more granular control over which layout elements are detected.
Changes:
- Added
_apply_per_class_thresholdmethod to filter detections based on per-class confidence thresholds - Modified the
processmethod to use a lower pre-threshold when per-class thresholds are configured, then apply per-class filtering afterward - Fixed incorrect comment in config.yaml (label 23 was incorrectly labeled as "text" instead of "vertical_text")
- Added documentation examples showing both numeric and string key formats for threshold_by_class
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| glmocr/layout/layout_detector.py | Implements per-class threshold filtering logic and integrates it into the detection pipeline |
| glmocr/config.yaml | Fixes mislabeled comment for label 23 and adds documentation examples for string-based class keys |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
JaredforReal
approved these changes
Feb 5, 2026
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.
threshold_by_classoption exist is config but it's not actually being used. This adds support to fine-tune layout detection with threshold_by_class.