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

Arabic training data has room for improvement #2047

Open
mustafa0x opened this issue Nov 9, 2018 · 21 comments
Open

Arabic training data has room for improvement #2047

mustafa0x opened this issue Nov 9, 2018 · 21 comments

Comments

@mustafa0x
Copy link

I just installed Tesseteract 4.0.0 (see: Environment), OCR'ed a sample document using ara and arab-script, and found that the ara-amiri-3000 training data (created by @Shreeshrii) continues to be superior, which is consistent to my more rigorous testing in the beta 1 days (see: tesseract-ocr/tessdata_best#11 (comment)).

I also noticed that the Arabic comma is still not recognized (it is by ara-amiri-3000), and nor are the Indic numerals (most of the time). I created an issue to add these to the Arabic langdata, but haven't yet received a response (tesseract-ocr/langdata#131).

Related: It's possible that using the Scheherazade font for training will give better results, as it's very similar to Lotus Light — the font used by most printed Arabic books.

Thanks!


Environment

~# lsb_release -a
Description: Ubuntu 18.04.1 LTS
~# add-apt-repository ppa:alex-p/tesseract-ocr
~# apt update
~# apt install tesseract-ocr tesseract-ocr-ara tesseract-ocr-script-arab
~# tesseract --version
tesseract 4.0.0
 leptonica-1.76.0
  libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.2) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.3.0
@AndreAhmed
Copy link

@mustafa0x Can you upload the amiri dataset ?

@amitdo
Copy link
Collaborator

amitdo commented Nov 22, 2018

@Shreeshrii
Copy link
Collaborator

Shreeshrii commented Nov 22, 2018 via email

@mustafa0x
Copy link
Author

@Shreeshrii: @amitdo was able to very-impressively pull it up.

@Shreeshrii
Copy link
Collaborator

Shreeshrii commented Nov 23, 2018 via email

@AndreAhmed
Copy link

Your dataset doesn't work with number and arabic text combined together

@Shreeshrii
Copy link
Collaborator

Shreeshrii commented Nov 23, 2018 via email

@AndreAhmed
Copy link

@amitdo do you have a dataset with arabic numbers and arabic text that @Shreeshrii can use ?
I need that urgently.

@mustafa0x
Copy link
Author

@Shreeshrii This is nearly 8k characters, 100 of which are Arabic numerals.

sample-arabic.txt

@amitdo
Copy link
Collaborator

amitdo commented Nov 23, 2018

No, I don't have such a dataset.

@AndreAhmed
Copy link

@Shreeshrii do you have any success ? I think it's very complicated, arabic text with numbers doesn't work in that engine

@AndreAhmed
Copy link

@Shreeshrii any progress?

@mustafa0x
Copy link
Author

@AndreAhmed It's the weekend, it's the holidays, and this is open source work. Please wait until Shreeshrii has some free time to spend on this.

@jaddoughman
Copy link

@AndreAhmed @Shreeshrii I happen to have a large dataset of Arabic text, with Arabic numbers and text. I'm having issues fine tuning the original _best model. I will attach the dataset below (composed of ~4000 lines). If you can attempt to fine tune using them, that would be great.
train.zip

The generated .box files might be an issue.

@AndreAhmed
Copy link

@Shreeshrii @jaddoughman I think there is a major problem with arabic text with numbers including, I'm not sure it's a fine tuning issue, or recognize problem from the OCR itself.

@Shreeshrii
Copy link
Collaborator

That is my suspicion also. However we can not know for sure until @theraysmith responds.

From what I understand, while Arabic is written as RTL, Arabic numbers are written as LTR.

The training works by treating all text regard less of language direction as LTR. There is supposed to be a higher level function which changes the language direction.
It is possible that there is some problem with that, specially when a number is written with punctuation.

The above is pure speculation on my part.

It is also possible that the problem exists only in github tesseract and not in Google's version.

It will help if someone can create a 2-3 lines minimal test case and test with all varieties of traineddata, with --oem 1 and --oem 0, and also with 3.05 version with cube to see whether problem exists in all cases.

Then it will be easier for @jbredien to check whether same test case works in Google's tesseract.

@AndreAhmed
Copy link

I did test with a lot of trained data for simple 3 lines text, it never work at all, there is no recognition of the numbers at all @Shreeshrii

@AndreAhmed
Copy link

I debugged it, it can detect numbers at all, that's one problem. Another problem is the combination of arabic letters with numbers, the engine ignores the numbers and it doesn't detect it. Because at first it doesn't recognize the numbers. @Shreeshrii @theraysmith

@MariamHijazi
Copy link

MariamHijazi commented Dec 2, 2018

I'm trying to generate dataset for Arabic text with Arabic-Indian Numbers with JessEditor, but I guess jTessBoxEditor does not support Arabic-Indian Numbers which is (۰ - ۱ - ۲ - ۳ - ٤ - ٥ - ٦ - ٧ - ۸ - ۹) with Unicode (U+0660 -> U+0669) is there any dataset support Arabic text with Arabic- Indian numbers ? can you add Arabic Indian numbers to JessEditor?
Any suggestion for this issue?
@Shreeshrii
Kind Regards.

@jagdishgg
Copy link

I have tried ara.traineddata, ara-amiri-3000.traineddata and Arabic.traineddata on tesseract v4.0.0.20181030 Windows platform. My data has Arabic plus English and English Numericals. All the traineddata giving incorrect results and if I OCred 5 images ( ID cards )of same format, I am getting the results in different formats, Example 4 images giving Name of person on line 9 but 5th one giving on line 10, how do we control that
Commands used
tesseract "F:\Temp\3\1.jpeg" "F:\Temp\3\out1.txt" -l eng -c tessedit_char_whitelist=01234ABCDE --oem 1 --psm 11
tesseract "F:\Temp\3\1.jpeg" "F:\Temp\3\out1.txt" -l script/arabic --psm 6
tesseract "F:\Temp\3\2.jpeg" "F:\Temp\3\out2.txt" -l script/arabic --psm 11

@Shreeshrii
Copy link
Collaborator

Please see tesseract-ocr/tesseract#2263 (comment)
and test if the traineddata files linked there add all the required characters.

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