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

OCR example app crashes with new image #52977

Open
JaydenKing32 opened this issue Nov 7, 2021 · 5 comments
Open

OCR example app crashes with new image #52977

JaydenKing32 opened this issue Nov 7, 2021 · 5 comments
Assignees
Labels
comp:lite-examples TensorFlow Lite Examples stat:awaiting tensorflower Status - Awaiting response from tensorflower type:bug Bug

Comments

@JaydenKing32
Copy link

I'm not certain if this is the correct issue type, I'm using the documentation type since the examples repo instructed me to do so (specifically the "To file an issue" link in the README).

URL(s) with the issue:

https://github.com/tensorflow/examples/blob/03f796596c9ca9d3d42e5cb43a726b8e220c73b2/lite/examples/optical_character_recognition/android/app/src/main/java/org/tensorflow/lite/examples/ocr/OCRModelExecutor.kt#L200

Description of issue (what needs changing):

I tried modifying the OCR example app by using a different image and it resulted in a crash with an odd error message stating E/cv::error(): OpenCV(4.5.3) Error: Assertion failed (m.dims >= 2) in Mat, file /home/quickbirdstudios/opencv/releases/opencv-4.5.3/modules/core/src/matrix.cpp, line 751.
After some debugging I found the error was caused by line 200 of OCRModelExecutor.kt when detectedConfidences is empty. I believe there should be some check here to prevent passing an empty list and instead taking some other action. Alternatively, the error should be caught and a useful message should be providing explaining the error instead of printing the confusing message from OpenCV.

I also tried lowering the threshold on line 164 to 0.1. This resulted in a different error message about Native Mat has unexpected type or size, but at least the app didn't crash.

@mohantym mohantym added comp:lite-examples TensorFlow Lite Examples type:bug Bug labels Nov 8, 2021
@mohantym
Copy link
Contributor

mohantym commented Nov 8, 2021

Hi @sachinprasadhs ! Could you please look into this issue?

@mohantym mohantym assigned sachinprasadhs and unassigned mohantym Nov 8, 2021
@sachinprasadhs sachinprasadhs added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Nov 8, 2021
@gregory2w
Copy link

ADB is a command-line utility that that can be used to control your device over USB from a computer. It will allow you to install / uninstall and or view logs on your device. This could be very handy when there are issues with a specific app and you like to view the logs for information that may lead to identify the cause of error. In this post, we’ll discuss how to install and use ADB. Installation: ADB comes with Android SDK. However, you can download ONLY the ADB files from here. Download…

@cybergeekgyan
Copy link

I would like to work on this issue and fix this issue if there are any, I am trying to run the app in Mac M1.
Can you assign this issue to me @Xhark

@pjpratik pjpratik self-assigned this Mar 1, 2023
@pjpratik
Copy link
Contributor

pjpratik commented Mar 1, 2023

Hi @JaydenKing32

The OCR example in tensorflow lite has some known limitations and are not general enough for OCR in the wild.

For using a ready-to-use production-grade OCR product, consider using Google ML Kit which uses TFLIte underneath, should be sufficient for most OCR use cases.

Thanks.

@pjpratik pjpratik added stat:awaiting response Status - Awaiting response from author and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Mar 1, 2023
@JaydenKing32
Copy link
Author

I understand that the OCR results may not work that well, but it really shouldn't crash on me. Also I've tried out Google ML Kit, but it wasn't suitable for my use case.

I should clarify that I'm not worried about this issue right now, since I'm currently not working on the project that required the use of OCR.

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Mar 3, 2023
@sachinprasadhs sachinprasadhs added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:lite-examples TensorFlow Lite Examples stat:awaiting tensorflower Status - Awaiting response from tensorflower type:bug Bug
Projects
None yet
Development

No branches or pull requests

7 participants