init2.1
This commit is contained in:
@@ -41,6 +41,7 @@ class OCRService:
|
||||
text_det_unclip_ratio: float = 1.5,
|
||||
text_rec_score_thresh: float = 0.0,
|
||||
text_recognition_batch_size: int = 1,
|
||||
cpu_threads: int = 10,
|
||||
) -> None:
|
||||
self.lang = lang
|
||||
self.device = device
|
||||
@@ -54,6 +55,7 @@ class OCRService:
|
||||
self._text_det_unclip_ratio = text_det_unclip_ratio
|
||||
self._text_rec_score_thresh = text_rec_score_thresh
|
||||
self._text_recognition_batch_size = text_recognition_batch_size
|
||||
self._cpu_threads = cpu_threads
|
||||
self._engine: Any | None = None
|
||||
self._lock = threading.Lock()
|
||||
self._inference_lock = threading.Lock()
|
||||
@@ -130,10 +132,11 @@ class OCRService:
|
||||
) from exc
|
||||
with self._process_model_lock:
|
||||
logger.info(
|
||||
"加载 OCR 引擎: det=%s rec=%s device=%s model_dir=%s",
|
||||
"加载 OCR 引擎: det=%s rec=%s device=%s cpu_threads=%d model_dir=%s",
|
||||
self._det_model_name,
|
||||
self._rec_model_name,
|
||||
self.device,
|
||||
self._cpu_threads,
|
||||
self.model_dir,
|
||||
)
|
||||
self._engine = PaddleOCR(
|
||||
@@ -150,6 +153,7 @@ class OCRService:
|
||||
text_det_unclip_ratio=self._text_det_unclip_ratio,
|
||||
text_rec_score_thresh=self._text_rec_score_thresh,
|
||||
text_recognition_batch_size=self._text_recognition_batch_size,
|
||||
cpu_threads=self._cpu_threads,
|
||||
)
|
||||
self._install_progress_hooks(self._engine)
|
||||
logger.info("OCR 引擎加载完成")
|
||||
|
||||
Reference in New Issue
Block a user