Combine rec v2 and v3

This commit is contained in:
SWHL committed 2022-07-07 22:03:51 +08:00
1 parent d2690cdf85
commit a3d3f12be7
13 files changed
+59 -345

No files matched your search

File renamed without changes.
-24
View File
@@ -1,24 +0,0 @@
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: liekkaskono@163.com
import base
import cv2
module_name = 'ch_ppocr_v3_rec'
class_name = 'TextRecognizer'
TextRecognizer = base.init_module(module_name, class_name)
yaml_path = base.root_dir / base.package_name / module_name / 'config.yaml'
config = base.read_yaml(str(yaml_path))
config['model_path'] = str(base.root_dir / config['model_path'])
config['keys_path'] = str(base.root_dir / config['keys_path'])
text_rec = TextRecognizer(config)
def test_rec():
img_path = 'test_files/text_rec.jpg'
img = cv2.imread(img_path)
rec_res, elapse = text_rec([img])
assert rec_res[0][0] == '韩国小馆'