tesseract4.0訓練腳本(三)

combine_tessdata

這裏包含了很多重要的信息
其中介紹tesserac4.0和3.0中的traineddata的構成組件

NAME
       combine_tessdata - combine/extract/overwrite/list/compact Tesseract data
        # 用於合併/提取/覆蓋/list(-d)/壓縮 tesseract data
SYNOPSIS
       combine_tessdata [OPTION] FILE...

DESCRIPTION
       combine_tessdata(1) is the main program to
       combine/extract/overwrite/list/compact tessdata components in
       [lang].traineddata files.
       # combine_tessdata 是主要的程序,用來合併/提取/覆蓋/list/壓縮 [lang].traineddata files 中的tessdata組件。

       To combine all the individual tessdata components (unicharset, DAWGs,
       classifier templates, ambiguities, language configs) located at, say,
       /home/$USER/temp/eng.* run:

           combine_tessdata /home/$USER/temp/eng.

       The result will be a combined tessdata file
       /home/$USER/temp/eng.traineddata
       # 將所有獨立的tessdat組件合併在一起

       Specify option -e if you would like to extract individual components
       from a combined traineddata file. For example, to extract language
       config file and the unicharset from tessdata/eng.traineddata run:

           combine_tessdata -e tessdata/eng.traineddata \
             /home/$USER/temp/eng.config /home/$USER/temp/eng.unicharset

       The desired config file and unicharset will be written to
       /home/$USER/temp/eng.config /home/$USER/temp/eng.unicharset
       # 通過-e 指令,可以從一個已經合併了的traineddata文件中提取獨立的組件。

       Specify option -o to overwrite individual components of the given
       [lang].traineddata file. For example, to overwrite language config and
       unichar ambiguities files in tessdata/eng.traineddata use:

           combine_tessdata -o tessdata/eng.traineddata \
             /home/$USER/temp/eng.config /home/$USER/temp/eng.unicharambigs

       As a result, tessdata/eng.traineddata will contain the new language
       config and unichar ambigs, plus all the original DAWGs, classifier
       templates, etc.
       # 通過 -o 指令,可以覆蓋一個給定的traineddata文件中的對應組件。
       # 

       Note: the file names of the files to extract to and to overwrite from
       should have the appropriate file suffixes (extensions) indicating their
       tessdata component type (.unicharset for the unicharset, .unicharambigs
       for unichar ambigs, etc). See k*FileSuffix variable in
       ccutil/tessdatamanager.h.
       # 要提取和覆蓋的文件的文件名應具有對應文件相同的後綴名,以表明其tessdata組件的類型。

       Specify option -u to unpack all the components to the specified path:
           combine_tessdata -u tessdata/eng.traineddata /home/$USER/temp/eng.

       This will create /home/$USER/temp/eng.* files with individual tessdata
       components from tessdata/eng.traineddata.
       # 通過 -u 指令,可以將所有組件解壓到指定路徑


OPTIONS
       -c .traineddata FILE...: Compacts the LSTM component in the
       .traineddata file to int.

       -d .traineddata FILE...: Lists directory of components from the
       .traineddata file.

       -e .traineddata FILE...: Extracts the specified components from the
       .traineddata file

       -o .traineddata FILE...: Overwrites the specified components of the
       .traineddata file with those provided on the command line.

       -u .traineddata PATHPREFIX Unpacks the .traineddata using the provided
       prefix.

CAVEATS
       Prefix refers to the full file prefix, including period (.)
       # 注意點 指令中的前綴要包含‘.’
COMPONENTS
#組件
       The components in a Tesseract lang.traineddata file as of Tesseract 4.0
       are briefly described below; For more information on many of these
       files, see
       https://github.com/tesseract-ocr/tesseract/wiki/TrainingTesseract and
       https://github.com/tesseract-ocr/tesseract/wiki/TrainingTesseract-4.00

       lang.config
           (Optional) Language-specific overrides to default config variables.
           For 4.0 traineddata files, lang.config provides control parameters
           which can affect layout analysis, and sub-languages.
           # 根據語言特定,用來覆蓋默認的配置變量。
           # 對於4.0的traineddata文件來說,config文件提供影響佈局分析(不知道跟文字分割算法有關)和子語言的控制參數

       lang.unicharset
           (Required - 3.0x legacy tesseract) The list of symbols that
           Tesseract recognizes, with properties. See unicharset(5).
           # 3.0 必需的
           # tesseract識別的符號列表,包含屬性.

       lang.unicharambigs
           (Optional - 3.0x legacy tesseract) This file contains information
           on pairs of recognized symbols which are often confused. For
           example, rn and m.
           # 3.0 可選的
           # 這個文件包含經常容易混淆的符號對的信息,例如‘rn和m’
           # (如果識別中文的話,應該可以用來處理一些形似字,比如日和曰)

       lang.inttemp
           (Required - 3.0x legacy tesseract) Character shape templates for
           each unichar. Produced by mftraining(1).
           # 3.0 必需
           # 每個字符的形狀模板
           # 通過模仿mftraining創建

       lang.pffmtable
           (Required - 3.0x legacy tesseract) The number of features expected
           for each unichar. Produced by mftraining(1) from .tr files.
           # 3.0 必需
           # 每個字符的期望特徵數量
           # 由 mftraining 通過 .tr文件產生

       lang.normproto
           (Required - 3.0x legacy tesseract) Character normalization
           prototypes generated by cntraining(1) from .tr files.
           # 3.0 必需
           # 字符的歸一化原型,由cntraining通過.tr文件生成

       lang.punc-dawg
           (Optional - 3.0x legacy tesseract) A dawg made from punctuation
           patterns found around words. The "word" part is replaced by a
           single space.
           # 3.0 可選的
           # 一個由字符周圍標點符號構建的dawg
           # word部分由一個單獨的空格替代

       lang.word-dawg
           (Optional - 3.0x legacy tesseract) A dawg made from dictionary
           words from the language.
           # 3.0 可選
           # 一個由字典單詞構建的dawg

       lang.number-dawg
           (Optional - 3.0x legacy tesseract) A dawg made from tokens which
           originally contained digits. Each digit is replaced by a space
           character.
           # 3.0 可選
           # 一個由符號構建的dawg,最初包含數字,每一個數字被一個空格字符代替???不是很理解

      lang.freq-dawg
           (Optional - 3.0x legacy tesseract) A dawg made from the most
           frequent words which would have gone into word-dawg.
           # 3.0 可選
           # 一個由最常用單詞構建的dawg,這些單詞將會進入word-dwag


       lang.fixed-length-dawgs
           (Optional - 3.0x legacy tesseract) Several dawgs of different fixed
           lengths — useful for languages like Chinese.
           # 3.0 可選
           # 混合長度dawgs
           # 對類似於中文的語言有用
           # 


       lang.shapetable
           (Optional - 3.0x legacy tesseract) When present, a shapetable is an
           extra layer between the character classifier and the word
           recognizer that allows the character classifier to return a
           collection of unichar ids and fonts instead of a single unichar-id
           and font.
           # 3.0 可選
           # 如果存在,shapetable是字符分類器和單詞識別器之間的額外層,允許字符分類器返回unichar ID和字體的集合,而不是單個unichar-id和字體。
           # (應該是指用來應對多字符識別的,應該能夠提高準確率)

       lang.bigram-dawg
           (Optional - 3.0x legacy tesseract) A dawg of word bigrams where the
           words are separated by a space and each digit is replaced by a ?.
           # 一個由雙字母組構成的dawg
           # bigram??二元語法
           [wiki bigram](https://en.wikipedia.org/wiki/N-gram)

       lang.unambig-dawg
           (Optional - 3.0x legacy tesseract) .

       lang.params-model
           (Optional - 3.0x legacy tesseract) .

       lang.lstm
           (Required - 4.0 LSTM) Neural net trained recognition model
           generated by lstmtraining.
           # 4.0 必需 
           # 由lstmtraining生成的神經網絡識別模型

       lang.lstm-punc-dawg
           (Optional - 4.0 LSTM) A dawg made from punctuation patterns found
           around words. The "word" part is replaced by a single space. Uses
           lang.lstm-unicharset.
           # 4.0 可選
           # 由單詞周邊的標點符號構造的dawg,需要用到lang.lstm-unicharset

       lang.lstm-word-dawg
           (Optional - 4.0 LSTM) A dawg made from dictionary words from the
           language. Uses lang.lstm-unicharset.
           # 4.0 可選
           # 由指定的語言的字典單詞構造的dawg,需要用到lang.lstm-unicharset

       lang.lstm-number-dawg
           (Optional - 4.0 LSTM) A dawg made from tokens which originally
           contained digits. Each digit is replaced by a space character. Uses
           lang.lstm-unicharset.
           # 4.0可選
           # 一個由最初包含數字的符號集構造的dawg
           # Each digit is replaced by a space character.這句話還是不是很理解,直譯的話就是每個數字都由一個空格字符代替,
           我想或者是不是可以理解爲每個數字都由一個空格字符所佔用的位置代表??
           # 需要用到lang.lstm-unicharset

       lang.lstm-unicharset
           (Required - 4.0 LSTM) The unicode character set that Tesseract
           recognizes, with properties. Same unicharset must be used to train
           the LSTM and build the lstm-*-dawgs files.
           # 4.0 必需
           # 一個Tesseract可以識別的包含屬性的unicode字符集。
           # 相同的單字符集必須用來被訓練LSTM,並且構造the lstm-*-dawgs files
       lang.lstm-recoder
           (Required - 4.0 LSTM) Unicharcompress, aka the recoder, which maps
           the unicharset further to the codes actually used by the neural
           network recognizer. This is created as part of the starter
           traineddata by combine_lang_model.
           # 4.0 必需
           # Unicharcompress又名the recoder (單字符壓縮?又名編碼器?)
           # 將單字符集合進一步映射到神經網絡識別器實際使用到的代碼上
           # 這個lang.lang_recoder由combine_lang_model創建的starter traineddata的一部分
           # (這個lang.lang_recoder可以通過combine_tessdata從traineddata中提取出來)

       lang.version
           (Optional) Version string for the traineddata file. First appeared
           in version 4.0 of Tesseract. Old version of traineddata files will
           report Version string:Pre-4.0.0. 4.0 version of traineddata files
           may include the network spec used for LSTM training as part of
           version string.
           # 4.0 可選
           # 爲the traineddata file.創建的版本字符串
           #


HISTORY
       combine_tessdata(1) first appeared in version 3.00 of Tesseract

SEE ALSO
       tesseract(1), wordlist2dawg(1), cntraining(1), mftraining(1),
       unicharset(5), unicharambigs(5)

COPYING
       Copyright (C) 2009, Google Inc. Licensed under the Apache License,
       Version 2.0

AUTHOR
       The Tesseract OCR engine was written by Ray Smith and his research
       groups at Hewlett Packard (1985-1995) and Google (2006-present).

                                  04/07/2018               COMBINE_TESSDATA(1)

lstmtraining

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章