'commit'
This commit is contained in:
@@ -50,8 +50,8 @@ class OcrParser:
|
||||
|
||||
# 2. 距离 (Distance)
|
||||
for line in clean_lines:
|
||||
# 匹配 "7.4km", "17.4km"
|
||||
m = re.search(r"(\d+(\.\d+)?)\s*km", line, re.IGNORECASE)
|
||||
# 匹配 "7.4km", "17.4km", "90m"
|
||||
m = re.search(r"(\d+(\.\d+)?)\s*(km|m)", line, re.IGNORECASE)
|
||||
if m:
|
||||
result["distance"] = m.group(0)
|
||||
break
|
||||
|
||||
@@ -26,13 +26,23 @@ class PaddleOCRKit:
|
||||
Using PP-OCRv4 mobile model for speed.
|
||||
"""
|
||||
try:
|
||||
# 1. 抑制 PaddlePaddle 的日志输出
|
||||
os.environ['GLOG_minloglevel'] = '3' # 抑制 GLOG (C++) 日志
|
||||
os.environ['FLAGS_allocator_strategy'] = 'auto_growth' # 减少显存占用警告
|
||||
|
||||
# 2. 抑制 Python 层的 paddle 日志
|
||||
import logging as py_logging
|
||||
py_logging.getLogger('paddle').setLevel(py_logging.ERROR)
|
||||
py_logging.getLogger('ppocr').setLevel(py_logging.ERROR)
|
||||
|
||||
logger.info("Initializing PaddleOCR (PP-OCRv4 Mobile)...")
|
||||
# use_angle_cls is deprecated, using use_textline_orientation instead
|
||||
# ocr_version='PP-OCRv4' defaults to mobile model
|
||||
self._ocr = PaddleOCR(
|
||||
use_textline_orientation=True,
|
||||
lang="ch",
|
||||
ocr_version='PP-OCRv4'
|
||||
ocr_version='PP-OCRv4',
|
||||
show_log=False # 关键:关闭 PaddleOCR 内部日志打印
|
||||
)
|
||||
logger.info("PaddleOCR initialized successfully.")
|
||||
except Exception as e:
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user