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

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

ogfogf4年前 (2022-09-07)技术记录73296

是在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')






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

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

分享给朋友:

相关文章

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

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

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

linux下mysql忘记密码怎么办

前言今天在服务器安装mysql之后,登录发现密码错误,但是我没有设置密码呀,最后百度之后得知,mysql在5.7版本之后会自动创建一个初始密码。报错如下:[root@mytestlnx02 ...

怎么在windows下运行shell命令

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

PHP 正则匹配所有内容

<html>(.*)</html>  这样根本不行,因为源代码里面有换行ch(13),还有一些 tab键,应该这样: preg_match(...

linux查看端口常用命令

netstat命令参数:  -t : 指明显示TCP端口  -u : 指明显示UDP端口  -l : 仅显示监听套接字(所谓套接字就是使应用程序能够读写与收发通讯协议(protocol)与资料的程序)...

常用的HTML和CSS content属性特殊字符

还有一点需要注意的是,部分字符在不同浏览器中显示的效果不同,所以在使用的时候,需要自己在不同的浏览器中进行试验。在苹果和安卓等系统的智能设备下的识别度也比较差,所有希望慎用。废话不多说上干货:各种箭头...