0


9步搭建Windows下PaddleOCR图片文字识别WebAPI

本文实现在windows平台下依靠现有资源来搭建一个图片文字识别的WebAPI,便于其他项目通过Post方式将图片进行Base64编码后传到该API,能够得到图片中的文字信息

第一步:安装Python环境

我安装的是 python-3.8.8-amd64.exe 版本,不要用最新的版本,3.11的版本环境搭建不起来

双击进行安装,安装时勾选添加环境变量

接下来,打开cmd,安装依赖包,安装过程中用了国内的镜像,速度会快不少

第二步:安装 opencv-python
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
第三步:安装 paddleocr
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple paddleocr
第四步:安装 paddlepaddle
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple paddlepaddle
第五步:安装 Flask
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple Flask
第六步:安装 DateTime
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple DateTime
第七步:编写 PaddleOCR.py 文件,并放在D盘根目录中,文件内容如下:
import io
from pickle import DICT
import paddleocr
import json
import base64
import DateTime
from flask import Flask, request,jsonify
import numpy as np
from PIL import Image
app=Flask(__name__)

@app.route("/WebAPI/PaddleOCR",methods=["POST"])
def PaddleOCR():
    if(request.data == "" or request.data.decode('utf-8') == ""):
        return "request data is empty"
    data=json.loads(request.data)
    imgbase64=data["image"]
    imgbyte=base64.b64decode(imgbase64)
    image=io.BytesIO(imgbyte)
    temp= Image.open(image)
    img=np.array(temp)[:,:,:3]
    info= ppocr.ocr(img)
    if(info[0] == None):
        return "ocr failed"
    result={"TextBlocks":[]}
    for textblocks in info[0]:
        textBlock={"Points":[],"Text":""}
        for tk in textblocks[0]:
            point={"x":str(tk[0]),"y":str(tk[1])}
            textBlock["Points"].append(point)
        textBlock["Text"]=textblocks[1][0]
        result["TextBlocks"].append(textBlock)
    return jsonify(result)

def main():
    global ppocr
    ppocr=paddleocr.PaddleOCR(use_gpu=False)
    app.run(debug=True,host="127.0.0.1",port=5000)
if __name__=="__main__":
    main()

其中 app.run(debug=True,host="127.0.0.1",port=5000) 指定了api的地址和端口

这个接口使用POST方式接收一个名称为image的参数,该参数里存的是需要被识别图片的Base64编码,返回的则是一个JSON格式的识别后的结果

第八步:启动API服务

打开cmd,定位到D盘,执行命令

python PaddleOCR.py

如果以上环境都已安装完毕,此时服务就能被顺利启动起来!

第九步:编写客户端程序,测试图片文字识别服务是否有用!

测试程序使用c#编写,项目引用下Newtonsoft的包

httphelper代码里就提供一个post方法如下:

    public static class HttpHelper
    {
        /// <summary>
        /// post
        /// </summary>
        /// <param name="url"></param>
        /// <param name="joReq"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        public static JObject Post(string url, JObject joReq, int timeout = 5)
        {
            JObject joAck;

            string result;
            try
            {
                result = Post(url, joReq.ToString(), timeout);
            }
            catch (Exception err)
            {
                joAck = new JObject();
                joAck["Code"] = -1;
                joAck["Msg"] = "无法连接到服务器,请联系开发人员 " + err;
                return joAck;
            }
            try
            {
                joAck = JObject.Parse(result);
                return joAck;
            }
            catch (Exception err)
            {
                joAck = new JObject();
                joAck["Code"] = -1;
                joAck["Msg"] = "json数据解析出错,请联系开发人员 " + err;
                return joAck;
            }
        }

        private static string Post(string url, string data, int timeout = 5)
        {
            byte[] byteArray = Encoding.UTF8.GetBytes(data);
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
            req.Method = "POST";
            req.ContentLength = byteArray.Length;
            //连接超时时长有时不可控,即使未达到设置的时长,一旦整个路由都已经遍历,也会直接抛出异常
            req.Timeout = timeout * 1000;
            req.ReadWriteTimeout = timeout * 1000;
            using (Stream newStream = req.GetRequestStream())
            {
                newStream.Write(byteArray, 0, byteArray.Length);
            }
            HttpWebResponse response = (HttpWebResponse)req.GetResponse();
            using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
            {
                return sr.ReadToEnd(); // 返回的数据
            }
        }
    }

下面测试识别中的文字:

首先把该图片的Base64获取到:

/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQE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sj9inGHzsf0o/Yp6vJ7nP9af5cek1+20fRp+PIGlT3GHzsf0o/Ypxh87H9KP2Kerye5z/Wn+XHpNfttH0afjyBpU9xh87H9KP2KU9Xk9zn+tP8uPSa/baPo0/HnrVKUr4fn3HFKUpxxSlKccUpSnHFKUpxxSlKccUpSnHFKUpxxSlKccUpSnHFKUpxz/2Q==

然后通过POST方式提交到API获取识别结果:

JObject joReq = new JObject
            {
                ["image"] = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAjAKUDASIAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAUGCQgHBAr/xAArEAABAwMDBAMAAQUBAAAAAAAGBAUHAAMIAQIWU1ST1AkRpCESEzV0tCP/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAwQFAQYC/8QALREAAwEAAQIEBQIHAQAAAAAAAQIDBAAREgUTFFQVkZPR0iEjIiQxMjRBUXH/2gAMAwEAAhEDEQA/AP3lkBAqalVlMmsp9+m9Ptv799/bc3a/e65dt6bdulu7a+vr+1rrrrrru+/6tNNNNPr+YHmTp0EHiUe1Qy/ylj/Qtf8AQqrO1VcAW6xeuOoXBTi5uxjMzg4OJ+BQ0+kK68nnuVGWxduuR3OcXPd9LYQNCRCl26MLgis7Eutmw+X99u83NfcIy5sWWr5Eu9QQxLlD1/U9Se1uv/P6Dpzhg6tO3VJNbwSRBUBA46HoAAO5en/vU9eaJcydOgg8Sj2qcydOgg8Sj2qz+hBCnHJbv2A5yH0scn7RNJEmDh5uErFlldRk4ixybdVrgByjIoetUNzRLKgbQatTcEOOxiaGlO8tLijSjqhJxj8rvyOkWFLzD4cGSJ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vD5e+pyaOY7UhRS77FKjR5BW/nDSwbk9nRFIJJop37kvb3GHzsf0o/Ypxh87H9KP2KpK2CP6TvnC9twqnQpCto0Lsq4JoW7m2Pu0gFiiv4nrmEEJeHRwTpDdUlnhpZyuZGb07AsmSVs8EIEwoC56QiSqq7LizOzGr7Ka4GlT3GHzsf0o/Ypxh87H9KP2Kp6vJ7nP9af5c/HpNfttH0afjyBpU9xh87H9KP2KcYfOx/Sj9inq8nuc/1p/lx6TX7bR9Gn48gaVPcYfOx/Sj9inGHzsf0o/Yp6vJ7nP9af5cek1+20fRp+PIGlT3GHzsf0o/Ypxh87H9KP2Kerye5z/Wn+XHpNfttH0afjyBpU9xh87H9KP2KU9Xk9zn+tP8uPSa/baPo0/HnrVKUr4fn3HFKUpxxSlKccUpSnHFKUpxxSlKccUpSnHFKUpxxSlKccUpSnHFKUpxz/2Q==",
            };
            var result = HttpHelper.Post("http://127.0.0.1:5000/WebAPI/PaddleOCR", joReq, 10 * 1000);

运行代码,顺利获取到图片的文字内容:


本文转载自: https://blog.csdn.net/deanZZZZZZ/article/details/133992010
版权归原作者 deanZZZZZZ 所有, 如有侵权,请联系我们删除。

“9步搭建Windows下PaddleOCR图片文字识别WebAPI”的评论:

还没有评论