Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on iOS 17 for Legacy Model (OEM 0) #867

Closed
rin-st opened this issue Jan 3, 2024 · 4 comments
Closed

Error on iOS 17 for Legacy Model (OEM 0) #867

rin-st opened this issue Jan 3, 2024 · 4 comments

Comments

@rin-st
Copy link

rin-st commented Jan 3, 2024

Issue is mostly copypaste of #804 but with newer versions and slightly different error message

Tesseract.js version (version number for npm/GitHub release, or specific commit for repo)
5.0.4

Describe the bug
On iOS 17's Safari/WebKit, when

const worker = await createWorker('eng', 0);
await worker.recognize(imageData);

is called, the following runtime error will occur:

Error: RuntimeError: call_indirect to a null table entry (evaluating '(Tf=b._emscripten_bind_TessBaseAPI_Recognize_1= b.asm.Dd).apply(null,arguments)')

No errors on MacOS, Android and iOS 16

To Reproduce
Steps to reproduce the behavior:

Set up Tesseract on a Nextjs project
Visit Next website on an iOS device running iOS 17.2.1
Upload image
See error

Input image:
My passport photo (Iphone 14 pro) with Machine readable zone (MRZ). Tried ~10+ different photos. Interested in recognizing MRZ.

Expected behavior
Tesseract will recognize the text in the image and output successfully.

Device Version:

  • Iphone pro 14, iOS 17.2.1,
  • Safari

Other OEM versions doesn't cause an error, but recognizing doesn't work as expected

@Balearica Balearica changed the title IOS 17 recognizing issue. Error on iOS 17 for Legacy Model (OEM 0) Jan 5, 2024
@Balearica
Copy link
Collaborator

It looks like the core issue is essentially where we left off the discussion for #804. The LSTM model (oem value 1), which is the default model, runs on iOS 17 while the Legacy model (oem value 0) does not.

While I sympathize with the fact that this is annoying, unfortunately there is not much I can personally do. There does not appear to be anything objectively wrong with the Tesseract.js code, seeing as it runs on every platform including iOS prior to iOS v17. Apple requires you to own a new(ish) iPhone and Mac to debug iOS browsers, and I own neither, so I cannot investigate iOS 17-specific behaviors. Somebody else would have to investigate this.

@Balearica
Copy link
Collaborator

@rin-st Using various devices from Browserstack, I attempted to replicate this error using the Legacy demo site from #804 (seen here) and while I was able to do so for 17.0 and 17.1, I did not experience this error on 17.2. A list of devices I tested on is below.

Fails:

  • iPhone 12 Pro v17.0
  • iPhone 15 v17.1
  • iPad Pro 12.9 2021 v17.1

Succeeds:

  • iPhone 15 v17.2
  • iPad Pro 12.9 2021 v17.2

This would seem to indicate that Apple fixed the problem, however that conclusion is contradicted by your bug report. Therefore, can you (1) check whether or not you get an error recognizing a simple image using the site linked below and (2) confirm that you are definitely using iOS 17.2?

https://tesseract-js-core-example.pages.dev/legacy

@rin-st
Copy link
Author

rin-st commented Jan 5, 2024

@Balearica Thank you for quick response!

This would seem to indicate that Apple fixed the problem, however that conclusion is contradicted by your bug report. Therefore, can you (1) check whether or not you get an error recognizing a simple image using the site linked below and (2) confirm that you are definitely using iOS 17.2?

Sorry for confusing. I rechecked version of my device and it was 17.1.2 🤦 . I updated it to 17.2 and problem disappeared.

So to sum up. It doesn't work with oem version 0 on 17.0 and 17.1. But works on versions before 17 and 17.2+.

Thank you!

@Balearica
Copy link
Collaborator

Sorry for confusing. I rechecked version of my device and it was 17.1.2 🤦 . I updated it to 17.2 and problem disappeared.

Great, that explains the difference. Thanks for following up.

So to sum up. It doesn't work with oem version 0 on 17.0 and 17.1. But works on versions before 17 and 17.2+.

Yes, it sounds like there was a bug introduced by Apple in iOS 17.0 and fixed in 17.2. This bug impacts all versions of Tesseract.js prior to v5, and Tesseract.js v5 when run with oem values 0 (Legacy only) and 2 (LSTM + Legacy fallback).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants