mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-14 06:50:48 +08:00
feat: add en/el/th ppocr_v5_rec_mobile paddle/onnx/openvino (#546)
* feat: add en/el/th ppocr_v5_rec_mobile paddle/onnx/openvino * test: change to a more secure code
This commit is contained in:
15 files changed
+924
-675
No files matched your search
@@ -0,0 +1,49 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# @Author: SWHL
|
||||
# @Contact: liekkaskono@163.com
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
root_dir = Path(__file__).resolve().parent.parent
|
||||
sys.path.append(str(root_dir))
|
||||
|
||||
from rapidocr import RapidOCR
|
||||
|
||||
tests_dir = root_dir / "tests" / "test_files"
|
||||
img_path = tests_dir / "ch_en_num.jpg"
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def engine():
|
||||
engine = RapidOCR()
|
||||
return engine
|
||||
|
||||
|
||||
def test_vis_only_det(engine):
|
||||
img_path = tests_dir / "ch_en_num.jpg"
|
||||
result = engine(img_path, use_det=True, use_cls=False, use_rec=False)
|
||||
vis_img = result.vis()
|
||||
assert vis_img.shape[2] == 3
|
||||
|
||||
|
||||
def test_vis_only_rec(engine):
|
||||
img_path = tests_dir / "text_rec.jpg"
|
||||
result = engine(img_path, use_det=False, use_cls=False, use_rec=True)
|
||||
vis_img = result.vis()
|
||||
assert vis_img.shape[2] == 3
|
||||
|
||||
|
||||
def test_vis_only_cls(engine):
|
||||
img_path = tests_dir / "text_rec.jpg"
|
||||
result = engine(img_path, use_det=False, use_cls=True, use_rec=False)
|
||||
vis_img = result.vis()
|
||||
assert vis_img.shape[2] == 3
|
||||
|
||||
|
||||
def test_vis_det_cls_rec(engine):
|
||||
img_path = tests_dir / "ch_en_num.jpg"
|
||||
result = engine(img_path, use_det=True, use_cls=True, use_rec=True)
|
||||
vis_img = result.vis()
|
||||
assert vis_img.shape[2] == 3
|
||||
Reference in new issue
Block a user