Search code examples
androidocrscalabilityimage-recognitiongoogle-vision

Android OCR result matching with database


So I am trying to use a OCR to translate text that I record with my phone's camera to a string, I am currently using Google vision OCR for android and have implemented the OCR correctly, the problem is that sometimes the result is not as good as expected thats why a solution I think might work is matching the result given by the OCR with my database. For example if my camera reads "How you?" then I would find in my database a entry that is similar "How are you?" and would display this instead. So the real problem is that the OCR is constantly reading from the camera, so that means that I would need to make an HTTP request to a server and query the database for a similar match every second or two and wait for the response, that could be very bad execution if there are many users overloading the server. One solution that I thought was downloading the list of all strings in the database and make the matching locally, but what if the data changes after that in the database? What would be a good approach to this?

I'm using this to read text from supermarket products such as name and description, so what I thought was match the products name and then query my database for all complementary information. Its important to note that this is going to be used by visually impaired people so reading bar codes is not a good choice right now.


Solution

  • Here is my 2 cents.

    One solution that I thought was downloading the list of all strings in the database and make the matching locally, but what if the data changes after that in the database? What would be a good approach to this?

    It depends how big is your database. If it is not too big then you can download it on user's device. If there is an update to the database, then you can implement a push mechanism using FCM, letting the app know that there is a new version of database to fetch. Then you can fetch it in the background and update your local database. Also I understand that since you are creating the app for visually impaired people, it might not work if you just ask your users to take a picture and perform OCR on it. This way it would have prevented the calls every second.