show_log=False 参数不能用了?
🔎 Search before asking
- [x] I have searched the PaddleOCR Docs and found no similar bug report.
- [x] I have searched the PaddleOCR Issues and found no similar bug report.
- [x] I have searched the PaddleOCR Discussions and found no similar bug report.
🐛 Bug (问题描述)
raise ValueError(f"Unknown argument: {name}")
ValueError: Unknown argument: show_log
🏃♂️ Environment (运行环境)
paddleocr3.0
🌰 Minimal Reproducible Example (最小可复现问题的Demo)
ocr = PaddleOCR( text_detection_model_name="PP-OCRv5_server_det", text_detection_model_dir="./models/text_det_model", text_recognition_model_name="PP-OCRv5_server_rec", text_recognition_model_dir="./models/text_rec_model", use_doc_orientation_classify=False, use_doc_unwarping=False, use_textline_orientation=True, textline_orientation_model_name="PP-LCNet_x1_0_textline_ori", textline_orientation_model_dir="./models/text_lines_ori_model", device=f"gpu:{GPUID}", rec_batch_num=1, show_log=False )
Yes, show_log does no longer exist in PaddleOCR 3.0.0. Just omit that argument.
Yes, show_log does no longer exist in PaddleOCR 3.0.0. Just omit that argument.
so how to shutdown the log? @timminator
There is close to no log in the beginning anymore from what I'm seeing. It only informs you that the models are correctly set up and then the results from the OCR result are already reported.
由于PaddleOCR 2.x的日志系统存在局限性,在PaddleOCR 3.0中,我们对日志系统进行了不兼容升级。新的日志系统的配置方式可以参考这里。 想关掉这样打印日志,不打印了,如何做? Creating model: ('PP-OCRv5_server_det', './models/l') Creating model: ('PP-OCRv5_server_rec', './models/) @Bobholamovic
以下没有作用 import logging from paddleocr import logger
# 将日志写入文件 `paddleocr.log`
fh = logging.FileHandler("paddleocr.log")
logger.addHandler(fh)
这里的设置会影响PaddleOCR自己的日志系统,但不适用于控制其他库(例如PaddleX)~
这里的设置会影响PaddleOCR自己的日志系统,但不适用于控制其他库(例如PaddleX)~
是的,那到底能不能关掉,有没有其他办法,是药paddlex那里提issue?
据我所知paddlex目前应该没有提供配置日志记录器的简单方式。如果你希望paddlex未来提供这个功能的话,可以在PaddleX仓库提个功能请求issue~
目前,可以试试如下的手动方式让paddlex的logger安静一点(只就paddlex这一个库而言,不影响其他的依赖库,比如更底层的paddle框架)。
# 在调用PaddleX其他代码之前执行
import logging
paddlex_logger = logging.getLogger("paddlex")
paddlex_logger.setLevel(logging.ERROR)
predict阶段通常不会有日志输出,paddlex和paddleocr都被设计为相对静默的。如果你只是想屏蔽创建产线、模块时候的输出,也可以考虑一个通用的方式:
import io
from contextlib import redirect_stdout, redirect_stderr
with redirect_stdout(io.StringIO()), redirect_stderr(io.StringIO()):
pipeline = PaddleOCR(...)
这种方法会屏蔽掉包括paddleocr、paddlex在内的所有库输出到stdout和stderr的信息。
The issue has no response for a long time and will be closed. You can reopen or new another issue if are still confused.
From Bot