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

Recognize both digit & alphabet when fine tune digits #11

Open
duonghb53 opened this issue Aug 26, 2019 · 15 comments
Open

Recognize both digit & alphabet when fine tune digits #11

duonghb53 opened this issue Aug 26, 2019 · 15 comments

Comments

@duonghb53
Copy link

Dear Shreeshrii,
I try your guide to fine tune from data_best/eng.datatrained add number font Ocrb but when I get ocrb.datatrained to recognize it still get alphabet & digit.
I don't know how to do same you create digit.datatrained. It only get digit.
Please help me.
Thank you.

@Shreeshrii
Copy link
Owner

Shreeshrii commented Aug 27, 2019

Now you can also use the blacklist config to avoid alphabet.

tesseract input output --oem 1 --psm 6 -l eng-c tessedit_char_blacklist=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

@duonghb53
Copy link
Author

Dear Shreeshrii,
I have any questions:

  1. Difference between when using to recognize only digits:
    tessedit_char_blacklist=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
    &
    tessedit_char_whitelist=1234567890

  2. I use your file digit.datatrained using on Tool VietOCR and it only recognize digit(I haven't to do anything) but when using ocrb.datatrained then it recognize to digit & alphabet.
    I don't understand why.
    Please help.
    Many thank.

@Shreeshrii
Copy link
Owner

tessedit_char_blacklist=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

will ignore a-z and A-Z only. Punctuation, digits and any other characters in unicharset will be recognized.

tessedit_char_whitelist=1234567890

Only the digits 0-9 will be recognized.

digit.traineddata

was only trained on a limited characterset of 0-9

ocrb.traineddata

I will have to check, but it was trained for both Alphabet and digits in OCRB font for recognition of ID.

Please note that all these are proof of concept traineddata files for training. I have not used any of them.

@duonghb53
Copy link
Author

Dear Shreeshrii,
I use file your tessdata for recognize: digit.datatrained
image
I don't understand about Tesseract.
I training with new data ocrb font but result is not exactly.
image
Can you recommend help me?
Many thanks.

@Shreeshrii
Copy link
Owner

You should get perfect results using eng.traineddata from tessdata_best.

Make sure your image is 300 dpi.

3324069222

tesseract 3324069222.png -
3324069222

@duonghb53
Copy link
Author

Dear Shreeshrii,
I tried change image to 300 dpi and test. Result is better.
But have some difference between I only change dpi to 300 and image both change dpi to 300 & white padding. (I use EngineMode = Ltsm, PageSegMode pageSegMode = PageSegMode.SingleBlock)
I try recognize with tessdata_best/eng.traineddata & digits.traineddata (I download in https://github.com/Shreeshrii/tessdata_shreetest/blob/master/digits.traineddata)
This is result.
I see result is same.
What do I need to improve accuracy?
(Improve quality image, fine tune file datatrain or try recognize with other parameter.....)
I don't know how.
It often mistake: 5->6, 7->2, 9->2
Regards,

@duonghb53
Copy link
Author

Dear Shreeshrii,
This is image I use and result:
Test.zip
Please view it.
Regards,

@Shreeshrii
Copy link
Owner

Shreeshrii commented Aug 30, 2019 via email

@duonghb53
Copy link
Author

Dear Shreeshrii,
I'm trying recognize(using databest/eng) digits but it often mistake digit 1 with '|, , /, ]' because my font & image is skew.
My idea is find this font and tune up from databest/eng. Is is good?
Do you suggest me to solve it?
Thanks.
image

@Shreeshrii
Copy link
Owner

@nguyenq Quan Is it possible to use digits config file with VietOCR?

@nguyenq
Copy link

nguyenq commented Sep 19, 2019

According to its readme file:

You can put init-only and non-init control parameters in tessdata/configs/tess_configs and tess_configvars files, respectively, to modify Tesseract's behaviour.

@duonghb53
Copy link
Author

@nguyenq I try config follow your guide but it still recognize to alphabet.
Because I configs wrong?
Please view attached file:
image
image

@Shreeshrii
Copy link
Owner

vietocr

I get the correct answer in Vietocr using a screenshot copy of your image.
I am using the latest version I downloaded just now - vietocr 5.5.1

@duonghb53
Copy link
Author

Dear @Shreeshrii ,
Thank you.
I try fine tune tessdata from your file: digits.traineddata.
I can recognize easier and more accurate.
But seem it regularly recognize mistake number 2 to number 3.
Why is it happen?
image

@Shreeshrii
Copy link
Owner

If your images are skewed, either deskew before feeding to tesseract or train on italic font matching your images.

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

No branches or pull requests

3 participants