Skip to content

Commit

Permalink
Fixed the PR #150 in rapidocr_vino and rapidocr_paddle module
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed Jan 30, 2024
1 parent d05b629 commit a2e11df
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/rapidocr_openvino/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def auto_text_det(

def get_boxes_img_without_det(self, h, w):
x0, y0, x1, y1 = 0, 0, w, h
dt_boxes = np.array([[x0, y0], [x1, y0], [x1, y1], [x0, y1]])
dt_boxes = np.float32([[x0, y0], [x1, y0], [x1, y1], [x0, y1]])
dt_boxes = dt_boxes[np.newaxis, ...]
return dt_boxes

Expand Down
2 changes: 1 addition & 1 deletion python/rapidocr_paddle/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def auto_text_det(

def get_boxes_img_without_det(self, h, w):
x0, y0, x1, y1 = 0, 0, w, h
dt_boxes = np.array([[x0, y0], [x1, y0], [x1, y1], [x0, y1]])
dt_boxes = np.float32([[x0, y0], [x1, y0], [x1, y1], [x0, y1]])
dt_boxes = dt_boxes[np.newaxis, ...]
return dt_boxes

Expand Down
Binary file added python/tests/test_files/test_without_det.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions python/tests/test_ort.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
package_name = "rapidocr_onnxruntime"


def test_without_det():
img_path = tests_dir / "test_without_det.png"
result, _ = engine(img_path)
assert result[0][1] == "の持、持场所无。"
assert len(result) == 1


def test_only_det():
result, _ = engine(img_path, use_det=True, use_cls=False, use_rec=False)

Expand Down
7 changes: 7 additions & 0 deletions python/tests/test_paddle.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
package_name = "rapidocr_paddle"


def test_without_det():
img_path = tests_dir / "test_without_det.png"
result, _ = engine(img_path)
assert result[0][1] == "の持、持场所无。"
assert len(result) == 1


def test_only_det():
result, _ = engine(img_path, use_det=True, use_cls=False, use_rec=False)

Expand Down
7 changes: 7 additions & 0 deletions python/tests/test_vino.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
package_name = "rapidocr_openvino"


def test_without_det():
img_path = tests_dir / "test_without_det.png"
result, _ = engine(img_path)
assert result[0][1] == "の持、持场所无。"
assert len(result) == 1


def test_only_det():
result, _ = engine(img_path, use_det=True, use_cls=False, use_rec=False)

Expand Down

0 comments on commit a2e11df

Please sign in to comment.