{"id":1757,"date":"2017-02-08T15:01:12","date_gmt":"2017-02-08T15:01:12","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=1757"},"modified":"2017-02-08T15:43:32","modified_gmt":"2017-02-08T15:43:32","slug":"tesseract-training","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2017\/02\/08\/tesseract-training\/","title":{"rendered":"Tesseract Training"},"content":{"rendered":"<p>OK. This is really hard and also I dont have enough knowledge to do the training process. I have to learn much and comprehend all the process. I need to spend more time to do this. I have spent two days for this.<\/p>\n<p>The testing files in \/Documents\/cpp\/tesseract\/testing\/ directory. First I need to convert the pdf file (export1.pdf) to tiff image with density 500dpi and keep the quality 100%<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~\/Documents\/cpp\/tesseract\/testing$ convert -density 500 export1.pdf -quality 100 export1.tif<\/pre>\n<p>I got the tif image export1.tif with more than 190MB size!!! I dont know if this is correct or not. I sliced the export1.tif image and I created 14 tif images as samples from the tif image to train tesseract to recognize the text on the images. Then I use LIOS (Application -&gt; Graphics -&gt; Tesseract-Trainer) to train the 14 images and make the boxes for them. I read another article that to get the good result, I need to have more than 10 samples. I got 14 so I think it&#8217;d be better. This training process is really tedious. I have to check each character and make sure they all correct. Sometimes (many times) it showed the wrong characters and wrong box selection. I NEED TO CREATE A TUTORIAL HOW TO TRAIN THE IMAGE WITH LIOS!!! <iframe loading=\"lazy\" width=\"560\" height=\"314\" src=\"\/\/www.youtube.com\/embed\/qLpCld4cdtk\" allowfullscreen=\"allowfullscreen\"><\/iframe>AT the end it&#8217;s failed miserably when I tested with the train data. The train data is in \/usr\/local\/share\/tessdata\/ directory. The last train data is &#8216;train4&#8217;. I create two test with the training data. First, I use the train4 data<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~\/Documents\/cpp\/tesseract\/testing$ tesseract export1.tif export1_tif_out -l train4\r\nInfo in bmfCreate: Generating pixa of bitmap fonts from string\r\nTesseract Open Source OCR Engine vbd45b3a with Leptonica\r\nWarning in pixReadFromTiffStream: bpp = 64; stripping 16 bit rgb samples down to 8\r\nPage 1\r\nDetected 731 diacritics<\/pre>\n<p>The result is SHAME! then I want to use the default &#8216;eng&#8217; train data to see the comparison<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~\/Documents\/cpp\/tesseract\/testing$ tesseract export1.tif export1_tif_eng_out -l eng\r\nInfo in bmfCreate: Generating pixa of bitmap fonts from string\r\nTesseract Open Source OCR Engine vbd45b3a with Leptonica\r\nWarning in pixReadFromTiffStream: bpp = 64; stripping 16 bit rgb samples down to 8\r\nPage 1\r\nDetected 731 diacritics<\/pre>\n<p>The result is better BUT STILL A CRAP!<br \/>\nI see in \/usr\/local\/share\/tessdata\/ directory there are many files related to the &#8216;eng&#8217;:<\/p>\n<pre class=\"lang:default decode:true \">\/usr\/local\/share\/tessdata\/eng.cube.bigrams\r\n\/usr\/local\/share\/tessdata\/eng.cube.fold\r\n\/usr\/local\/share\/tessdata\/eng.cube.lm\r\n\/usr\/local\/share\/tessdata\/eng.cube.nn\r\n\/usr\/local\/share\/tessdata\/eng.cube.params\r\n\/usr\/local\/share\/tessdata\/eng.cube.size\r\n\/usr\/local\/share\/tessdata\/eng.cube.word-freq\r\n\/usr\/local\/share\/tessdata\/eng.tesseract_cube.nn\r\n\/usr\/local\/share\/tessdata\/eng.traineddata\r\n\/usr\/local\/share\/tessdata\/eng.user-patterns\r\n\/usr\/local\/share\/tessdata\/eng.user-words<\/pre>\n<p>BUT I ONLY HAVE ONE FILE<\/p>\n<pre class=\"lang:default decode:true \">\/usr\/local\/share\/tessdata\/train4.traineddata<\/pre>\n<p>I THINK I DIDN&#8217;T PREPARE THE TRAINING CORRECTLY OR MAY BE I MISS SOMETHING????<br \/>\nREAD SOME TUTORIAL:<br \/>\n<a href=\"https:\/\/github.com\/tesseract-ocr\/tesseract\/wiki\/TrainingTesseract-4.00\">https:\/\/github.com\/tesseract-ocr\/tesseract\/wiki\/TrainingTesseract-4.00<\/a><br \/>\n<a href=\"https:\/\/github.com\/tesseract-ocr\/tesseract\/wiki\/ImproveQuality\">https:\/\/github.com\/tesseract-ocr\/tesseract\/wiki\/ImproveQuality<\/a><br \/>\n<a href=\"https:\/\/github.com\/tesseract-ocr\/tesseract\/wiki\/NeuralNetsInTesseract4.00\">https:\/\/github.com\/tesseract-ocr\/tesseract\/wiki\/NeuralNetsInTesseract4.00<\/a><br \/>\nhttp:\/\/pretius.com\/how-to-prepare-training-files-for-tesseract-ocr-and-improve-characters-recognition\/<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OK. This is really hard and also I dont have enough knowledge to do the training process. I have to learn much and comprehend all the process. I need to spend more time to do this. I have spent two days for this. The testing files in \/Documents\/cpp\/tesseract\/testing\/ directory. First I need to convert the &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2017\/02\/08\/tesseract-training\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Tesseract Training&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[],"class_list":["post-1757","post","type-post","status-publish","format-standard","hentry","category-tesseract"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=1757"}],"version-history":[{"count":6,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1757\/revisions"}],"predecessor-version":[{"id":1763,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1757\/revisions\/1763"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=1757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=1757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=1757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}