fix: UnboundLocalError in predict_dummy when no bboxes are detected#147
Open
pdoup wants to merge 3 commits intodocling-project:mainfrom
Open
fix: UnboundLocalError in predict_dummy when no bboxes are detected#147pdoup wants to merge 3 commits intodocling-project:mainfrom
pdoup wants to merge 3 commits intodocling-project:mainfrom
Conversation
Signed-off-by: Panagiotis Doupidis <72436005+pdoup@users.noreply.github.com>
Contributor
|
✅ DCO Check Passed Thanks @pdoup, all your commits are properly signed off. 🎉 |
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Author
|
Hi @nikos-livathinos and @cau-git, just wanted to check in on this PR when you have a moment. I’m happy to make any adjustments or provide more context if needed. Thanks for your time! |
add new line at the end Signed-off-by: Panagiotis Doupidis <72436005+pdoup@users.noreply.github.com>
pdoup
commented
Mar 3, 2026
| html_tags = [self._rev_word_map[ind] for ind in seq[1:-1]] | ||
|
|
||
| return html_tags | ||
|
|
Author
There was a problem hiding this comment.
added newline at the end to fix black formatter error
Signed-off-by: Panagiotis Doupidis <72436005+pdoup@users.noreply.github.com>
nikos-livathinos
approved these changes
Mar 4, 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.
Description
This PR fixes an
UnboundLocalErrorthat occurs in thepredict_dummymethod oftf_predictor.pywhen the model fails to predict any bounding boxes.Currently, the variable
tf_outputis initialized and assigned only within theif len(prediction["bboxes"]) > 0:block. If the model does not populateprediction["bboxes"], this block is skipped, and the subsequentreturn tf_output, matching_detailsstatement raises a "cannot access local variable" error becausetf_outputhas not been defined.The fix initializes
tf_outputas an empty list[]prior to the conditional block, ensuring the variable is always defined and the method returns a valid empty result when no predictions are found.Changes
tf_predictor.py: Added initialization oftf_output = []inpredict_dummyto handle cases with no predicted bounding boxes.Checklist: