-
Notifications
You must be signed in to change notification settings - Fork 515
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Bug in the python code while sorting layout blocks.
Checklist
- I used python "sorted" function to solve that issue.
To Reproduce
Steps to reproduce the behavior:
- What command or script did you run?
h, w = image.shape[:2]
left_interval = lp.Interval(0, w/2*1.05, axis='x').put_on_canvas(image)
left_blocks = text_blocks.filter_by(left_interval, center=True)
left_blocks.sort(key = lambda b:b.coordinates[1])
right_blocks = [b for b in text_blocks if b not in left_blocks]
right_blocks.sort(key = lambda b:b.coordinates[1])
# And finally combine the two list and add the index
# according to the order
text_blocks = lp.Layout([b.set(id = idx) for idx, b in enumerate(left_blocks + right_blocks)])
THIS CODE IS PASTED FROM DOCUMENTATION PAGE: https://layout-parser.readthedocs.io/en/latest/example/deep_layout_parsing/index.html
Environment
- Just run on google colab
- layoutparser version: 0.3.2
- I installed layoutparser using pip and the installed detectron2 from source.
Error traceback
N/A
Additional context
Because I am short in time I've created an issue for that instead of PR.
"sorted(left_blocks, key=lambda x:x.coordinates[1]))" use such sorting to fix bug.

Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
