当前位置:网站首页>C test calls the paddlesharp module to recognize pictures and words
C test calls the paddlesharp module to recognize pictures and words
2022-04-23 05:19:00 【gc_ two thousand two hundred and ninety-nine】
PaddleSharp yes PaddleInference C API Of C# Packaged version , Support in Windows(x64)、NVIDIA GPU and Linux(Ubuntu-20.04 x64) Use in .PaddleShare It mainly includes PaddleOCR and PaddleDetection, among PaddleOCR Support 14 Words in different languages , Support the recognition of text with multiple rotation angles ,PaddleDetection Support PPYolo Check the model and PicoDet Model ( About PaddleSharp See references for a detailed introduction of 1).
Can pass NuGet Manager Download PaddleSharp Related to the package , At first, I thought the package name was based on PaddleSharp start , It turns out that NuGet I can't find anything in the manager , stay GitHub Of PaddleSharp Home page , Lists PaddleSharp Related package list ( As shown in the figure below ), All of them Sdcb start , These bags are in NuGet You can search and install in the manager .
This paper mainly tests C# call PaddleSharp Of PaddleOCR Carry out picture and character recognition , reference 2 Of PaddleOCR The instructions for use list the packages to be installed , stay VS Install the following packages in ( At first, I didn't want to install so many , Just install Sdcb.PaddleOCR, Although the program can be compiled through , It can also run , However, in the process of recognizing the picture and text, it will always be prompted that some of the items in the drop-down package list are missing , Finally, you need to recognize pictures and words normally , You still need to pack all the following bags ).
Sdcb.PaddleInference
Sdcb.PaddleInference.runtime.win64.mkl
Sdcb.PaddleOCR
Sdcb.PaddleOCR.KnownModels
OpenCvSharp4
OpenCvSharp4.runtime.win
Refer to references 2 Function test the sample code in ( Please check the detailed code in the literature , I won't post it here ), The code sequence is mainly to load the model -> Loading pictures -> Identifying text -> Show results . Here we mainly talk about and use PaddleOCRSharp The difference between , Because the tests are simple , What I said is relatively simple .
PaddleOCRSharp and PaddleSharp Are written in other languages ocr Functional C# Packaged version , by comparison PaddleOCRSharp The encapsulation is simpler . adopt NuGet install PaddleOCRSharp, The dependent files will be automatically downloaded and associated to the project , and PaddleSharp You need to manually install all required packages .
PaddleOCRSharp Execute the required model, download it synchronously when installing the package and associate it with the project , and PaddleSharp, From the test code , It defaults from C:\Users\HP\AppData\Roaming\paddleocr-models\ppocr-v2 Read the required model in the folder , If it doesn't exist , Downloaded from the Internet in real time ,OCRModel The download path of various models is recorded in the object ( In the process of actual implementation , Due to the average download speed , Directly use Xunlei to manually download and copy to the corresponding folder ).
OCRModel model = KnownOCRModel.PPOcrV2;
await model.EnsureAll();
And when recognizing pictures and words ,PaddleOCRSharp It encapsulates , Just specify the image path in the program 、 Picture byte array or Image Object can , and PaddleSharp Functions that recognize pictures ,PaddleOcrAll.Run, You need to convert the picture to the specified Mat object .
PaddleSharp The results of recognition include two types ,PaddleOcrResult.Text Combine all the recognized characters into one string ,PaddleOcrResult.Regions Save each recognized text block in .
The text block type is PaddleOcrResultRegion, among Rect( The type is RotatedRect) Save rectangle position information containing text ( The rectangle may be non horizontal or vertical ).RotatedRect The definition of class is shown in the figure below , among BoundingRect Function returns a rectangle containing a rotation rectangle . Take the picture below as an example PaddleOcrResultRegion.Rect Is a red rectangle , and BoundingRect() Returns a purple rectangle . meanwhile RotatedRect Class Points Function returns the position information of the four corners of the rotating rectangle , You can draw a rotating rectangle containing text by drawing lines , It's simpler .
Finally, the recognition effect of the test image is listed ( Use the sample code in the references , The text blocks are basically circled out , But some of the contents are not correctly identified ).
reference
[1]https://github.com/sdcb/PaddleSharp
[2]https://github.com/sdcb/PaddleSharp/blob/master/docs/ocr.md
Test picture source
[1]https://baijiahao.baidu.com/s?id=1676249081188736513&wfr=spider&for=pc
[2]https://www.xjauto.net/html/cheping/202105/69508.html
[3]https://item.jd.com/10041422363991.html?openbpab=dontwritecookie&uabt=92_16_21&cu=true&utm_source=image.baidu.com&utm_medium=tuiguang&utm_campaign=t_1003608409_&utm_term=1a1dd3a2f0b24eaab2325b16b12d3d8d
[4]http://news.sohu.com/a/524033869_121124363
版权声明
本文为[gc_ two thousand two hundred and ninety-nine]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230516277530.html
边栏推荐
- Logrus set log format and output function name
- Mac enters MySQL terminal command
- Low code and no code considerations
- Swing display time (click once to display once)
- Summary of MySQL knowledge points
- Traversal of tree
- 2021-09-23
- How to add beautiful code blocks in word | a very complete method to sort out and compare
- The concept of meta universe is popular. Is virtual real estate worth investing
- Project manager's thinking mode worth trying: project success equation
猜你喜欢
[2022 ICLR] Pyramid: low complexity pyramid attention for long range spatiotemporal sequence modeling and prediction
At pgconf Asia Chinese technology forum, listen to Tencent cloud experts' in-depth understanding of database technology
Independent station operation | Facebook marketing artifact - chat robot manychat
Redis data type usage scenario
Discussion on flow restriction
Graphics.FromImage报错“Graphics object cannot be created from an image that has an indexed pixel ...”
了解 DevOps,必读这十本书!
JSP -- Introduction to JSP
[2021] Spatio-Temporal Graph Contrastive Learning
MySQL circularly adds sequence numbers according to the values of a column
随机推荐
Flip coin (Blue Bridge Cup)
Collaboration future object and concurrent futures
7-4 is it too fat (10 points) PTA
DevOps生命周期,你想知道的全都在这里了!
了解 DevOps,必读这十本书!
Study notes: unity customsrp-12-hdr
项目经理值得一试的思维方式:项目成功方程式
Master-slave replication of MariaDB database
Musk and twitter storm drama
[2021] Spatio-Temporal Graph Contrastive Learning
学习笔记:Unity CustomSRP-11-Post Processing---Bloom
Tensorflow realizes web face login system
使用zerotier让异地设备组局域网
Three 之 three.js (webgl)模型的删除/场景的清空/内存的释放 的简单整理
云计算与云原生 — OpenShift 的架构设计
数据安全问题已成隐患,看vivo如何让“用户数据”重新披甲
Live delivery form template - automatically display pictures - automatically associate series products
2021 年 25 大 DevOps 工具(下)
Acid of MySQL transaction
QPushButton slot function is triggered multiple times