当前位置:   article > 正文

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

paddleocr api

目录

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

第一步:安装Python环境

第二步:安装 opencv-python

第三步:安装 paddleocr

第四步:安装 paddlepaddle 

 第五步:安装 Flask

 第六步:安装 DateTime

第七步:编写 PaddleOCR.py 文件,并放在D盘根目录中,文件内容如下:

第八步:启动API服务


本文实现在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盘根目录中,文件内容如下:
  1. import io
  2. from pickle import DICT
  3. import paddleocr
  4. import json
  5. import base64
  6. import DateTime
  7. from flask import Flask, request,jsonify
  8. import numpy as np
  9. from PIL import Image
  10. app=Flask(__name__)
  11. @app.route("/WebAPI/PaddleOCR",methods=["POST"])
  12. def PaddleOCR():
  13. if(request.data == "" or request.data.decode('utf-8') == ""):
  14. return "request data is empty"
  15. data=json.loads(request.data)
  16. imgbase64=data["image"]
  17. imgbyte=base64.b64decode(imgbase64)
  18. image=io.BytesIO(imgbyte)
  19. temp= Image.open(image)
  20. img=np.array(temp)[:,:,:3]
  21. info= ppocr.ocr(img)
  22. if(info[0] == None):
  23. return "ocr failed"
  24. result={"TextBlocks":[]}
  25. for textblocks in info[0]:
  26. textBlock={"Points":[],"Text":""}
  27. for tk in textblocks[0]:
  28. point={"x":str(tk[0]),"y":str(tk[1])}
  29. textBlock["Points"].append(point)
  30. textBlock["Text"]=textblocks[1][0]
  31. result["TextBlocks"].append(textBlock)
  32. return jsonify(result)
  33. def main():
  34. global ppocr
  35. ppocr=paddleocr.PaddleOCR(use_gpu=False)
  36. app.run(debug=True,host="127.0.0.1",port=5000)
  37. if __name__=="__main__":
  38. 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方法如下:

  1. public static class HttpHelper
  2. {
  3. /// <summary>
  4. /// post
  5. /// </summary>
  6. /// <param name="url"></param>
  7. /// <param name="joReq"></param>
  8. /// <param name="timeout"></param>
  9. /// <returns></returns>
  10. public static JObject Post(string url, JObject joReq, int timeout = 5)
  11. {
  12. JObject joAck;
  13. string result;
  14. try
  15. {
  16. result = Post(url, joReq.ToString(), timeout);
  17. }
  18. catch (Exception err)
  19. {
  20. joAck = new JObject();
  21. joAck["Code"] = -1;
  22. joAck["Msg"] = "无法连接到服务器,请联系开发人员 " + err;
  23. return joAck;
  24. }
  25. try
  26. {
  27. joAck = JObject.Parse(result);
  28. return joAck;
  29. }
  30. catch (Exception err)
  31. {
  32. joAck = new JObject();
  33. joAck["Code"] = -1;
  34. joAck["Msg"] = "json数据解析出错,请联系开发人员 " + err;
  35. return joAck;
  36. }
  37. }
  38. private static string Post(string url, string data, int timeout = 5)
  39. {
  40. byte[] byteArray = Encoding.UTF8.GetBytes(data);
  41. HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
  42. req.Method = "POST";
  43. req.ContentLength = byteArray.Length;
  44. //连接超时时长有时不可控,即使未达到设置的时长,一旦整个路由都已经遍历,也会直接抛出异常
  45. req.Timeout = timeout * 1000;
  46. req.ReadWriteTimeout = timeout * 1000;
  47. using (Stream newStream = req.GetRequestStream())
  48. {
  49. newStream.Write(byteArray, 0, byteArray.Length);
  50. }
  51. HttpWebResponse response = (HttpWebResponse)req.GetResponse();
  52. using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
  53. {
  54. return sr.ReadToEnd(); // 返回的数据
  55. }
  56. }
  57. }

下面测试识别中的文字:

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

/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAjAKUDASIAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAUGCQgHBAr/xAArEAABAwMDBAMAAQUBAAAAAAAGBAUHAAMIAQIWU1ST1AkRpCESEzV0tCP/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAwQFAQYC/8QALREAAwEAAQIEBQIHAQAAAAAAAQIDBAAREgUTFFQVkZPR0iEjIiQxMjRBUXH/2gAMAwEAAhEDEQA/AP3lkBAqalVlMmsp9+m9Ptv799/bc3a/e65dt6bdulu7a+vr+1rrrrrru+/6tNNNNPr+YHmTp0EHiUe1Qy/ylj/Qtf8AQqrO1VcAW6xeuOoXBTi5uxjMzg4OJ+BQ0+kK68nnuVGWxduuR3OcXPd9LYQNCRCl26MLgis7Eutmw+X99u83NfcIy5sWWr5E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XPmlHPn6UDRlGYRgQzNnlkxBMxOU6w1lJj2GQPJMnxrG8wwm6guQJoYRgNqwCYVgGRrSMYkoJimcHZgJ2IjjJiblo/fjJwbTQTJSBEoJBlU1oNzlzaqwkymZ8NLOHbAT4+EIpHkUY1q4rdF++RQVe7zlFc5ay1IgqR3UTOftoFAKlmGQQLiK4OD5oXhiHV63PjMQJGtnRKtn+MPnY/pR+xTjD52P6UfsVENiWTRXZJU72eIF49Mxe/iO1hFT1RgfEvFdniZGhL/zrqSfToM/L9mzuVzioX/YNHOe3fdszYFi9Kf3hkx+HZvDP2Wkp8PDxK+YRVccEuGmSr9nQFZ4FW2Cx16bbLPFxLj2PyGfFsb7I5uAry1vGRTaZOMOhat7y+HXgldo7E3NfHTGxLMc9F8aqi5iVEyl0ZescE4glfHzGkDguXEUebHaJ9i4LGn2ODQkMG4zCW9TuvD5e+pyaOY7UhRS77FKjR5BW/nDSwbk9nRFIJJop37kvb3GHzsf0o/Ypxh87H9KP2KpK2CP6TvnC9twqnQpCto0Lsq4JoW7m2Pu0gFiiv4nrmEEJeHRwTpDdUlnhpZyuZGb07AsmSVs8EIEwoC56QiSqq7LizOzGr7Ka4GlT3GHzsf0o/Ypxh87H9KP2Kp6vJ7nP9af5c/HpNfttH0afjyBpU9xh87H9KP2KcYfOx/Sj9inq8nuc/1p/lx6TX7bR9Gn48gaVPcYfOx/Sj9inGHzsf0o/Yp6vJ7nP9af5cek1+20fRp+PIGlT3GHzsf0o/Ypxh87H9KP2Kerye5z/Wn+XHpNfttH0afjyBpU9xh87H9KP2KU9Xk9zn+tP8uPSa/baPo0/HnrVKUr4fn3HFKUpxxSlKccUpSnHFKUpxxSlKccUpSnHFKUpxxSlKccUpSnHFKUpxz/2Q==",
  4. };
  5. var result = HttpHelper.Post("http://127.0.0.1:5000/WebAPI/PaddleOCR", joReq, 10 * 1000);

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

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号