欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 金融 > paddleocr快速使用tensorrt进行推理加速

paddleocr快速使用tensorrt进行推理加速

2025/3/28 22:54:53 来源:https://blog.csdn.net/LZL2020LZL/article/details/146480080  浏览:    关键词:paddleocr快速使用tensorrt进行推理加速
self.ocr = PaddleOCR(use_angle_cls=True,use_space_char=True,use_gpu=True,use_tensorrt=True,precision='fp32', #根据需要改fp16或fp32det_model_dir='models/ocr/ch_PP-OCRv4_det_infer/',rec_model_dir='models/ocr/ch_PP-OCRv4_rec_infer/',cls_model_dir='models/ocr/ch_ppocr_mobile_v2.0_cls_infer/',shape_info_filename="shape.txt",thread_num=8#线程数)

注意事项:

报错:ppocr INFO: when using tensorrt, dynamic shape is a suggested option, you can use ‘–shape_info_filename=shape.txt’ for offline dygnamic shape tuning,

–shape_info_filename=“shape.txt”,首次运行:程序会分析输入图像的尺寸范围,并生成shape.txt文件。后续运行:直接复用该文件,避免重复优化。但是,在执行新的进程时一定要删除shape.txt文件再运行否则会报错。
误区:使用tensorrt就一定要用到engine文件×,这里的文件地址输入是’models/ocr/ch_PP-OCRv4_det_infer/',不需要我们自己转换。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词