1. 程式人生 > >Shangbang Long_ECCV2018_TextSnake_A Flexible Representation for Detecting Text of Arbitrary Shapes

Shangbang Long_ECCV2018_TextSnake_A Flexible Representation for Detecting Text of Arbitrary Shapes

rectangle 分類 ask 超出 des 出了 effect orien 步驟

Shangbang Long_ECCV2018_TextSnake_A Flexible Representation for Detecting Text of Arbitrary Shapes

作者

技術分享圖片

關鍵詞

文字檢測,曲線文本,多方向,multi-stage,圓盤表示法

方法亮點

  • 提出一個新的曲線文本表示方法TextSnake(由圓盤序列組成)
  • 提出了一個新的曲文檢測方法,並且精度比之前的高40%+(Total-Text數據集)

方法概述

本文方法基於一個新的曲線文本表示方法TextSnake——用一個有序的圓盤序列來表示文字,先用FCN檢測文本區域、文本中心線、以及每個點的圓盤半徑、方向,然後利用文本區域mask和中心線mask得到text instance segmentation。在每個text-instance上,交替進行點中心化和點擴展,得到文本中心點序列。最後結合圓盤半徑,得到文本區域的TextSnake表示並進行union得到最終的文本區域。

方法細節

TextSnake曲文表示方法
  • 圓盤表示法和已有的文字表示方法對比(主要是四邊形)

技術分享圖片

Fig. 1. Comparison of different representations for text instances. (a) Axis-aligned rectangle. (b) Rotated rectangle. (c) Quadrangle. (d) TextSnake. Obviously, the proposed TextSnake representation is able to effectively and precisely describe the geometric properties, such as location, scale, and bending of curved text with perspective distortion, while the other representations (axis-aligned rectangle, rotated rectangle or quadrangle) struggle with giving accurate predictions in such cases.

  • 圓盤表示法

    文本區域由多個互相覆蓋的、有序的圓串聯而成。故文本區域可以由一個圓序列來完全表示。

技術分享圖片

其中$D_i$表示第i個disk,n是圓的總個數。每個$D = (c, r, \theta)$,三個參數分別表示中心點、半徑,以及圓盤角度。$r$是圓盤中心點所在的局部寬度(筆畫寬度)的一半。$\theta$是經過中心點的曲線的切線的角度的正切值。

前兩個很好理解,最後一個事實上,如果從直觀角度,已知每個圓盤中心點坐標和半徑,其實就已經確定了這個disk序列。之所以這裏多加一個參數$\theta$是因為這裏中心線上的點非常多(可以作為圓盤中心的),不可能每個點都求出一個圓盤(速度太慢),所以作者提出的方法是基於其中某個點來擴展下一個點。通過隔一段距離采樣一個點的方式來得到整個中心文本線,而這個采樣的step長度和方向就可以由$r$和$\theta$來共同決定。(個人覺得這個表示方法不太合理。即使沒有$\theta$也是一個完整的表示法。$c$和$\theta$兩個信息不但冗余甚至可能沖突)

技術分享圖片

Fig. 2. Illustration of the proposed TextSnake representation. Text region (in yellow) is represented as a series of ordered disks (in blue), each of which is located at the center line (in green, a.k.a symmetric axis or skeleton) and associated with a radius r and an orientation θ. In contrast to conventional representations (e.g., axis-aligned rectangles, rotated rectangles and quadrangles), TextSnake is more flexible and general, since it can precisely describe text of different forms, regardless of shapes and lengths.

檢測流程

檢測步驟主要分為四個步驟。

  • 先用FCN+FPN學習5個mask(事實上TR和TCL都分別是2個channel),是否是文字的text region mask(TR),是否是文字中心線的text central line mask(TCL),以每個點為圓盤中心的圓半徑mask(radius),以每個點為圓盤中心的圓角度的cos值mask($$cos\theta$$),以每個點為圓盤中心的圓角度的sin值mask($$sin\theta$$)
  • 利用TR和TCL得到文字的instance segmentation結果。首先用TR和TCL進行mask相乘,再采用disjoint set並查集查找算法來得到instance segmentation(直接做個簡單的連通分量分析?)
  • 利用instance segmentation和前面學習到的圓盤半徑$r$和$\theta$信息,對每個text-instance進行striding,獲得用來表示曲文的TextSnake的圓盤中心點序列。
  • 利用圓盤中心點序列+圓盤半徑信息重構文本線。(這部分文章並沒有詳細說明,直接用些形態學處理,比如膨脹之類的?但這樣是有問題,因為按TextSnake的定義,圓盤序列應該是唯一確定一個曲文的,但用形態學處理參數不同結果也是不一樣的)。

技術分享圖片

網絡結構

仿照FPN和U-net設計的結構如下:

技術分享圖片

對應的操作運算公式如下:最後輸出7個channel,4個channel表示logits of TR/TCL,另外3個channel對應text-instance的$$r, cos\theta, sing\theta$$。

技術分享圖片
技術分享圖片
技術分享圖片

Post-processing算法
  • input: 每個text的instance-segmentation的mask、半徑$r$的mask,角度$\theta$相關的mask($cos\theta$

和$sin\theta$)

  • output: 曲線文字區域

  • Step1-Act(a): 在instance-segmentation上隨機取一點,將其中心化(利用法向量等將點移到過該點的筆畫的中心位置),將中心化後的點作為圓盤中心線的第一個起點

  • Step2-Act(b): 以上一個點為中心點,向兩邊同時擴展(或者一邊)。擴展方向和step大小為與半徑$r$和$\theta$相關,公式如下:

技術分享圖片

  • Step3-Act(a):將擴展後的點進行中心化

  • Step4:重復Step2和Step3,直到整個圓盤中心線都擴展完成(超出instance-segmentation區域)

  • Step5-Act(c): 利用中心線+半徑信息,進行重構得到最終輸出

技術分享圖片

Fig. 5. Framework of Post-processing Algorithm. Act(a) Centralizing: relocate a given point to the central axis; Act(b) Striding: a directional search towards the ends of text instances; Act(c) Sliding: a reconstruction by sliding a circle along the central axis.

技術分享圖片

  • Act(a) Centralizing As shown in Fig.6, given a point on the TCL, we can draw the tangent line and the normal line, respectively denoted as dotted line and solid line. This step can be done with ease using the geometry maps. The midpoint of the intersection of the normal line and the TCL area gives the centralized point.
  • Act(b) Striding The algorithm takes a stride to the next point to search. With the geometry maps, the displacement for each stride is computed and represented as ( 1 2 r × cosθ, 1 2 r × sinθ) and (- 1 2 r × cosθ, - 1 2 r × sinθ), respectively for the two directions. If the next step is outside the TCL area, we decrement the stride gradually until it’s inside, or it hits the ends.
  • Act(c) Sliding The algorithm iterates through the central axis and draw circles along it. Radii of the circles are obtained from the r map. The area covered by the circles indicates the predicted text instance. In conclusion, taking advantage of the geometry maps and the TCL that precisely describes the course of the text instance, we can go beyond detection of text and also predict their shape and course. Besides, the striding algorithm saves our method from traversing all pixels that are related.
Label生成
  • 確定兩個end邊:(個人覺得太不嚴謹這麽定義....有些曲文沒有這種互相平行而且方向相反的邊。為什麽不定義為最短邊+和最短邊最平行或者距離最遠的邊?)

The two edges near the head or tail are running parallel but in opposite direction.

  • 在每個邊上撒點(均勻撒點)

  • 取相對邊的中點連線即為圓盤中心線

技術分享圖片

損失函數

包括分類(TR和TCL)和回歸($r$、$cos\theta$、和$sin\theta$)損失。

技術分享圖片

技術分享圖片

實驗結果

  • 實驗結果示例

技術分享圖片

Fig. 8. Qualitative results by the proposed method. Top: Detected text contours (in yellow) and ground truth annotations (in green). Bottom: Combined score maps for TR (in red) and TCL (in yellow). From left to right in column: image from ICDAR 2015, TotalText, CTW1500 and MSRA-TD500. Best viewed in color.

  • 曲文數據庫(Total-Text和CTW1500)
    技術分享圖片

  • 傾斜文本數據庫(ICDAR2015和MSRA-TD500)

技術分享圖片

  • TextSnake表示法的幾何屬性可以用來做曲文的矯正方便識別(得益於TCL)

技術分享圖片

  • 泛化能力(不在曲文數據庫上進行微調,只在傾斜文本庫上進行fine-tune結果也適用於曲文)

技術分享圖片

總結與收獲

這篇方法有意思的是提出用圓盤序列(TextSnake)來表示曲文,但是文中有多處其實有歧義或者說沒有說清楚實際的具體方法,比如$\theta$和c的不互斥性、最後的重構方法、中心化的具體方法等等。應該說方法很有創新性,結果也比較好。

Shangbang Long_ECCV2018_TextSnake_A Flexible Representation for Detecting Text of Arbitrary Shapes