fix: UnboundLocalError in predict_dummy when no bboxes are detected#147
fix: UnboundLocalError in predict_dummy when no bboxes are detected#147pdoup wants to merge 3 commits into
Conversation
Signed-off-by: Panagiotis Doupidis <72436005+pdoup@users.noreply.github.com>
|
✅ 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/
|
|
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>
| html_tags = [self._rev_word_map[ind] for ind in seq[1:-1]] | ||
|
|
||
| return html_tags | ||
|
|
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>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Hi @cau-git, just checking in on this PR when you have a moment. Since it's been a couple of months, I'm happy to update the branch or make any changes you need to get this ready for merge. |
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: