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
Comments
Hi @sachinprasadhs ! Could you please look into this issue? |
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… |
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. |
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. |
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. |
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.The text was updated successfully, but these errors were encountered: