PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

show_log=False 参数不能用了?

Open cqray1990 opened this issue 6 months ago • 8 comments

🔎 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 )

cqray1990 avatar Jun 17 '25 02:06 cqray1990

Yes, show_log does no longer exist in PaddleOCR 3.0.0. Just omit that argument.

timminator avatar Jun 17 '25 06:06 timminator

Yes, show_log does no longer exist in PaddleOCR 3.0.0. Just omit that argument.

so how to shutdown the log? @timminator

cqray1990 avatar Jun 17 '25 06:06 cqray1990

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.

timminator avatar Jun 17 '25 06:06 timminator

由于PaddleOCR 2.x的日志系统存在局限性,在PaddleOCR 3.0中,我们对日志系统进行了不兼容升级。新的日志系统的配置方式可以参考这里

Bobholamovic avatar Jun 17 '25 13:06 Bobholamovic

由于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)

cqray1990 avatar Jun 18 '25 08:06 cqray1990

这里的设置会影响PaddleOCR自己的日志系统,但不适用于控制其他库(例如PaddleX)~

Image

Bobholamovic avatar Jun 18 '25 11:06 Bobholamovic

这里的设置会影响PaddleOCR自己的日志系统,但不适用于控制其他库(例如PaddleX)~

Image

是的,那到底能不能关掉,有没有其他办法,是药paddlex那里提issue?

cqray1990 avatar Jun 19 '25 08:06 cqray1990

据我所知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的信息。

Bobholamovic avatar Jun 19 '25 09:06 Bobholamovic

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

TingquanGao avatar Jul 20 '25 12:07 TingquanGao