紅色字體為必須要另外查詢,或是重點
藍色字體為我自己的猜測,或是心得,或是尚未搞懂部分
Abstract
包含在在第四次UNLV annual test of OCR accuracy 裡 (論文搜尋: Annual Test of OCR Accuracy),與其他 OCR 做比較,但那時與那時相比,現在 Tesseract 改善了更多。tesseract 重點在於 line finding、features/classification method ,以及 adaptive classifier 等新穎的方向。
Introduction - Motivation and History
如題,總之重點就是tesseract ocr opence source: https://github.com/tesseract-ocr/
Architecture
tesseract 使用 HP 自己開發之 page layout analysis,因此直接假設輸入tesseract之圖片為二值化的已定義可選多邊形區塊 ( binary image with optional polygonal text regions defined)
以下為tesseract處理流程:
1. connected component analysis,對 outlines 進行關聯分析,這需要非肥大的計算量,但有一個優點,透過等等等(by inspection of the nesting of outlines, and the number of child and grandchild outlines),能夠使識別黑底白字(inverse text)與白底黑字(black-on-white text)一樣簡單,在此階段 tesseract 將 outlines 聚集為 Blobs。
2. Blobs 串聯成為 lines(文本行),再使用 fixed pitch 或proportional text 分析 lines,text lines 根據空格space區分文本行中自單字words
Fixed pitch text is chopped immediately by character cells.
Proportional text is broken into words using definite spaces and fuzzy spaces.
3. recognition 將分為兩步驟: 第一步驟,嘗試識別每一個字,再將辨識不錯的作為 train data 其送入adaptive classifier,使ocr能夠對之後辨識更加準確
這邊所謂表現不錯的資料該如何挑選? 之前使用tesseract是手動修改,難不成..?
第二步驟再將沒有辨識清楚的單詞再辨識一次
4. A final phase resolves fuzzy spaces, and checks alternative hypotheses for the x-height to locate smallcap text.
最後階段處理小寫字母
Line and Word Finding
Line Finding
使用tesseract之前發表的《 A Simple and Efficient Skew Detection Algorithm via Text Row Accumulation 》演算法,此法關鍵點為 blob filter 以及 line construction
假設 page layout 已經提供文字區塊大致位置,可以使用一個簡單的百分比高度filter,移除drop-cap(下墜大寫字母,起首的大寫字母比文字字身要低,通常在出版物的主要段落開始處,約占二行到三行),並且垂直找到下一個字符
使用drop cap 似乎無法適用於一大部分情況
← drop cap
The median height approximates the text size in the region,利用文字高度可以濾除標點符號、或是一些雜訊
文字高度如何得到?此處是假設所有文字高度統一?
filter blobs適合使用於文本行互相平行但傾斜的情況,通過x座標處理blob(這邊或許指的是anchor長度固定),使blobs盡可能配對於單一文本行,如此便可追蹤文本行傾斜度,降低因為將blob錯分為不同文本行,導致傾斜處理錯誤情況
Once the filtered blobs have been assigned to lines, a least median of squares fit 《Robust Regression and Outlier Detection》 is used to estimate the baselines, and the filtered-out blobs are fitted back into the appropriate lines. (當blobs可以被分配到正確的文本行,使用least median of squares fit可以計算baselines,而錯誤分配的blobs即可以被分配回正確文本行)
最後將overlap一半以上的水平文本行,合併為同一行, putting diacritical marks together with the correct base and correctly associating parts of some broken characters.(找出變音記號的base line,並且連接一些可能因為模糊或除噪等原因而殘破的字符)
p.s. 變音記號就是法文頭上那些像是四聲的東西
總結: A Simple and Efficient Skew Detection Algorithm via Text Row Accumulation 找lines 加上 Robust Regression and Outlier Detection 找baseline 以調整,增加 ines 正確率
Baseline Fitting
當text line找到後,利用quadratic spline(一種數學方法)可以更精確地擬合 baselines 《Optical Character Recognition: An Illustrated Guide to the Frontier》,這使得 tesseract 能夠尋找彎曲的baseline,為ocr之先河
合理且連續的移位原本的 baseline,切割出一群一群的blobs,一群blobs組成新的baselines,稱之為 fitted baselines
A quadratic spline is fitted to the most populous partition, (assumed to be the baseline) by a least squares fit. The quadratic spline has the advantage that this calculation is reasonably stable, but the disadvantage that discontinuities can arise when multiple spline segments are required. A more traditional cubic spline [6] might work better. (講某些時候使用cubic spline 可能更好)
下圖展示 a line of text with a fitted baseline擬合基線, descender line下降線, meanline and ascender line平均和上升線. 所有的線都是互相平行
Fixed Pitch Detection and Chopping
尋找文本中固定的字寬(fixed pitch),並將字符切割(chop),並且在之後做words recognition時先不做chop
他沒有寫到為何要做chop
Proportional Word Finding
non-fixed-pitch 或是 non-proportional text spaceing 是一個 high non-trivial task (字寬不同以及文字間格不同是一個非常困難之任務),下圖展示一些典型的問題,這些問題我們非常剛好得能夠在身分證上面看到,所以我們身分證真的是非常難辨識的一個東西,以我的實作經驗來說,姓名那行尤其難以辨識,前面title姓名與後面名字文字大小差異大,且名字間格也突然改變很大,尤其姓名兩字與名字的姓氏容易在框取文字時框再一起,基本上會導致辨識成四個字,如果將文字辨識訓練集改為大小字交叉訓練,會導致難以收斂,可能得顯示出切字效果,在繼續著手,目前來說我尚未解決這個問題
問題點大致上有以下,"11.9%" 之中十位數的1與個位數的1之間 space 與 general space(文字間隔) 相似,且通常又比 general space 大一點(可能導致計算正常間隔發生錯誤);在 "of" 和 "financial"的bounding box 之間幾乎沒有 horizontal gap(可能會將不同word合併),
Tesseract solves most of these problems by measuring gaps in a limited vertical range between the baseline and mean line. Spaces that are close to the threshold at this stage are made fuzzy, so that a final decision can be made after word recognition.
Word Recognition
Chopping Jointed Characters
雖然單個word不能令人滿意,但tesseract嘗試透過 character classifier 的 worst confidence 來chop blob 去改善結果,將 outline 的 polygonal approximation 中凹邊形的頂點作為candidate chop point 《The Extraction and Recognition of Text from Multimedia Document Images》,此處看起來所謂的chop為找出文字彎曲區域。小箭頭為candidate chop points,且會選出一部分chop point去形成線,以區分不同單字之相連處,例如r與m相接之處,詳細該如何知道何處該連成線呢?
chops 依照一個優線順序(poripority order)去執行,任何無法提高confidence的chop就暫時捨棄(如何測量confidence?),暫時捨棄的chops會保留另處,以便之後associator 如果有需要可以再利用
Associating Broken Characters
當chops用完後,該單詞依舊不夠好時,則將採用 associator,此部分主要採用 A* segmentation search (fully-chop-then-associate approach)
The associator makes an A* (best first) search of the segmentation graph of possible combinations of the maximally chopped blobs into candidate characters. (將最大blob合併為候選字母,做成segmentation graph),實際實作時,tesseract 以保留 visited states 的 hash table 來取代建立 segmentation graph(利用table依序找到頂點,連成線可以組成graph),
The A* search proceeds by pulling candidate new states from a priority queue and evaluating them by classifying unclassified combinations of fragments.
(建立一個priority queue)
有人提出反對說,這種 fully-chop-then-associate approach (完全剔除在做關聯) 是一種低效的方法,甚至可能導致遺失重要的chop。而事實上也確實如此,但此法有一個優點,它可以簡化 data structures ,得以保存完整 segmentation graph
A* segmentation search 第一次實作是在1989年,下為分割後結果,之後若是採取一個能夠很好辨識破損字元(broken characters)的辨識器(character classifier),就能得到良好結果
我說,這結果也破損太嚴重了吧? 但或許能夠拿來與原本字符做比對之類,將破損處分開出現,去個別進行辨識,在對比對結果去得到一個較高的信心度,信心度應該可以以單字符與訓練及豬標準字符的相似程度作計算
Static Character Classifier
Features
1
留言列表