停止打印警告消息“正在使用 CPU。注意:该模块使用 GPU 时速度更快。”
我正在使用优秀的 EasyOCR 模块运行 Python 程序。它依赖 PyTorch 进行图像检测,每次运行它时,它都会在每次迭代时生成警告:“使用 CPU。注意:使用 GPU 时该模块要快得多。”。
我可以在代码中添加什么来停止此输出而不停止其他输出?我没有 GPU,所以这不是一个选择。
I am running a Python program using the excellent EasyOCR module. It relies on PyTorch for image detection and every time I run it, it produces a warning: "Using CPU. Note: This module is much faster with a GPU." for each iteration.
What can I add to my code to stop this output without stopping other output? I don't have a GPU so that is not an option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在查看源代码后,我注意到< code>verbose 默认设置为
True
在构造函数中。设置 verbose=False 后,消息将停止显示。
After looking into the source code, I noticed that
verbose
is set toTrue
by default in the constructor.After setting
verbose=False
the message stops appearing.我认为有一个命令行参数--gpu=false。你尝试过吗?
I think there is a command line parameter --gpu=false. Have you tried that?