TESSERACT-OCR Training method of---Identification code base for improving the recognition rate of verification code

Source: Internet
Author: User
Tags character set
about the Orc verification code recognition can read another article of this blog two common types of Orc verification code recognition method and Practice Testimonials

This article is a further technical upgrade note for TESSERACT-OCR, and what to do if the default recognition rate is relatively low.

don't worry, TESSERACT-OCR's own tools provide a way to use the footage you provide to make manual corrections to improve recognition rates. Let's take a look here.

Reference:

http://my.oschina.net/lixinspace/blog/60124

1 Download and install version 3.02 of Tesseract

2 If your training material is a lot of pictures in non-TIFF format, the first thing to do is to merge such pictures (the more people think the more material, the basic each letter and number covering the training out of the recognition rate is better)

Http://sourceforge.net/projects/vietocr/files/latest/download?source=files

Download this tool:vietocr.net-3.3.zip

First, the jpg,gif,bmp to TIFF conversion, this with the use of self-drawing can be. Then use vietocr.net-3.3 to make multiple TIFF merges.

3 Make Box Files. Open a command line in the directory where the Orderno.tif is located, enter

C:\Program files\tesseract-ocr>tesseract.exe Lang.jhy.exp8.TIF lang.jhy.exp8 batch.nochop Makebox

4 using Jtessboxeditor to open the Orderno.tif file, it is necessary to remember that the 2nd step generates the Orderno.box to be in the same directory as the Orderno.tif file. Correct the text one after the other and save it.

http://sourceforge.net/projects/vietocr/files/

Download the Jtessboxeditor tool for each self-correcting (note that there are nextpage to correct each page)

5 Run tesseract for Training. Enter the command:

C:\Program Files\tesseract-ocr>tesseract.exe Lang.jhy.exp8.TIF LANG.JHY.EXP8 nob

Atch Box.train

Supplement about naming format interpretation: Lang.jhy.exp8.TIF

Make Box Files

For the next step below, Tesseract needs a ' box ' file-to-go with each training image. The box file is a text file that lists the characters in the training image, in order, one per line, with the coordinates Of the bounding box around the image. Tesseract 3.0 have a mode in which it would output a text file of the required format, but if the character set is different To their current training, it'll naturally has the text incorrect. So, the key process here's to manually edit the file to put the correct characters in it.

Run tesseract on each of the your training images using this command line:

tesseract [Lang]. [Fontname].exp[num].tif [Lang]. [Fontname].exp[num] Batch.nochop Makebox

6 Compute the Character Set. Enter the command:

C:\Program Files\tesseract-ocr>unicharset_extractor.exe Lang.jhy.exp8.box

Extracting Unicharset from Lang.jhy.exp8.box

Wrote Unicharset file./unicharset.

7 new file "Font_properties". In the case of version 3.01, you will need to create a new file with the name "Font_properties" in the directory and enter the text: (Here jhy is the middle field of LANG.JHY.EXP8)

Jhy 1 0 0 1 0

C:\Program files\tesseract-ocr>mftraining.exe-f font_properties-u Unicharset

ang.jhy.exp8.tr

Warning:no Shape Table File present:shapetable

Reading lang.jhy.exp8.tr ...

Flat shape table Summary:number of shapes = max Unichars = 1 number with MU

Tiple unichars = 0

done!

8 Clustering. Enter the command:

C:\Program Files\tesseract-ocr>cntraining.exe lang.jhy.exp8.tr

Reading lang.jhy.exp8.tr ...

Clustering ...

Writing Normproto ...

9 at this time, in the directory should generate a number of files, the Unicharset, inttemp, Normproto, pfftable These files prefixed with "selfverify." Then enter the command:

It must be determined that 1, 3, 4, 5, 13 rows of data is not-1, then a new dictionary is generated.

The "Selfverify.traineddata" file under this directory is copied to the "Tessdata" directory under the Tesseract program directory.

This dictionary can then be used to identify, for example:

Tesseract.exe test.jpg out–l selfverify

By training the new language, the recognition rate has improved a lot.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.