当前位置: 首页 > news >正文

PaddleOCR 多线程并发问题

机器狗调试 ocr 服务发现服务挂掉了,查看错误日志:

(paddle_env) [root@iZ2ze17ubu754nk7lbead6Z iuyun-vision-base]# tail -f iuyun_vision_service.err.logFile "/usr/local/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2224, in __init__for frame in traceback.extract_stack():NotFoundError: Variable Id 146596816 is not registered.[Hint: Expected it != Instance().id_to_type_map_.end(), but received it == Instance().id_to_type_map_.end().] (at /paddle/paddle/fluid/framework/var_type_traits.cc:98)[operator < fused_conv2d > error],耗时: 0.014[2025-08-06 17:51:26,587] [    INFO] _internal.py:97 - 127.0.0.1 - - [06/Aug/2025 17:51:26] "POST /ocr/number_recognize HTTP/1.1" 500 -
[2025-08-06 17:51:26,596] [   ERROR] controller.py:72 - OCR 处理失败: could not execute a primitive,耗时: 0.022[2025-08-06 17:51:26,596] [    INFO] _internal.py:97 - 127.0.0.1 - - [06/Aug/2025 17:51:26] "POST /ocr/number_recognize HTTP/1.1" 500 -
[2025-08-06 17:51:26,612] [    INFO] _internal.py:97 - 127.0.0.1 - - [06/Aug/2025 17:51:26] "POST /ocr/number_recognize HTTP/1.1" 200 -

这意味着多线程并发访问模型时可能导致变量注册冲突,修改线程池为单线程:

executor = ThreadPoolExecutor(max_workers=1) 
# executor = ThreadPoolExecutor(max_workers=config.SERVICE_CONFIG["max_workers"]["ocr"])

再次启动服务并查看输出日志:

(paddle_env) [root@iZ2ze17ubu754nk7lbead6Z iuyun-vision-base]# tail -f iuyun_vision_service.log
[2025/08/06 18:11:10] ppocr DEBUG: rec_res num  : 1, elapse : 0.03553628921508789
[2025/08/06 18:11:20] ppocr WARNING: Since the angle classifier is not initialized, the angle classifier will not be uesd during the forward process
[2025/08/06 18:11:20] ppocr DEBUG: dt_boxes num : 1, elapse : 0.010322809219360352
[2025/08/06 18:11:20] ppocr DEBUG: rec_res num  : 1, elapse : 0.03722119331359863
[2025/08/06 18:11:20] ppocr WARNING: Since the angle classifier is not initialized, the angle classifier will not be uesd during the forward process
[2025/08/06 18:11:20] ppocr DEBUG: dt_boxes num : 1, elapse : 0.00933527946472168
[2025/08/06 18:11:20] ppocr DEBUG: rec_res num  : 1, elapse : 0.03775501251220703
[2025/08/06 18:11:20] ppocr WARNING: Since the angle classifier is not initialized, the angle classifier will not be uesd during the forward process
[2025/08/06 18:11:20] ppocr DEBUG: dt_boxes num : 1, elapse : 0.010746955871582031
[2025/08/06 18:11:20] ppocr DEBUG: rec_res num  : 1, elapse : 0.03646540641784668
[2025/08/06 18:11:34] ppocr WARNING: Since the angle classifier is not initialized, the angle classifier will not be uesd during the forward process
[2025/08/06 18:11:34] ppocr DEBUG: dt_boxes num : 1, elapse : 0.03401660919189453
[2025/08/06 18:11:34] ppocr DEBUG: rec_res num  : 1, elapse : 0.03658294677734375
[2025/08/06 18:11:34] ppocr WARNING: Since the angle classifier is not initialized, the angle classifier will not be uesd during the forward process
[2025/08/06 18:11:34] ppocr DEBUG: dt_boxes num : 1, elapse : 0.009592294692993164
[2025/08/06 18:11:34] ppocr DEBUG: rec_res num  : 1, elapse : 0.03547239303588867
[2025/08/06 18:11:34] ppocr WARNING: Since the angle classifier is not initialized, the angle classifier will not be uesd during the forward process
[2025/08/06 18:11:34] ppocr DEBUG: dt_boxes num : 1, elapse : 0.009001493453979492
[2025/08/06 18:11:34] ppocr DEBUG: rec_res num  : 1, elapse : 0.0348973274230957
[2025/08/06 18:11:48] ppocr WARNING: Since the angle classifier is not initialized, the angle classifier will not be uesd during the forward process
[2025/08/06 18:11:48] ppocr DEBUG: dt_boxes num : 0, elapse : 0.01165628433227539
[2025/08/06 18:11:48] ppocr DEBUG: rec_res num  : 0, elapse : 1.9073486328125e-06
[2025/08/06 18:11:48] ppocr WARNING: Since the angle classifier is not initialized, the angle classifier will not be uesd during the forward process

服务暂时可以正常用,但是后续需要考虑多线程并发问题。

http://www.dtcms.com/a/318607.html

相关文章:

  • K8S命令记录
  • 利用多线程设计群ping工具
  • 5G随身WiFi怎么选?实测延迟/网速/续航,中兴V50适合商务,格行MT700适合短租、户外党~避坑指南+适用场景全解析
  • 无监督学习之K-means算法
  • 古多倍体化对被子植物适应性进化的遗传贡献--文献精度154
  • 本地部署 SQLite 数据库管理工具 SQLite Browser ( Web ) 并实现外部访问
  • 根据经纬度(从nc格式环境数据文件中)提取环境因子
  • RabbitMQ面试精讲 Day 12:镜像队列与Quorum队列对比
  • PCL 平面特征点提取
  • 2 SpringBoot项目对接单点登录说明
  • C语言控制语句练习题3
  • 数据结构与算法
  • 嵌入式 - 数据结构:栈和队列
  • [Oracle] ROUND()函数
  • 软件架构:系统结构的顶层设计与战略约束
  • 【前端】Vite中import.meta功能详解
  • 【多模态微调】【从0开始】Qwen2-VL + llamafactory
  • 小杰python高级(one day)——numpy库
  • 应急响应-windows篇
  • Spring选择哪种方式代理?
  • 12、Docker Compose 安装 Redis
  • CGAL Kernel 和 Traits 类深度解析:从官方教程到实践应用
  • 疯狂星期四文案网第30天运营日记
  • 从Token到序列:阿里GSPO算法如何让大模型训练更稳、更强?
  • CubeFS存储(一)
  • 16-DS18B20-±0.5℃精度-12bitADC--55°C ~ +125°C
  • ubuntu server 工业环境部署手册[2025-08-06]
  • ⭐CVPR 文本到 3D 场景生成新突破:Prometheus 框架解析
  • http请求结构体解析
  • 【C++】二叉树进阶