diff --git a/python/rapidocr_openvino/main.py b/python/rapidocr_openvino/main.py index 9cdfa0305..269b95202 100644 --- a/python/rapidocr_openvino/main.py +++ b/python/rapidocr_openvino/main.py @@ -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 diff --git a/python/rapidocr_paddle/main.py b/python/rapidocr_paddle/main.py index 9cdfa0305..269b95202 100644 --- a/python/rapidocr_paddle/main.py +++ b/python/rapidocr_paddle/main.py @@ -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 diff --git a/python/tests/test_files/test_without_det.png b/python/tests/test_files/test_without_det.png new file mode 100644 index 000000000..f3b13ea2c Binary files /dev/null and b/python/tests/test_files/test_without_det.png differ diff --git a/python/tests/test_ort.py b/python/tests/test_ort.py index 86f48a34e..da4fa539b 100644 --- a/python/tests/test_ort.py +++ b/python/tests/test_ort.py @@ -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) diff --git a/python/tests/test_paddle.py b/python/tests/test_paddle.py index c60d117fb..73a0b4305 100644 --- a/python/tests/test_paddle.py +++ b/python/tests/test_paddle.py @@ -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) diff --git a/python/tests/test_vino.py b/python/tests/test_vino.py index 44528f1d5..69cb14698 100644 --- a/python/tests/test_vino.py +++ b/python/tests/test_vino.py @@ -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)