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

Cube and combined modes doesn't work in 3.03 #40

Closed
ws233 opened this issue Jun 29, 2015 · 33 comments
Closed

Cube and combined modes doesn't work in 3.03 #40

ws233 opened this issue Jun 29, 2015 · 33 comments

Comments

@ws233
Copy link
Contributor

ws233 commented Jun 29, 2015

What steps will reproduce the problem?

  1. Try to recognize the attached image with Cube mode. Whitelist is '0123456789'. The result is wrong. It's 1234669890 (6 instead of 5, 9 instead of 7).
  2. Try to recognize the same image with Combined mode. There is a crach with the following error:
    init_cube_objects(true, &tessdata_manager):Error:Assert failed:in file tessedit.cpp, line 203
    [1] 5562 abort tesseract image_sample.jpg stdout -l rus rus-test
    It seems that it happens with eng locale as well as with the rus loc.

What is the expected output? What do you see instead?
In both cases the output should be 1234567890.

What version of the product are you using? On what operating system?
I've tried tesseract 3.03 both on mac and iOS.

Please provide any additional information below.
There is a related thread in the Tesseract-OCR-iOS wrapper, where the issue was originally found: gali8/Tesseract-OCR-iOS#140. You may ask for any additional info there.

image_sample

@zdenop
Copy link
Contributor

zdenop commented Jun 29, 2015

According Ray cube is a dead-end and it can be removed soon from the code(see e.g. [1]), so you can not expect any progress...

[1] https://groups.google.com/d/msg/tesseract-dev/mtIJXoUpfJc/6f0EwVNXOM8J

@tfmorris
Copy link
Contributor

@zdenop Since Cube is going away, perhaps this can be closed?

@zdenop
Copy link
Contributor

zdenop commented Feb 17, 2016

lets wait for Ray...

@amitdo
Copy link
Collaborator

amitdo commented May 28, 2016

It's 'going away' for several years now... :-)

@amitdo amitdo added the bug label Jun 5, 2016
@ghost
Copy link

ghost commented Jul 2, 2016

How Cube is being discontinued, it's training procedure has not been published to the public.
Somehow I got the feeling that Cube was purposely sabotaged and hindered from the public.

@zdenop zdenop added the wontfix label Sep 1, 2016
@amitdo
Copy link
Collaborator

amitdo commented Nov 23, 2016

The new LSTM based engine is here.

@theraysmith, I see that the Cube engine is still present in the code. Are you going to drop it in the final 4.0 release?

@zdenop zdenop closed this as completed Nov 24, 2016
@theraysmith
Copy link
Contributor

Actually I have a comment for this.
There is one reason why cube has survived this long: For Hindi cube+tesseract has half the error rate of either on their own. I haven't actually tested that against the new LSTM engine yet, but I will on Monday, and if the new LSTM engine is better, then yes, cube is likely to get the chop for 4.00, and the ifdefs will be very useful.

@Shreeshrii
Copy link
Collaborator

@theraysmith

Since the hardware requirements for 4.0 are going to be higher than for 3.xx versions, it will be good to keep Hindi cube+tesseract version also available.

The accuracy results that you are mentioning for Hindi are for which version - 3.02, 3.03, 3.04 ?

@theraysmith
Copy link
Contributor

Tests complete. Decision made. Cube is going away in 4.00.
Results:

Engine Total char errors Word Recall Errors Word Precision Errors Walltime CPUtime*
Tess 3.04 13.9 30 31.2 3.0 2.8
Cube 15.1 29.5 30.7 3.4 3.1
Tess+Cube 11.0 24.2 25.4 5.7 5.3
LSTM 7.6 20.9 20.8 1.5 2.5

Note in the above table that LSTM is faster than Tess 3.04 (without adding cube) in both wall time and CPU time! For wall time by a factor of 2.

@zdenop
Copy link
Contributor

zdenop commented Nov 28, 2016

Can you provide some details about used hardware for test?
Did you made test also on single core CPU to see difference?

@stweil
Copy link
Contributor

stweil commented Nov 28, 2016

And what about the language model used for the test? Is it already available so I can use it for my own tests?

@theraysmith
Copy link
Contributor

theraysmith commented Nov 28, 2016 via email

@stweil
Copy link
Contributor

stweil commented Nov 28, 2016

I'm going to push the data files now.

Got the first ones. My first test with a simple screenshot gave significant better results with LSTM, but needed 16 minutes CPU time (instead of 9 seconds) with a debug build of Tesseract (-O0). A release build (-O2) needs 17 seconds with LSTM, 4 seconds without for the same image.

Are there also new data files planned for old German (deu_frak)? I was surprised that the default English model with LSTM could recognize some words.

@theraysmith
Copy link
Contributor

theraysmith commented Nov 28, 2016 via email

@Shreeshrii
Copy link
Collaborator

Shreeshrii commented Nov 29, 2016 via email

@stweil
Copy link
Contributor

stweil commented Nov 29, 2016

I know German continued to be written in Fraktur until the 1940s, so that might be easier. Or is there an old German that is analogous to Ye Old Shoppe for English?

Fraktur was used for an important German newspaper (Reichsanzeiger) until 1945. I'd like to try some pages from that newspaper with Tesseract LSTM. Surprisingly even with the English data Tesseract was able to recognize at least some words written in Fraktur. Could you give me some hints how to create the data for deu_frak?

There is an Old High German (similar to Old English), but the German translation of the New Testament by Martin Luther (1521) was one of the first major printed books in German, and basically it started the modern German language (High German) which is used until today.

@zdenop
Copy link
Contributor

zdenop commented Nov 29, 2016

I think it would be great to move this discussion to (developers) forum. we are already out scope of original issue post and much more people should be interested in "Faktur topic"...

@stweil
Copy link
Contributor

stweil commented Nov 29, 2016

Stefan, please share the binaries for 4.0 alpha for Windows.

@Shreeshrii, they are online now at the usual location. See also the related pull request #511. Please report results either in the developer forum as suggested by @zdenop or by personal mail to me.

@amitdo
Copy link
Collaborator

amitdo commented Nov 29, 2016

Is there a 3.04 vs 4.0 branch in tessdata for the traineddata files?

https://github.com/tesseract-ocr/tessdata/tree/3.04.00

@Shreeshrii
Copy link
Collaborator

Shreeshrii commented Nov 29, 2016 via email

@Shreeshrii
Copy link
Collaborator

Shreeshrii commented Nov 29, 2016 via email

@amitdo
Copy link
Collaborator

amitdo commented Nov 29, 2016

Amit. Please add the info to the wiki also, if you have not already done so.

You can do it yourself... :)

@Shreeshrii
Copy link
Collaborator

@theraysmith @stweil

Thank you! I tested a few devanagari pages with the 4.0 alpha windows binaries and traineddata for Hindi, Sanskrit, Marathi and Nepali. This was on a Windows 10 netbook, intel atom 1.33 ghz cpu, x64 based processor, 32 bit os, 2 GB RAM. I tested only with single page images and there was no performance problem on this basic netbook. The accuracy is much improved in the LSTM version. This is by just eyeballing the output (not using any software for comparison).

From a user point of view, better accuracy maybe preferred to speed. So LSTM based engine seems the way to go, at least for devanagari scripts. I will test some of the other Indian languages later.

I have noticed some differences in processing between Hindi and the other Devanagari based languages and will add issues to the tessdata repository.

Thanks to the developers at Google and the tesseract community!

@jbaiter
Copy link

jbaiter commented Nov 29, 2016

@theraysmith

I don't think I generated the original deu_frak. I have the fonts to do so with LSTM, but I don't know if I have a decent amount of corpus data to hand.

I have a decent amount of corpus data for Fraktur from scanned books at hand, about 500k lines in hOCR files (~50GB with TIF images). I've yet to publish it, but if you have somewhere where I could send/upload it, I'd be glad to.

Or is there a way to create the neccessary training files myself? I've had a cursory look through the OCR code and it looked like it needed lstmf files, but I haven't yet found what these are supposed to look like.

@theraysmith
Copy link
Contributor

theraysmith commented Nov 29, 2016 via email

@jbaiter
Copy link

jbaiter commented Nov 29, 2016

500k lines should make it work really well. I would be happy to take it and help you, but we would have to get into licenses, copyright and all that first.

The text is CC0 and the images are CC-BY-NC, so that shouldn't be an issue :-) They're going to be public anyway once I've prepped the dataset for publication.
But even better if there are instructions, looking forward to playing around with training!

@Shreeshrii
Copy link
Collaborator

Shreeshrii commented Nov 30, 2016 via email

@theraysmith
Copy link
Contributor

Cube is gone! Removal completed as of 9d6e4f6

@amitdo
Copy link
Collaborator

amitdo commented Dec 14, 2016

Sad news: Cube is no longer with us.

Cube, you will be missed...

This was referenced Dec 31, 2016
@Shreeshrii
Copy link
Collaborator

@jbaiter have you tried 4.0 training for Fraktur?

@theraysmith Is there a way to use the old box-tiff pairs at https://github.com/paalberti/tesseract-dan-fraktur for LSTM training?

Also see tesseract related issue at paalberti/tesseract-dan-fraktur#3

@amitdo
Copy link
Collaborator

amitdo commented Jan 19, 2017

Is there a way to use the old box-tiff pairs at https://github.com/paalberti/tesseract-dan-fraktur for LSTM training?

There will be a way to generate a box file from a tiff image. The box file will be written in the textline format
#659 (comment)
I started working on this today. I wrote the needed code and It seems to output the desired format, but I need to do some tests before publishing it.

@Shreeshrii
Copy link
Collaborator

@amitdo Not sure if that will work for Devanagari, because of the length of unicode string.

Is it possible to just add a box with the tab character at end of each line for existing box files?

@amitdo
Copy link
Collaborator

amitdo commented Jan 19, 2017

Not sure if that will work for Devanagari, because of the length of unicode string.

We will wait and see...

Is it possible to just add a box with the tab character at end of each line for existing box files?

You mean manually?
You should add box coordinates, not just tab.

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

No branches or pull requests

8 participants