PaddleOCR - probably the best OCR tool available

Post your working scripts, libraries and tools for AHK v1.1 and older
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

PaddleOCR - probably the best OCR tool available

20 Sep 2021, 02:45

Visualization:

Image

Image

Image

Image



How to use:

1. OCR a img file ( bmp, dib, rle, jpg, jpeg, jpe, jfif, gif, tif, tiff, png )
MsgBox, % PaddleOCR("test_en.png")

2. OCR a PDF file
MsgBox, % PaddleOCR("test.pdf")

3. OCR a screenshot
MsgBox, % PaddleOCR([0, 0, 100, 200])

4. OCR a monitor
MsgBox, % PaddleOCR(1)

5. OCR a window
MsgBox, % PaddleOCR("ahk_exe notepad.exe")

6. OCR the clipboard
MsgBox, % PaddleOCR(ClipboardAll)

7. OCR the wallpaper
MsgBox, % PaddleOCR("wallpaper")

8. OCR the mouse cursor
MsgBox, % PaddleOCR(A_Cursor)

9. OCR a base64 string
MsgBox, % PaddleOCR("iVBORw0KGgoAAAANSUhEUgAAAFAAAAAjCAMAAAA0eX3wAAAARVBMVEUdISXMzMyyfkUdYZmXYSWyzMw/frMdQ3/MmGPMsn8/ISV8sswdIWMdIUWXzMzMzLNfmMx8QyXMzJlfISWXfn+XmLOXmGNE0xoSAAAA5klEQVRIx+2SWQ6DMBBDk7ClK9Dt/ketmViyUBp+WqmqGn8gM8w8PFFcVdXfqvFhZY9n7338IBAaut8H9uPc42RaxyPyu32qL94osgKyGl8C70BM4wzgw6iXq3OnA54WS3YNxAR6MZoBEcn6VGiX+ZZ7ygrId36TNI8Y/Jc1MRVskBWQAW2dWARijIeIgvEJlBWQ/dy5lBDNeFhCNJJCmwN9UgFoY1yj2UqolZGQyoGkEDjR2gkEWQF52zaAXLa3QD4VIiC3LsgKmHYuEHVr6ePQpcgAD6DImlP3ZLZwbd5QBVZVfVVP8SYLFHfLLvoAAAAASUVORK5CYII=")

10. OCR a URL
MsgBox, % PaddleOCR("https://www.baidu.com/img/flexible/logo/pc/result.png")

and more...



Thanks:

Download:
PaddleOCR
Last edited by tuzi on 16 Jan 2022, 22:49, edited 2 times in total.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 03:32

Thx for sharing this :thumbup:
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 08:12

Yes, thank you! I'm having trouble getting anything but a blank message box. I've done a quick-and-dirty machine translation of the comments in PaddleOCR.ahk. This leads me to believe I may need OpenCV, which I'll try now and report back. Belay that, opencv_world452.dll is in the package.
Attached is PaddleOCR_en_comments.zip (.ahk when unzipped) if anyone wants to take a look. If I've butchered the translations, by all means please let me know.

I'd very much like to know if others are having luck with this.

Regards,
burque505
Attachments
PaddleOCR_en_comments.zip
(3.12 KiB) Downloaded 427 times
guest3456
Posts: 3453
Joined: 09 Oct 2013, 10:31

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 09:08

i'm getting blank msgbox too

tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 10:25

Guys, please download the releases version, which contains all kinds of dll files and models needed, and then run the 0.note.ahk , you will see all the information you need to know.

PaddleOCR.ahk is just a library file, so don't try to run it.

@burque505
@guest3456
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 11:13

@tuzi, I did in fact download that version, and just downloaded it again. It appears, for one thing, that the folder 'ch_ppocr_server_v2.0_rec_infer' contains something incorrect. The supplied folder is 2.56MB, and at the link provided it's 94.8MB. After replacing it, still no luck.
The encoding for ppocr_keys_v1.txt is UTF-16 LE, I don't know if that makes a difference. I've tried it as supplied and downloading from the link provided and overwriting. No luck either way.
Regards,
burque505
guest3456
Posts: 3453
Joined: 09 Oct 2013, 10:31

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 11:37

tuzi wrote:
20 Sep 2021, 10:25
Guys, please download the releases version, which contains all kinds of dll files and models needed, and then run the 0.note.ahk , you will see all the information you need to know.

PaddleOCR.ahk is just a library file, so don't try to run it.
of course i've already done that. the PaddleOCR.ahk doesn't show any msgbox. i downloaded the full release, and tried running all the examples. please try it yourself on a clean VM or something

tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 11:41

@burque505
@guest3456

Please tell me the following 4 things.

Is the file you downloaded PaddleOCR-AutoHotkey_EN.zip?
Do you have vc2015-vc2017 x64 runtime library?
Is your cpu too old?
The full path of the file PaddleOCR.ahk .
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 11:58

1) Yes.
2) Yes.
3) Probably not. How old is too old? Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz, 3201 Mhz, 4 Core(s), 4 Logical Processor(s). 32GB RAM, NVIDIA Quadro FX 580.
4) %UserProfile%\Documents\AHK\OCR\PaddleOCR-AutoHotkey\PaddleOCR\PaddleOCR.ahk

EDIT: I tried the Mandarin version also, still just blank message boxes.
guest3456
Posts: 3453
Joined: 09 Oct 2013, 10:31

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 12:10

1. yes
2. i dont know, how do i check?
3. intel(R) Core(TM) i5-6300U CPU @ 2.40GHz 2.50 GHz
4. %UserProfile%\Desktop\PaddleOCR-AutoHotkey_EN\PaddleOCR-AutoHotkey\PaddleOCR\PaddleOCR.ahk

hasantr
Posts: 933
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 12:11

I didn't manage to work with OCR too. The message boxes are empty.
sofista
Posts: 644
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 14:12

It didn't work here either, just empty message boxes.
malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 15:03

tuzi, Your dll does not contain such function:

Code: Select all

PaddleOCR\init
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 16:29

@tuzi, what I see in there are the following exported functions:

Code: Select all

destroy
load_config
load_config_file
ocr_from_binary
ocr_from_file
Only ''ocr_from_binary" and "destroy" seem to be used. There doesn't seem to be any provision for loading configs either from arguments or from a file. As malcev says, no "init." Also no "ocr_from_file."

Is the wrong "PaddleOCR.dll" included, perhaps? It's hard to see how this package could function as supplied.

Regards,
burque505
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 21:30

@burque505
@guest3456
@hasantr
@sofista
@malcev

I fixed the problem, please try again.
Please note that if you don't know have you installed the vc2015-vc2017 x64 runtime library. choose to install it again.
sofista
Posts: 644
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: PaddleOCR - probably the best OCR tool available

20 Sep 2021, 22:39

@tuzi

Worked here, the new version did fine on all the 7 tests. Thank you.
hasantr
Posts: 933
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: PaddleOCR - probably the best OCR tool available

21 Sep 2021, 06:13

tuzi wrote:
20 Sep 2021, 21:30
@burque505
@guest3456
@hasantr
@sofista
@malcev

I fixed the problem, please try again.
Please note that if you don't know have you installed the vc2015-vc2017 x64 runtime library. choose to install it again.
Thank you. Now it works perfectly. Only in English and Chinese?
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: PaddleOCR - probably the best OCR tool available

21 Sep 2021, 07:38

@tuzi, working for me also! Thank you very much, this is a fine addition. Very encouraging.
As @hasantr notes, only English and Chinese at the moment, but maybe more can be added (not without some effort)?
See UAB training set downloads.
I have registered for downloads, but no activation email yet. I get the feeling the training sets will be enormous, and I suppose some .dict files will be needed.
Regards,
burque505
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: PaddleOCR - probably the best OCR tool available

21 Sep 2021, 08:35

@hasantr
@burque505

You can directly download the trained model and replace it. Officials say it supports 80+ language.

See 0.note.ahk for specific information.
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: PaddleOCR - probably the best OCR tool available

21 Sep 2021, 10:55

@tuzi, thanks. Here's a link that may help also: PaddleOCR multi-languages github page

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 80 guests