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

天河网站建设集团连接友谊

天河网站建设集团,连接友谊,2015做那个网站能致富,培训心得网站建设在riscv编译安装飞桨PaddlePaddle参见: 算能RISC-V通用云编译飞桨paddlepaddleopenKylin留档_在riscv下进行paddlelite源码编译-CSDN博客 安装好飞桨,就可以用飞桨进行推理了。刚开始计划用ONNX推理,但是在算能云没有装上,所以最…

在riscv编译安装飞桨PaddlePaddle参见:

算能RISC-V通用云编译飞桨paddlepaddle@openKylin留档_在riscv下进行paddlelite源码编译-CSDN博客

安装好飞桨,就可以用飞桨进行推理了。刚开始计划用ONNX推理,但是在算能云没有装上,所以最终是用的飞桨推理。但是还是用到了Paddle2ONNX里的代码。

下载Paddle2ONNX源代码

git clone https://github.com/PaddlePaddle/Paddle2ONNX

ocr文字识别

下面是使用ONNX进行推理的示例,我没有弄成,希望有成功的朋友交流下经验。

安装需要的库

pip install shapely pyclipper

如果在riscv系统无法编译安装shapely,那么可以先安装包:

apt install libgeos-dev

下载相关模型文件

cd Paddle2ONNX/model_zoo/ocr# 下载det模型
wget https://bj.bcebos.com/paddle2onnx/model_zoo/ch_PP-OCRv2_det_infer.onnx# 下载rec模型
wget https://bj.bcebos.com/paddle2onnx/model_zoo/ch_PP-OCRv2_rec_infer.onnx# 下载cls模型
wget https://bj.bcebos.com/paddle2onnx/model_zoo/ch_ppocr_mobile_v2.0_cls_infer.onnx

进行识别

python3 infer.py  \
--det_model_dir=./ch_PP-OCRv2_det_infer.onnx  \
--rec_model_dir=./ch_PP-OCRv2_rec_infer.onnx  \
--cls_model_dir=./ch_ppocr_mobile_v2.0_cls_infer.onnx  \
--image_path=./images/lite_demo.png

使用飞桨推理进行文字识别

这个推理成功了。

下载和解压模型

wget -nc  -P ./inference https://bj.bcebos.com/paddle2onnx/model_zoo/ch_PP-OCRv2_det_infer.tar
cd ./inference && tar xf ch_PP-OCRv2_det_infer.tar && cd ..wget -nc  -P ./inference https://bj.bcebos.com/paddle2onnx/model_zoo/ch_PP-OCRv2_rec_infer.tar
cd ./inference && tar xf ch_PP-OCRv2_rec_infer.tar && cd ..wget -nc  -P ./inference https://bj.bcebos.com/paddle2onnx/model_zoo/ch_ppocr_mobile_v2.0_cls_infer.tar
cd ./inference && tar xf ch_ppocr_mobile_v2.0_cls_infer.tar && cd ..

进行文字识别

python3 infer.py \
--cls_model_dir=./inference/ch_ppocr_mobile_v2.0_cls_infer \
--rec_model_dir=./inference/ch_PP-OCRv2_rec_infer \
--det_model_dir=./inference/ch_PP-OCRv2_det_infer \
--image_path=./images/lite_demo.png \
--use_paddle_predict=True

推理识别结果

输出可紧致头发磷层,从而达到0.99444813即时持久改善头发光泽的效果,给干燥的头0.99019814发足够的滋养0.997668花费了0.457335秒

效果还不错

调试

ocr读取文件的时候报错:

Python 3.11.0rc2 (main, Sep  4 2023, 07:22:49) [GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/py311/lib/python3.11/site-packages/cv2/__init__.py", line 8, in <module>
    from .cv2 import *
ImportError: libtiff.so.6: cannot open shared object file: No such file or directory

安装libtiff

pip install pylibtiff

结果还是报错

找到libtiff.so.5文件在/lib/riscv64-linux-gnu,做了个链接。

  ln -s libtiff.so.5 libtiff.so.6

报错ImportError: libgtk-x11-2.0.so.0

SyntaxError: invalid syntax
(py311) root@863c89a419ec:~/github/Paddle2ONNX/model_zoo/ocr# python -c "import cv2"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/root/py311/lib/python3.11/site-packages/cv2/__init__.py", line 8, in <module>
    from .cv2 import *
ImportError: libtiff.so.6: cannot open shared object file: No such file or directory
(py311) root@863c89a419ec:~/github/Paddle2ONNX/model_zoo/ocr# python -c "import cv2"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/root/py311/lib/python3.11/site-packages/cv2/__init__.py", line 8, in <module>
    from .cv2 import *
ImportError: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

安装包:apt-get install libgtk2.0-dev

ok了

识别是numpy.int报错

    File "/root/github/Paddle2ONNX/model_zoo/ocr/utils/predict_det.py", line 210, in box_score_fast
    xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int), 0, w - 1)

File "/usr/local/lib/python3.8/dist-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])

AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:

进入/root/github/Paddle2ONNX/model_zoo/ocr/utils/predict_det.py源码,把np.int都改成np.int32

http://www.yayakq.cn/news/770933/

相关文章:

  • 二手房网站排行郑州全域静态管理
  • 帮人做logo网站中国域名后缀
  • 网站做视频网站修改
  • 做剧情游戏的网站雄安优秀网站建设
  • 网站建设公司广告 晴天娃娃wordpress使用邮件发博客
  • 哈尔滨网站建设培训大连做网站好的公司
  • 沈阳市铁西区建设局网站网站建设网站免费
  • wordpress适合任务网站吗网站运营方案
  • 怎么免费创建个人网站软文推广发稿平台
  • php响应式网站南昌公司网站建设
  • 网站开发交流平台网站正在建设中 蓝色
  • 域名备案网站源码百度秒收录技术最新
  • 阿里云服务器怎么建网站河北搜索引擎优化
  • 备案用的网站建设规划书怎么写网络推广公司营销方案
  • 酒店 wordpress长沙seo推广营销
  • 陕西富国建设工程有限公司网站域名购买之后怎么做网站
  • 成武城乡住房建设局网站网站开发评审时间安排
  • 零基础可以做网站吗网站开发的常用软件
  • 怎么自己做网站教程wordpress添加文章总数标签总数
  • 南海网站推广个人简历制作免费模板
  • 告诉你做网站需要多少钱在线域名解析ip地址查询
  • 婚恋网站 备案条件wordpress查看留言
  • 手机搭建网站教程河北石家庄旅游网页设计
  • 创建网站步骤网页设计免费模板后台
  • 论文中引用网站中企业网站备案
  • 城市门户网站策划书wordpress样式多的编辑器
  • 钟祥网站开发888集团浏览器app
  • WordPress网站关闭插件手机上怎么注册公司营业执照
  • 漳州做网站建设公司广西网站建设费用
  • 怎么做wep网站网站备案就是合法的