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

Re: PaddleOCR - probably the best OCR tool available

Post by tuzi » 03 Oct 2021, 08:27

2021.10.03
  • Update PaddleOCR.dll to 2.3.
  • Update detection model to ch_PP-OCRv2_det.
  • Update ImagePut.ahk to 1.2 beta.
  • Load configs no longer requires temporary file.
  • Rename dict file and model directories

leosouza85
Posts: 90
Joined: 22 Jul 2016, 16:28

Re: PaddleOCR - probably the best OCR tool available

Post by leosouza85 » 03 Oct 2021, 17:31

I'm using ocr clipboard
printscreen and the script, but its does not ocr everything on the screen, why?

leosouza85
Posts: 90
Joined: 22 Jul 2016, 16:28

Re: PaddleOCR - probably the best OCR tool available

Post by leosouza85 » 03 Oct 2021, 19:14

It is possible to use this script to find a word and then click it?

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

Re: PaddleOCR - probably the best OCR tool available

Post by tuzi » 03 Oct 2021, 19:38

viv wrote:
03 Oct 2021, 06:44
Thanks for sharing
Why can't I copy content to the clipboard?

Code: Select all

o := PaddleOCR(ClipboardAll)
MsgBox, % o
Clipboard := o
Even when I press CTRL +C on the msgbox, it causes it to disappear

Copying such a msgbox will get its contents and will not cause it to disappear

Code: Select all

o := "my text"
MsgBox, % o
i don't have this problem, maybe you can try version 2021.10.03 ?

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

Re: PaddleOCR - probably the best OCR tool available

Post by tuzi » 03 Oct 2021, 19:41

leosouza85 wrote:
03 Oct 2021, 17:31
I'm using ocr clipboard
printscreen and the script, but its does not ocr everything on the screen, why?
look 0.note.ahk

then set "visualize":1 in your code.

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

Re: PaddleOCR - probably the best OCR tool available

Post by tuzi » 03 Oct 2021, 19:43

leosouza85 wrote:
03 Oct 2021, 19:14
It is possible to use this script to find a word and then click it?
look 6.Get all information.ahk

use the pos of str. then click it.

leosouza85
Posts: 90
Joined: 22 Jul 2016, 16:28

Re: PaddleOCR - probably the best OCR tool available

Post by leosouza85 » 05 Oct 2021, 18:52

tuzi wrote:
03 Oct 2021, 19:43
leosouza85 wrote:
03 Oct 2021, 19:14
It is possible to use this script to find a word and then click it?
look 6.Get all information.ahk

use the pos of str. then click it.
Thank you so much!

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

Re: PaddleOCR - probably the best OCR tool available

Post by tuzi » 06 Oct 2021, 01:13

leosouza85 wrote:
05 Oct 2021, 18:52
tuzi wrote:
03 Oct 2021, 19:43
leosouza85 wrote:
03 Oct 2021, 19:14
It is possible to use this script to find a word and then click it?
look 6.Get all information.ahk

use the pos of str. then click it.
Thank you so much!


this tool FindText maybe better for you.

leosouza85
Posts: 90
Joined: 22 Jul 2016, 16:28

Re: PaddleOCR - probably the best OCR tool available

Post by leosouza85 » 06 Oct 2021, 06:19

tuzi wrote:
06 Oct 2021, 01:13
leosouza85 wrote:
05 Oct 2021, 18:52
tuzi wrote:
03 Oct 2021, 19:43
leosouza85 wrote:
03 Oct 2021, 19:14
It is possible to use this script to find a word and then click it?
look 6.Get all information.ahk

use the pos of str. then click it.
Thank you so much!


this tool FindText maybe better for you.
Yes, I know this tool, but I'm looking for new and flexible approaches, any tips to increase the accuracy on PaddleOCR?

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

Re: PaddleOCR - probably the best OCR tool available

Post by tuzi » 14 Oct 2021, 07:27

Try to adjust the configs, for example

det_db_thresh
det_db_box_thresh
det_db_unclip_ratio

@leosouza85

arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: PaddleOCR - probably the best OCR tool available

Post by arcticir » 14 Oct 2021, 09:03

Sorry. Edited.

malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: PaddleOCR - probably the best OCR tool available

Post by malcev » 14 Oct 2021, 09:25

arcticir, thanks for info, but why in chinese?

sanmaodo
Posts: 45
Joined: 28 Aug 2020, 01:39

Re: PaddleOCR - probably the best OCR tool available

Post by sanmaodo » 17 Oct 2021, 14:10

@tuzi
Thank you from the bottom of my heart!

hughman
Posts: 18
Joined: 17 Jun 2014, 09:39

Re: PaddleOCR - probably the best OCR tool available

Post by hughman » 19 Oct 2021, 04:21

only support x64? is it possible for x86?

leosouza85
Posts: 90
Joined: 22 Jul 2016, 16:28

Re: PaddleOCR - probably the best OCR tool available

Post by leosouza85 » 19 Nov 2021, 12:53

leosouza85 wrote:
03 Oct 2021, 17:31
I'm using ocr clipboard
printscreen and the script, but its does not ocr everything on the screen, why?
Answering myself but in hope that will help others, I've changed the PaddleOCR.ahk parameter max_side_len, from 960 to 1920 that is my horizontal resolution, and now it OCR the whole screen.

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

Re: PaddleOCR - probably the best OCR tool available

Post by tuzi » 24 Nov 2021, 03:39

2021.11.24
  • When set "get_all_info" to 1, the return value is an object.
  • Fix a bug when set "get_all_info" to 1.
  • Update example 6 and 7.
  • Update ImagePut.ahk to 1.3.

iseahound
Posts: 1444
Joined: 13 Aug 2016, 21:04
Contact:

Re: PaddleOCR - probably the best OCR tool available

Post by iseahound » 24 Nov 2021, 23:21

One thing that I noticed is that if the file name and the window name are the same, "text.png" is open in a window with the same title - it will use the window over the file.

I don't know if this bothers anyone.

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

Re: PaddleOCR - probably the best OCR tool available

Post by tuzi » 16 Jan 2022, 22:39

2022.01.10
  • Support OCR PDF file directly.
  • Fix a bug when set "get_all_info" to 1.
  • Add 4 examples.
  • Update all examples.
  • Update ImagePut.ahk to 1.5.1.

newcod3r
Posts: 505
Joined: 30 Sep 2021, 02:16

Re: PaddleOCR - probably the best OCR tool available

Post by newcod3r » 11 Apr 2022, 03:58

Thank you for this.

1. May I know how to train the model to get better? it is still quite inaccurate based on this screenshot:
image.png
image.png (137.56 KiB) Viewed 3190 times
2. How do I get ahk to select the region first before it inputs the coordinates into the function? A sample will be appreciated. Thanks!

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

Re: PaddleOCR - probably the best OCR tool available

Post by tuzi » 13 Apr 2022, 07:41

newcod3r wrote:
11 Apr 2022, 03:58
Thank you for this.

1. May I know how to train the model to get better? it is still quite inaccurate based on this screenshot:

image.png

2. How do I get ahk to select the region first before it inputs the coordinates into the function? A sample will be appreciated. Thanks!
1. https://github.com/PaddlePaddle/PaddleOCR

2. You're lucky I ever wrote that.(you need btt lib or replace all btt() to tooltip)

Code: Select all

arr := select_range()

; MsgBox, % PaddleOCR(arr)

select_range()
{
  KeyWait, LButton
  For k,v in StrSplit("LButton,Left,Right,Up,Down", ",")
    Hotkey, % v, GetRange_KeyOff, On
  if (0)
  {
    GetRange_KeyOff:
    return
  }
  Gui, GetRange: Destroy
  Gui, % "GetRange: +AlwaysOnTop -Caption +ToolWindow"
    . " +Hwndid -DPIScale +E0x08000000"
  ok:=0
  CoordMode, Mouse, Screen
  While !GetKeyState("Ctrl","P")
  {
    Sleep, 50
    if (ok!=2)
      btt("drag to select a range",,, 2, {FontSize:14})
    MouseGetPos, x2, y2, win
    if (ok=0)
    {
      if GetKeyState("LButton","P")
        ok:=1, x1:=x2, y1:=y2, outWin:=win
    }
    else if (ok=1)
    {
      GetKeyState("Left","P")  && x1--
      GetKeyState("Right","P") && x1++
      GetKeyState("Up","P")    && y1--
      GetKeyState("Down","P")  && y1++
      w:=Floor(Abs(x1-x2)), h:=Floor(Abs(y1-y2))
      x:=Floor(Min(x1,x2)), y:=Floor(Min(y1,y2))
      d:=2, x-=d, y-=d, w+=2*d, h+=2*d, i:=w-d, j:=h-d
      s:="0-0 " (w "-0 ") (w "-" h) (" 0-" h) " 0-0  "
      . (d "-" d) " " (i "-" d) " " (i "-" j) " " (d "-" j) " " (d "-" d)
      WinSet, Region, %s%, ahk_id %id%
      Gui, GetRange: Color, % (A_MSec<500 ? "Red":"Blue")
      Gui, GetRange: Show, NA x%x% y%y% w%w% h%h%
      if !GetKeyState("LButton","P")
        ok:=2
    }
    else if (ok=2)
    {
      btt("arrow keys to fine-tune the position`nclick the left button to confirm",,, 2, {FontSize:14})
      GetKeyState("Left","P")  && x--
      GetKeyState("Right","P") && x++
      GetKeyState("Up","P")    && y--
      GetKeyState("Down","P")  && y++
      Gui, GetRange: Color, % (A_MSec<500 ? "Red":"Blue")
      Gui, GetRange: Show, NA x%x% y%y%
      if GetKeyState("LButton","P")
        Break
    }
  }
  x1:=x+d, y1:=y+d, x2:=x+w-1-d, y2:=y+h-1-d
  Gui, GetRange: Destroy
  btt(,,, 2)
  KeyWait, LButton
  For k,v in StrSplit("LButton,Left,Right,Up,Down", ",")
    Hotkey, % v, Off
  return [x1, y1, Abs(x2-x1), Abs(y2-y1), outWin]
}

Post Reply

Return to “Scripts and Functions (v1)”