简体   繁体   English

最佳的Tess-Two配置以获得最佳识别结果?

[英]Best Tess-two configuration to get optimal recognition results?

I'm currently working on an android app utilizing the open source OCR library "Tesseract" to make an app for receipt recognition. 我目前正在使用开放源代码OCR库“ Tesseract”制作一个用于收据识别的Android应用程序。 I've gotten the library working with the "Tess-two" fork of Tesseract. 我已经在图书馆使用Tesseract的“ Tess-two”叉。 The problem I'm having is that the recognition is very inconsistent. 我遇到的问题是识别非常不一致。 Even when provided with a good image that is cropped properly, the recognition isn't great. 即使提供了正确裁剪的良好图像,识别度也不是很好。 I'd say that when given what I would consider ideal situations, the recognition is about 90% accurate. 我要说的是,考虑到我认为理想的情况,识别率大约为90%。 When provided with any number sub-optimal conditions (dim lighting, blurry image, uncropped, etc...) I find that I'll often get virtually 0% accuracy. 当提供任何数量的次优条件时(昏暗的灯光,模糊的图像,未裁剪等),我发现我通常会获得几乎0%的精度。

For the purpose of my app, even 90% accuracy pretty much unacceptable, as I need to be able to get the exact information and numbers from the receipt "perfectly" without needing to worry about improperly read information. 就我的应用而言,即使90%的准确性也几乎是不可接受的,因为我需要能够“完美地”从收据中获取确切的信息和编号,而不必担心信息读取不正确。

So my question: what is the best way to configure Tess-two to get the highest accuracy possible? 所以我的问题是:配置Tess-2以获得最高精度的最佳方法是什么?

In a nutshell, this is what I have done to set up the library: 简而言之,这就是我设置库的工作:

//prior to running this code, I create the directory for /tessdata and copy my eng.traineddata file in there from the app's assets folder.
baseApi.setVariable("save_best_choices", "T");
baseApi = new TessBaseAPI();
baseApi.init(DATA_PATH, "eng");
baseApi.setVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$.!?/,+=-*\"'<:&"); //I was experimenting with this to try and improve accuracy, it didn't seem to help tremendously.


baseApi.setImage(photo);//photo is a bitmap that is selected from the phone's gallery.
String tmp = baseApi.getUTF8Text();

Is there something here that I'm doing wrong, or that I could be doing better? 这里是否有我做错的事情,或者我可以做得更好? Are there any files other than eng.traineddata that I should be including? 我应该包括eng.traineddata之外的其他文件吗? I know there are multiple files for each language, but honestly I couldn't figure what was what, and what actually needed to be included. 我知道每种语言都有多个文件,但老实说,我无法弄清楚什么是什么,以及实际需要包含什么。 From what I could gather, I got the only file that was needed. 据我所知,我得到了唯一需要的文件。 Are there any other settings that I could/should be modifying with the "setVariable" function? 是否可以/应该使用“ setVariable”功能修改其他设置?

Additionally, does Tess-two have any built in support for "deskewing" images, or adjusting contrast of provided images? 另外,Tess-2是否对“偏移校正”图像或调整提供的图像对比度有任何内置支持? I have not messed with either of these techniques much yet, but this would probably help out, right? 我还没有把这两种技术弄得一团糟,但这可能会有所帮助,对吧?

Any help is appreciated! 任何帮助表示赞赏!

如果您的android应用程序应该期望词典单词,那么请查看最小编辑距离算法,并将其应用于tesseract给出的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM