mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-11 05:20:49 +08:00
Optim api interface for easy packaging
This commit is contained in:
1 parent
92aec2c123
commit
6fb4e3bb25
8 files changed
+16
-29
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# @Author: SWHL
|
||||
# @Contact: liekkaskono@163.com
|
||||
from .text_cls import TextClassifier
|
||||
from .text_cls import TextClassifier
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# @Author: SWHL
|
||||
# @Contact: liekkaskono@163.com
|
||||
from .text_recognize import TextRecognizer
|
||||
from .text_recognize import TextRecognizer
|
||||
@@ -9,8 +9,6 @@ Global:
|
||||
Det:
|
||||
use_cuda: false
|
||||
|
||||
module_name: ch_ppocr_v3_det
|
||||
class_name: TextDetector
|
||||
model_path: models/ch_PP-OCRv3_det_infer.onnx
|
||||
|
||||
limit_side_len: 736
|
||||
@@ -26,8 +24,6 @@ Det:
|
||||
Cls:
|
||||
use_cuda: false
|
||||
|
||||
module_name: ch_ppocr_v2_cls
|
||||
class_name: TextClassifier
|
||||
model_path: models/ch_ppocr_mobile_v2.0_cls_infer.onnx
|
||||
|
||||
cls_image_shape: [3, 48, 192]
|
||||
@@ -38,8 +34,6 @@ Cls:
|
||||
Rec:
|
||||
use_cuda: false
|
||||
|
||||
module_name: ch_ppocr_v3_rec
|
||||
class_name: TextRecognizer
|
||||
model_path: models/ch_PP-OCRv3_rec_infer.onnx
|
||||
|
||||
rec_img_shape: [3, 48, 320]
|
||||
|
||||
@@ -3,18 +3,19 @@
|
||||
# @Contact: liekkaskono@163.com
|
||||
import copy
|
||||
import importlib
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
from .utils import (LoadImage, init_args, UpdateParameters, concat_model_path,
|
||||
from .ch_ppocr_v2_cls import TextClassifier
|
||||
from .ch_ppocr_v3_det import TextDetector
|
||||
from .ch_ppocr_v3_rec import TextRecognizer
|
||||
from .utils import (LoadImage, UpdateParameters, concat_model_path, init_args,
|
||||
read_yaml)
|
||||
|
||||
root_dir = Path(__file__).resolve().parent
|
||||
sys.path.append(str(root_dir))
|
||||
|
||||
|
||||
class RapidOCR():
|
||||
@@ -37,18 +38,12 @@ class RapidOCR():
|
||||
|
||||
self.use_text_det = config['Global']['use_text_det']
|
||||
if self.use_text_det:
|
||||
TextDetector = self.init_module(config['Det']['module_name'],
|
||||
config['Det']['class_name'])
|
||||
self.text_detector = TextDetector(config['Det'])
|
||||
|
||||
TextRecognizer = self.init_module(config['Rec']['module_name'],
|
||||
config['Rec']['class_name'])
|
||||
self.text_recognizer = TextRecognizer(config['Rec'])
|
||||
|
||||
self.use_angle_cls = config['Global']['use_angle_cls']
|
||||
if self.use_angle_cls:
|
||||
TextClassifier = self.init_module(config['Cls']['module_name'],
|
||||
config['Cls']['class_name'])
|
||||
self.text_cls = TextClassifier(config['Cls'])
|
||||
|
||||
self.load_img = LoadImage()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# @Author: SWHL
|
||||
# @Contact: liekkaskono@163.com
|
||||
from .text_cls import TextClassifier
|
||||
from .text_cls import TextClassifier
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# @Author: SWHL
|
||||
# @Contact: liekkaskono@163.com
|
||||
from .text_detect import TextDetector
|
||||
from .text_detect import TextDetector
|
||||
@@ -1 +1,4 @@
|
||||
from .text_recognize import TextRecognizer
|
||||
# -*- encoding: utf-8 -*-
|
||||
# @Author: SWHL
|
||||
# @Contact: liekkaskono@163.com
|
||||
from .text_recognize import TextRecognizer
|
||||
@@ -3,18 +3,19 @@
|
||||
# @Contact: liekkaskono@163.com
|
||||
import copy
|
||||
import importlib
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
from .utils import (LoadImage, init_args, UpdateParameters, concat_model_path,
|
||||
from .ch_ppocr_v2_cls import TextClassifier
|
||||
from .ch_ppocr_v3_det import TextDetector
|
||||
from .ch_ppocr_v3_rec import TextRecognizer
|
||||
from .utils import (LoadImage, UpdateParameters, concat_model_path, init_args,
|
||||
read_yaml)
|
||||
|
||||
root_dir = Path(__file__).resolve().parent
|
||||
sys.path.append(str(root_dir))
|
||||
|
||||
|
||||
class RapidOCR():
|
||||
@@ -37,18 +38,12 @@ class RapidOCR():
|
||||
|
||||
self.use_text_det = config['Global']['use_text_det']
|
||||
if self.use_text_det:
|
||||
TextDetector = self.init_module(config['Det']['module_name'],
|
||||
config['Det']['class_name'])
|
||||
self.text_detector = TextDetector(config['Det'])
|
||||
|
||||
TextRecognizer = self.init_module(config['Rec']['module_name'],
|
||||
config['Rec']['class_name'])
|
||||
self.text_recognizer = TextRecognizer(config['Rec'])
|
||||
|
||||
self.use_angle_cls = config['Global']['use_angle_cls']
|
||||
if self.use_angle_cls:
|
||||
TextClassifier = self.init_module(config['Cls']['module_name'],
|
||||
config['Cls']['class_name'])
|
||||
self.text_cls = TextClassifier(config['Cls'])
|
||||
|
||||
self.load_img = LoadImage()
|
||||
|
||||
Reference in new issue
Block a user