B4J Question 1st PyBridge try: alfa-test

peacemaker

Expert
Licensed User
Longtime User
Hi, All and @Erel ,

Just tried for the first time your PyBridge draft. B4J 10.0
Compiling at line:
Dim correctClassesNames As Map = jo.InitializeStatic("anywheresoftware.b4a.randomaccessfile.RandomAccessFile").GetField("correctedClasses")
gives the error:
Just alfa-test...
Any updates in jRandomAccessFile lib?
 

Attachments

  • TempDownload.png
    17.8 KB · Views: 180
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Thanks.
PyBridge is not yet on beta stage
Sure, let it be public alfa-test.

It's started, but not for too long:

Error is just after opening a picture.
My Python path is:
"D:\Programs\winpy\WPy64-31241\python-3.12.4.amd64\python.exe"
60 symbols, maybe critical...
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
For ref:
1) 5+ GB of Python are to be installed...
2) If under Win - after start "WinPython Terminal.exe" - it needs to install the EasyOCR https://www.jaided.ai/easyocr/install/ Python library with its dependencies (OpenCV and others)...

Technologies now are oversized...
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Yes, thanks, Erel. After EasyOCR installation - it's started OK and started to load some more
Downoaded at 100%, but it needs to add sub "py_disconnected":

And started to work !
But endless work with small-sized picture cannot be interrupted, had to close and restart.

Next try with big picture with non-EN texts (but OCR was inited for "en"):

For each language to recognize - the new OCR reader is again downloaded...
 

Attachments

  • 1738243645095.png
    180.1 KB · Views: 126
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Well done! You can see the downloaded models in the Objects folder under the ~ folder.

Have you installed torch with cuda enabled?

You can verify it with:
B4X:
Wait For (IsCudaAvailable) Complete (Available As Boolean)
Log("cuda: " & Available)

Private Sub IsCudaAvailable As ResumableSub
    Wait For (Py.ImportLib.ImportModule("torch").GetField("cuda").Run("is_available", Null).Fetch) Complete (Res As PyWrapper)
    Return Res.Value
End Sub
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Non-EN pictures are also recognized, even if to twice scale picture down by area (400 x 200 px). But single-letter words are missed.
Small non-readable picture is fastly stopped to process, without error.


Other errors are to be processed somehow.
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Note: OpenCV used cannot read non-en file names:


How to catch these errors ? Or make non-fatal somehow...
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Yes, thanks, Erel. After EasyOCR installation - it's started OK and started to load some more
Downoaded at 100%,

nevers downloading the model...

1) winpython (7z extracted ~2GB)
2) I ve pip(ed) pytorch
3) also jaided pip(ed)

all about ~5GB

...some times copying py_bridge.zip at roaming folder... but nothing more..
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
"Ready" status ?
Many errors crashed running.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Path to python.exe in the code?
"Objects\~" folder with downloaded model (-s) ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…