当前位置:首页 > 技术记录 > 正文内容

安装飞桨https://www.paddlepaddle.org.cn/

ogfogf3年前 (2022-09-07)技术记录45140

是在python3.8下成功的


yum install python38


python3.8 -m pip install paddlepaddle==2.3.2 -i https://pypi.tuna.tsinghua.edu.cn/simple


============

下面都加

python3.8 -m pip


第一:安装 python

第二步:安装cv2

宝塔提示 Command "python setup.py egg_info" failed with error code 1 in

更新下python3.8 -m pip install --upgrade --force pip

如果你已经装好了pip,那就直接

python3.8 -m pip install opencv-python

如果:ImportError: libGL.so.1: cannot open shared object file: No such file or directory cv2报错opencv-python安装错误.

解决方案 将原来下载的opencv卸载然后

python3.8 -m pip install opencv-python-headless

python3.8 -m pip install opencv-contrib-python-headless

Python使用pip安装matplotlib模块

python3.8 -m pip install matplotlib进行自动的安装,系统会自动下载安装包。

===========

下载 https://github.com/PaddlePaddle/PaddleOCR

cd PaddleOCR

python3.8 -m pip install -r requirements.txt


python3.8 -m pip install "paddleocr>=2.0.1" -i https://mirror.baidu.com/pypi/simple --default-timeout=10000



===================

from paddleocr import PaddleOCR, draw_ocr

from PIL import Image



# load model

# Paddleocr目前支持中英文、英文、法语、德语、韩语、日语,可以通过修改 lang参数进行切换

# lang参数依次为`ch`, `en`, `french`, `german`, `korean`, `japan`

ocr = PaddleOCR(lang="ch",

                use_gpu=False,

                det_model_dir="../paddleORC_model/ch_ppocr_server_v2.0_det_infer/",

                cls_model_dir="ch_ppocr_mobile_v2.0_cls_infer/",

                rec_model_dir="ch_ppocr_server_v2.0_rec_infer/")


# load dataset

img_path = 'abc.jpg'

result = ocr.ocr(img_path)

for line in result:

    print(line)


# 注:

# result是一个list,每个item包含了文本框,文字和识别置信度

# line的格式为:

# [[[3.0, 149.0], [43.0, 149.0], [43.0, 163.0], [3.0, 163.0]], ('人心安', 0.6762619018554688)]

# 文字框 boxes = line[0],包含文字框的四个角的(x,y)坐标

# 文字 txts = line[1][0]

# 识别置信度 scores = line[1][1]


# visual

image = Image.open(img_path).convert('RGB')

boxes = [line[0] for line in result]

txts = [line[1][0] for line in result]

scores = [line[1][1] for line in result]

im_show = draw_ocr(image, boxes, txts, scores)

im_show = Image.fromarray(im_show)

im_show.save('result.jpg')






扫描二维码推送至手机访问。

版权声明:本文由技术建站文档发布,如需转载请注明出处。

分享给朋友:

相关文章

autojs 入门及安装

autojs 入门及安装

下载Visual Studio Code https://pc.qq.com/detail/16/detail_22856.htmlAuto.js是什么#安卓脚本框架可以做的事情#数据监控:...

CentOS 7关闭firewalld启用iptables 开放端口

CentOS 7关闭firewalld启用iptables 开放端口

在CentOS7中,有很多CentOS 6中的常用服务发生了变化。其中iptables是其中比较大的一个。防火墙iptables被firewalld取代。本文将介绍,如果采用systemctl关闭fi...

怎么在windows下运行shell命令

要安装官网地址: https://www.git-scm.com/用git的命令行。test.sh 用这个开头就可以#!/usr/bin/env shwindows单击右键,选择o...

Linux关闭防火墙命令

一、下面是red hat/CentOs7关闭防火墙的命令!1:查看防火状态systemctl status firewalldservice iptables status2:暂时关闭防火墙syste...

mariadb 在低配 VPS 上崩溃问题处理方案

本文章向大家介绍mariadb 在低配 VPS 上崩溃问题处理方案,主要包括mariadb 在低配 VPS 上崩溃问题处理方案使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要...

微擎忘记密码怎么找回?(内含一键重置密码工具)

密码找回工具为微擎百科修复版,修复版解决了重置密码后无法登录问题,原因:微擎新版本优化了user_single函数,导致重置密码丢失salt参数。链接: https://pan.baidu....