mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-11 05:20:49 +08:00
test: add unit testings of issue 440 (#445)
This commit is contained in:
3 files changed
+4
-1
No files matched your search
@@ -79,6 +79,7 @@ class CalRecBoxes:
|
||||
"""
|
||||
if not rec_txt or word_info.line_txt_len == 0:
|
||||
return [], [], []
|
||||
|
||||
bbox_points = quads_to_rect_bbox(bbox[None, ...])
|
||||
avg_col_width = (bbox_points[2] - bbox_points[0]) / word_info.line_txt_len
|
||||
|
||||
@@ -166,8 +167,10 @@ class CalRecBoxes:
|
||||
) -> float:
|
||||
if txt_len == 0:
|
||||
return 0.0
|
||||
|
||||
if len(width_list) > 0:
|
||||
return sum(width_list) / len(width_list)
|
||||
|
||||
return (bbox_x1 - bbox_x0) / txt_len
|
||||
|
||||
@staticmethod
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
@@ -448,7 +448,7 @@ def test_cn_word_ocr(engine, img_name: str, words: List[str]):
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"img_name,words",
|
||||
[("issue_170.png", "TEST")],
|
||||
[("issue_170.png", "TEST"), ("return_word_debug.jpg", "3F1")],
|
||||
)
|
||||
def test_en_word_ocr(engine, img_name: str, words: str):
|
||||
img_path = tests_dir / img_name
|
||||
|
||||
Reference in new issue
Block a user