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

crash in create opf from Google Vision #274

Closed
eroux opened this issue Jun 4, 2024 · 1 comment
Closed

crash in create opf from Google Vision #274

eroux opened this issue Jun 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@eroux
Copy link
Contributor

eroux commented Jun 4, 2024

See this stacktrace:

File "/usr/local/lib/python3.9/site-packages/openpecha/formatters/ocr/ocr.py", line 722, in create_opf
base_text, layers, word_confidence_list = self.build_base(image_group_id)
File "/usr/local/lib/python3.9/site-packages/openpecha/formatters/ocr/ocr.py", line 594, in build_base
self.build_page(bboxes, image_number+1, image_filename, state, avg_char_width)
File "/usr/local/lib/python3.9/site-packages/openpecha/formatters/ocr/ocr.py", line 488, in build_page
sorted_bboxes = self.sort_bboxes(flatten_bboxes)
File "/usr/local/lib/python3.9/site-packages/openpecha/formatters/ocr/ocr.py", line 300, in sort_bboxes
avg_box_height = self.get_avg_bbox_height(main_region_bboxes)
File "/usr/local/lib/python3.9/site-packages/openpecha/formatters/ocr/ocr.py", line 156, in get_avg_bbox_height
avg_height = height_sum / bboxeswidth
ZeroDivisionError: division by zero
@eroux eroux added the bug Something isn't working label Jun 4, 2024
eroux added a commit that referenced this issue Jun 4, 2024
@eroux
Copy link
Contributor Author

eroux commented Jun 5, 2024

with yesterday's fix, here's the new error:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/openpecha/formatters/ocr/ocr.py", line 727, in create_opf
base_text, layers, word_confidence_list = self.build_base(image_group_id)
File "/usr/local/lib/python3.9/site-packages/openpecha/formatters/ocr/ocr.py", line 599, in build_base
self.build_page(bboxes, image_number+1, image_filename, state, avg_char_width)
File "/usr/local/lib/python3.9/site-packages/openpecha/formatters/ocr/ocr.py", line 493, in build_page
sorted_bboxes = self.sort_bboxes(flatten_bboxes)
File "/usr/local/lib/python3.9/site-packages/openpecha/formatters/ocr/ocr.py", line 310, in sort_bboxes
sorted_bbox_centriods = self.get_bbox_sorted_on_x(sort_on_y_bboxs, avg_box_height, bboxes)
File "/usr/local/lib/python3.9/site-packages/openpecha/formatters/ocr/ocr.py", line 271, in get_bbox_sorted_on_x
prev_bbox = bboxes_sorted_on_y[0]
IndexError: list index out of range

eroux added a commit that referenced this issue Jun 5, 2024
@eroux eroux closed this as completed Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant