mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 00:35:34 +00:00
Opt: Set rec_batch_num=1 for faster ocr
This commit is contained in:
parent
16f4f061c1
commit
f7bc6980f9
@ -1,4 +1,4 @@
|
||||
from pponnxcr import TextSystem
|
||||
from pponnxcr import TextSystem as TextSystem_
|
||||
|
||||
from module.base.decorator import cached_property
|
||||
from module.exception import ScriptError
|
||||
@ -36,6 +36,12 @@ def model2lang(model: str) -> str:
|
||||
return model
|
||||
|
||||
|
||||
class TextSystem(TextSystem_):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.text_recognizer.rec_batch_num = 1
|
||||
|
||||
|
||||
class OcrModel:
|
||||
def get_by_model(self, model: str) -> TextSystem:
|
||||
try:
|
||||
|
@ -4,7 +4,6 @@ from datetime import timedelta
|
||||
|
||||
import cv2
|
||||
from ppocronnx.predict_system import BoxedResult
|
||||
from pponnxcr import TextSystem
|
||||
|
||||
import module.config.server as server
|
||||
from module.base.button import ButtonWrapper
|
||||
@ -12,7 +11,7 @@ from module.base.decorator import cached_property
|
||||
from module.base.utils import area_pad, corner2area, crop, float2str
|
||||
from module.exception import ScriptError
|
||||
from module.logger import logger
|
||||
from module.ocr.models import OCR_MODEL
|
||||
from module.ocr.models import OCR_MODEL, TextSystem
|
||||
from module.ocr.utils import merge_buttons
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user