paddleocr 初始化设置window环境下

1、PaddleOCR介绍
PaddleOCR是一个可以识别图片中文字的工具,可以将图片中的文字转换成电脑可以认识的文字。简单来说,它的原理是使用深度学习技术,通过训练模型来识别图片中的文字。具体来说,它会通过一系列处理,比如缩放、灰度化、去噪等操作,来提高文字识别的准确率。然后,它会使用深度学习模型来检测图片中的文字区域,并将其转换成电脑可以识别的边界框。最后,它会使用另一个深度学习模型来识别边界框中的文字,并将其转换成电脑可以识别的文字。这样,就可以实现将图片中的文字转换成电脑可以识别的文字的功能了。

2、PaddleOCR功能特点
支持多种OCR任务:PaddleOCR支持多种OCR任务,包括文字检测、文字方向检测、多语种OCR、手写体OCR等,可以满足不同场景下的OCR需求。

识别精度高:PaddleOCR的深度学习模型经过大量的训练和优化,可以在各种复杂场景下实现高精度的OCR识别,具有较高的识别准确率。可准确识别不同字体、字号、字形的文字图像,实现超越人眼识别率的准确率。

易于使用:PaddleOCR提供了丰富的预训练模型和模型优化技术,可以快速部署和使用OCR功能,同时也提供了简单易用的API接口和开发文档,方便用户进行二次开发和定制化。

开源免费:PaddleOCR是一个开源免费的OCR工具,用户可以免费获取源代码和训练数据,自由使用和修改,方便用户进行二次开发和定制化。

                       

已有的环境:

pycharm 里可以直接使用paddleocr,可以参考venv设置,重新安装paddleocr

cmd下执行报错

  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1.
      Traceback (most recent call last):
        File "<string>", line 92, in <module>
      ModuleNotFoundError: No module named 'patch_ng'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "D:\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "D:\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-wqbwlyka\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-wqbwlyka\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-wqbwlyka\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-wqbwlyka\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 94, in <module>
      Exception: Building py-lmdb from source on Windows requires the "patch-ng" python module.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

解决方法,重复用回pycharm 里的环境,配置好主机的path

cmd下验证:

path

paddleocr --image_dir C:\Users\Administrator\Desktop\screenshot.png

C:\Users\Administrator>paddleocr --image_dir C:\Users\Administrator\Desktop\screenshot.png
[2024/05/03 13:51:01] ppocr DEBUG: Namespace(help='==SUPPRESS==', use_gpu=False, use_xpu=False, use_npu=False, ir_optim=True, use_tensorrt=False, min_subgraph_size=15, precision='fp32', gpu_mem=500, gpu_id=0, image_dir='C:\\Users\\Administrator\\Desktop\\screenshot.png', page_num=0, det_algorithm='DB', det_model_dir='C:\\Users\\Administrator/.paddleocr/whl\\det\\ch\\ch_PP-OCRv4_det_infer', det_limit_side_len=960, det_limit_type='max', det_box_type='quad', det_db_thresh=0.3, det_db_box_thresh=0.6, det_db_unclip_ratio=1.5, max_batch_size=10, use_dilation=False, det_db_score_mode='fast', det_east_score_thresh=0.8, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_sast_score_thresh=0.5, det_sast_nms_thresh=0.2, det_pse_thresh=0, det_pse_box_thresh=0.85, det_pse_min_area=16, det_pse_scale=1, scales=[8, 16, 32], alpha=1.0, beta=1.0, fourier_degree=5, rec_algorithm='SVTR_LCNet', rec_model_dir='C:\\Users\\Administrator/.paddleocr/whl\\rec\\ch\\ch_PP-OCRv4_rec_infer', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_batch_num=6, max_text_length=25, rec_char_dict_path='D:\\pythonProjectocr\\venv\\lib\\site-
[2024/05/03 13:51:02] ppocr INFO: **********C:\Users\Administrator\Desktop\screenshot.png**********
[2024/05/03 13:51:03] ppocr DEBUG: dt_boxes num : 114, elapse : 1.1326420307159424
[2024/05/03 13:51:30] ppocr DEBUG: rec_res num  : 114, elapse : 26.8485426902771
[2024/05/03 13:51:30] ppocr INFO: [[[30.0, 10.0], [119.0, 10.0], [119.0, 24.0], [30.0, 24.0]], ('13728009004', 0.9994849562644958)]
[2024/05/03 13:51:30] ppocr INFO: [[[136.0, 11.0], [152.0, 11.0], [152.0, 22.0], [136.0, 22.0]], ('?', 0.587970495223999)]
[2024/05/03 13:51:30] ppocr INFO: [[[418.0, 10.0], [468.0, 10.0], [468.0, 25.0], [418.0, 25.0]], ('一', 0.7388784885406494)][2024/05/03 13:51:30] ppocr INFO: [[[27.0, 59.0], [75.0, 59.0], [75.0, 74.0], [27.0, 74.0]], ('12:20:10', 0.9761993885040283)]
[2024/05/03 13:51:30] ppocr INFO: [[[95.0, 58.0], [179.0, 58.0], [179.0, 76.0], [95.0, 76.0]], ('55353/11万', 0.9962515234947205)]
[2024/05/03 13:51:30] ppocr INFO: [[[206.0, 58.0], [290.0, 58.0], [290.0, 76.0], [206.0, 76.0]], ('63493/11万', 0.9975852966308594)]
[2024/05/03 13:51:30] ppocr INFO: [[[314.0, 58.0], [399.0, 58.0], [399.0, 76.0], [314.0, 76.0]], ('69297/11万', 0.9952057600021362)]

  • 5
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

光能量

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值