# DocReader ###### tags: `2022Q1技術研討`, `detection`, `ocr` [paper] [DocReader: Bounding-Box Free Training of a Document Information Extraction Model](https://arxiv.org/pdf/2105.04313.pdf) ## Document Information Extraction 2021 年的 paper, Germany, SAP ### Abstract 提出一種 ==End to End 的架構==:DocReader,可以直接給定一張圖片,輸出目標文字的 values  ### 過去的方法 * 現有的 information extraction 以兩階段為主: 1. detect 出文件中的所有文字 2. 在所有文字中找出目標的 target * 另一種結構:給定目標的 bounding box 再接 OCR model * 同樣是 two-step 架構~~ (e.g. Yolo + CRNN) 過去的方法都需要給予 bounding box 以及 text 的 annotation 資料~~ 本篇提出的方法<font color=#20639B>不需要任何的 bounding-box annotations !!!!</font>,僅需給與目標 target 的 values ### Model Architecture DocReader 架構: * Encoder + Decoder 結構 * 輸入 image 後經過 encoder 結構產出 feature map,feature map + key 的 embedding 一起進去 RNN-based decoder,最後兩者一起進去計算 cross-entropy loss。  ==Encoder 結構==: * Input: image (H * W * C) * 經過三個 convolution blocks,每一個 blocks 包含三個 convolution layers * 每一層 convolution layers 皆包含 dropout, batch-normalization, relu activation function * 最後的 output 被稱作為 memory  * memory 再進 decoder 前會依先針對 memory 做前處理 (上圖右) * 原本的 memory 額外再加上轉換為 one-hot encoding 的 memory,共組而成 Spatial Aware Memory * 對 H, W 做 position encoding * <font color=#20639B>所以藍色的就是 pixel 的 feature, 橘色的就是 location 的 feature</font> ==Decoder 結構==: * 架構為 RNN-based (LSTM) + attention layer (sum-attention layer) * 輸入兩種 inputs * Spatial Aware Memory (from encoder + preprocessing) * 目標 target 的 values (key),會先轉換成 one-hot encoding or 其他 embedding 方式~ * 這個 key 指的應該是分類標籤 e.g. invoice number, invoice amount... * output 則是相對應的數值  <font color=#FF8800>Score function</font>: * m: Spatial Aware Memory; k: embedded key; h: 前一步的 lstm state; o: 前一步的預測字元; a: 前一步的 attention weights * 這邊在做 attention 的計算,經過 softmax 得到 attention weights (參數包含前一步的資料)  <font color=#FF8800>Context vector</font>: * attention weights * memory 在做相加  * <font color=#20639B>一份文件中有各種地方都有包含到 text 的部分</font>,因此有個很困難的議題就是,怎麼找到目標的文字,本篇提出的解法就是==增加額外的資訊==進去 sum-attention layer 做計算 <font color=#FF8800>LSTM</font>: * h: 前一步的 lstm state; l: 前一步的 character embedding; c: context vector; k: embedded key * LSTM 的 output,先 concat 各個 steps 的 context vector,經過一層 project layer,在做 softmax 輸出,得到預測的字元  ### 實驗結果 訓練資料量有 1.5 M  Attention maps 視覺化 * 橘色: invoice number * 藍色: invoice amount  Future work: - 是否可以當作 detection model,只拿 attention 的部分就好 - 有機會不需要人力標注,直接拿 db 資料即可
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up