研究

SikaDeer-OCR: open OCR that reads Taiwan's handwriting, forms and printed pages

SikaDeer-OCR is OpenFormosa's open OCR model for Traditional Chinese handwriting, forms and printed documents. Two readers check every line and flag disagreements instead of guessing.

摘要 SikaDeer-OCR 是 OpenFormosa 社群開源的文字辨識模型。拍一張照片,紙上的字就變成文字。它讀得懂臺灣的手寫字、表單、電話與身分證字號,也讀得懂印刷文件。模型有 12 億參數,由一個從零訓練的視覺編碼器負責「看」,OpenFormosa 的 Barbet 語言模型負責「寫」。它最特別的地方是第二個只看字形的辨識器:兩邊讀得不一樣的地方會標出來,留給人確認,不會偷偷改字。這篇文章先讓你看它怎麼讀,再說明它做得好和做不好的地方。

本文重點

  • 手寫表單:30 份真人手寫表單,每 100 個欄位約 85 個一字不差(84.6 %)。最接近它的是大 20 倍以上的通用模型 Qwen3.8-27B(85.9 %)。
  • 印刷文件:任何人都能下載的公開法規文件 30 頁,每 1,000 字約錯 1 字。測試程式公開,可以自己重跑。
  • 不亂猜:兩個辨識器逐行核對。沒有被標記的行,錯誤率約 0.05 %,人只要看被標記的地方。
  • 弱點寫在前面:直排書頁、街景照片、字很密的海報和目錄頁比較不準。

線上試用下載權重GitHub 程式碼

先看一分鐘

一分鐘看完 SikaDeer-OCR 能做的事。片中的表單、姓名與電話都是虛構的合成範例。

讀錯,比讀不出來更危險

會寫句子的模型有一個習慣:它寫的是「這句話應該是什麼」,不是「紙上寫了什麼」。字潦草時,它常寫出一句通順、但紙上沒有的話,而且不會告訴你哪裡不確定。

電話少一位數,看得出來。錯一位數,就打不通。表單上最怕的是「看起來很合理的錯」。

兩個辨識器,抄同一行

SikaDeer-OCR 裡有兩個辨識器。第一個是 Barbet 解碼器,懂語意,讀潦草的字很強,但偶爾會把字「順手改掉」。第二個是複查頭,完全不看上下文,只照字形一個一個比對。

兩邊讀得一樣,就放心。讀得不一樣,兩個答案都保留,標成 ⟦解碼器|複查頭⟧。下面是模型讀範例文件時的實際輸出:

合成的範例印刷文件,標題是「開放原始碼的臺灣文字辨識」
懂語意的解碼器

用來展示 SiriDear-OCR

只看字形的複查頭

用來展示 SikaDeer-OCR

輸出:用來展示 Si⟦ri|ka⟧De⟦a|e⟧r-OCR

解碼器沒看過「SikaDeer」這個名字,把它讀成更常見的「SiriDear」。複查頭只看字形,讀對了。兩邊不同的字會被標出來,交給人確認。英文和數字兩邊讀法不同時,純文字輸出改採複查頭的讀法,所以文字結果是「SikaDeer-OCR」,標記仍然保留。這是 --page 模式的實際輸出。

公開的英文文件上也一樣。解碼器把「equitable and accountable」寫成更順口的「capable and accessible」,把「transparent」寫成「transport」。複查頭照字形讀對了,這幾處都被標了出來。英文和數字改採複查頭的讀法後,英文文件的錯誤率從 23.8 % 降到 6.7 %。

一張圖,幾種讀法

同一個模型,換一個指令,就輸出不同格式。點上方的按鈕切換。圖片都是合成範例,姓名與電話皆為虛構;右邊是模型的實際輸出,沒有修改。

一行手寫字(合成範例)

模型輸出

python scripts/ocr.py handwriting_line.jpg

王小明明天下午三點到臺北車站
紅字是兩個辨識器意見不同、需要人確認的地方。表單 JSON 的六個欄位都讀對了,每個值都回到原圖再核對一次;手寫或印刷的判斷還不可靠,所以 source 先一律標成 unknown。問到表單上有的欄位時,它直接回傳核對過的值。

它怎麼運作

想像兩個人合作抄寫。

「眼睛」是視覺編碼器。它從零訓練,把圖片每 32×32 像素整理成一小段筆記。任何長寬的圖都能直接讀,不用先縮成固定大小。

「筆」是 Barbet 語言模型。它讀這些筆記,再照你的指令寫出結果:整段文字、Markdown、表單 JSON,或只回答某一欄。

「校對」是複查頭。它不懂語意,只看字形,負責逐行核對「筆」寫的字。

為什麼整頁文件要一行一行讀?模型看圖時,長邊最多 1280 像素。一整頁 A4 縮到這個大小,印刷字只剩約 17 像素高,一次寫出八百字也容易漏行或重複。所以 --page 模式先在原始解析度上找出每一行,再一行一行讀,每行都經過複查。在公開法規頁上,這個做法把錯誤率從 21.4 % 降到 0.12 %(不含頁首圖示)。

自己試試看

用手機拍一張照片,或上傳圖片,再選它是照片、整頁印刷文件、表單,或只想問一件事。請不要上傳含真實個人資料的圖片。

正在載入線上試用⋯

等太久可以在新分頁打開試用。

線上試用的 GPU 由造序科技免費提供。人多時會排隊,畫面會顯示前面還有幾人。圖片只放在記憶體裡辨識,不會存成檔案。看不到畫面時,請在新分頁打開。

做得好的地方

真人手寫表單

30 份真人填寫的手寫表單,每份 13 個手寫欄位。一個欄位錯一個字就算錯。數字是欄位完全正確的比例,越高越好。

100 個手寫欄位,SikaDeer-OCR 約有 85 個一字不差。和它差不多準的系統大了 20 倍以上。這是內部測試集,表單沒有用於訓練;因為含個人資料,不公開。Qwen 系列關閉 thinking 模式。

公開印刷文件:任何人都能重跑

印刷文件我們用公開文件測。PDF 以 200 dpi 轉成圖,答案直接取 PDF 的文字層。數字是字元錯誤率:每 100 個字錯幾個,越低越好。測試頁清單、下載程式與算分程式都在 GitHub eval/。

測試集 結果 說明
臺灣法規 30 頁(--page) 錯誤率 0.12 %,約每 1,000 字錯 1 字 不含每頁頁首的「全國法規資料庫」圖示;計入時 7.9 %
美國 NIST 英文文件 10 頁(--page) 錯誤率 6.7 %,中位數 3.8 % 調整時只看其中 5 頁;沒看過的 5 頁為 7.1 %
沒有被標記的行 錯誤率約 0.05 % 法規頁 986 行,9.1 % 被標記
4-bit 量化 7.99 %(BF16 為 7.94 %,皆含頁首圖示) GPU 記憶體峰值 2.1 GB

其他用途

用途 結果 測試條件
表單欄位轉 JSON(--task kv) 欄位 F1 98.6 % 內部表單測試
手寫電話、身分證字號、日期 正確率 92.2 % 真人手寫,內部
一句話指令(--ask) 可以只讀某一欄 沒有正式評測,請當作參考

還不夠好的地方

我們把弱點寫得和優點一樣清楚,方便你判斷適不適合你的用途。

情況 表現 建議
目錄頁的點線(……) 點線先拿掉再讀、最後補回,點的數目不一定和原文相同 目錄頁請人工核對
沒看過的名字 可能讀成相近的常見字,通常會被標記 看被標記的地方
整頁文件用預設模式 整頁被縮小,範例頁把 SikaDeer 讀成 SikkaDeer 整頁印刷文件請用 --page 或 --task markdown
招牌、街景、手寫照片用 --page 會切成碎塊,可能讀出不存在的字 請用預設模式
直排書頁、街景照片 每 100 字約錯 10 到 17 字 重要內容請人工核對
字很密的海報、書封 容易漏字 先裁成幾塊
表格 讀成逐行文字,不還原表格結構 需要表格時請另外處理
手寫或印刷的標記(source) 判斷不可靠,目前一律是 unknown 先不要依賴這個欄位
簡體字、日文、古籍 還沒有測過 暫不建議

寫錯的字會照寫,劃掉的字不輸出。這是刻意的設計:它的工作是忠實抄錄。要寫進醫療、法律、金融或戶政紀錄前,一定要人工核對。

開始使用

只想試試看:打開線上試用,拍一張照片。

想在自己的電腦上用:

import cv2
from sikadeer_ocr import load, read

model, charset = load("OpenFormosa/sikadeer-ocr")
img = cv2.cvtColor(cv2.imread("form.jpg"), cv2.COLOR_BGR2RGB)
print(read(model, charset, img)["text"])                          # 讀出所有文字
print(read(model, charset, img, task="kv")["text"])               # 表單欄位轉 JSON
print(read(model, charset, img, ask="電話欄寫了什麼?")["text"])   # 只問一欄

GitHub 上有五篇教學:安裝、讀第一張圖、表單轉 JSON、整頁文件與批次核對、用自己的圖微調。程式碼和權重都以 Apache 2.0 授權。從 Hugging Face 下載權重前,需要先填寫申請表並同意可接受使用政策,送出後自動核准。

常見問題

有沒有開源、讀得懂繁體中文手寫字的 OCR?

有。SikaDeer-OCR 是開源的文字辨識模型,專為臺灣的繁體手寫字、表單與印刷文件設計。在 30 份真人手寫表單上,它每 100 個欄位約有 85 個一字不差,和大它 20 倍以上的通用模型 Qwen3.8-27B(85.9 %)差不多。

可以商用嗎?

可以。程式碼和權重都以 Apache 2.0 授權。下載權重前要先填申請表並同意可接受使用政策,送出後自動核准。

需要什麼硬體?

建議使用 8 GB 以上記憶體的 NVIDIA 顯示卡。4-bit 量化版只要約 2.1 GB 記憶體,準確度幾乎不變。只有 CPU 也能跑,但一整頁可能要數分鐘。

它會自動改正錯字嗎?

不會。紙上寫錯的字會照寫。兩個辨識器意見不同時,兩個答案都會保留並標出來,交給人確認。

什麼情況下不建議用?

直排書頁、街景照片、字很密的海報、目錄頁,以及沒有人工核對就直接寫進重要紀錄的情況。

數字怎麼來的

公開測試用的文件都不在訓練資料裡:全國法規資料庫的法律條文依著作權法第 9 條不受著作權保護,NIST 出版品屬於公有領域。手寫表單、手寫數字與表單 JSON 是內部測試集,圖片沒有出現在訓練資料中;因為含個人資料,不公開。所有比較系統讀同一批圖、用同一套計分方式。每一項只跑一次。

致謝

SikaDeer-OCR 屬於 OpenFormosa 社群。感謝 Taipei-1、臺大語音實驗室(NTU Speech Lab)與 NTU SPML Lab 的支持,也謝謝每一位貢獻者。歡迎到 Discord 回報讀錯的例子、分享你的表單格式,一起讓它讀得更好。圖片若含個人資料,請先遮掉再分享。

Abstract SikaDeer-OCR is an open OCR model from the OpenFormosa community. Take a photo, and the text on the paper becomes text you can use. It reads Taiwanese handwriting, forms, phone and ID numbers, and printed documents. A vision encoder trained from scratch looks; OpenFormosa’s Barbet language model writes. The model has 1.2B parameters. Its distinctive part is a second reader that only looks at glyph shapes: where the two readers disagree, the model flags the spot for a person instead of silently picking one.

Highlights

  • Handwritten forms: on 30 real handwritten forms, 84.6 % of fields are read exactly. The closest system is Qwen3.8-27B, a general model more than 20 times larger (85.9 %).
  • Printed pages: on 30 public pages of Taiwanese law, about 1 error per 1,000 characters. The test is public, so anyone can rerun it.
  • No silent guessing: two readers check every line. Unflagged lines have about 0.05 % character errors.
  • Limitations first: vertical book pages, street photos, dense posters and tables of contents are weaker.

Try it onlineDownload weightsCode on GitHub

Watch

SikaDeer-OCR in one minute. All forms, names and phone numbers in the video are synthetic.

Two readers, one line

A language-model decoder tends to write what a sentence should say, not what is on the paper. SikaDeer-OCR adds a second reader, a CTC head that ignores context and reads glyph by glyph. Where the two agree, you can trust the line. Where they disagree, both answers are kept as ⟦decoder|check⟧. This is real output on a sample page:

A synthetic sample printed page
Decoder

用來展示 SiriDear-OCR

Glyph checker

用來展示 SikaDeer-OCR

Output: 用來展示 Si⟦ri|ka⟧De⟦a|e⟧r-OCR

The decoder has never seen the name "SikaDeer" and writes the more familiar "SiriDear". The glyph checker reads it correctly, and the disagreement is flagged for a person. Where the two disagree on Latin letters or digits, the plain-text output takes the checker's reading, so the text says "SikaDeer-OCR" and the flag stays. Real --page output.

The same happens on public English documents. On a NIST page, the decoder wrote the smoother “capable and accessible” for “equitable and accountable”, and “transport” for “transparent”. The glyph checker read them correctly, so each spot was flagged. Taking the checker’s reading for Latin letters and digits cut the error rate on these English pages from 23.8 % to 6.7 %.

One image, several outputs

A handwritten line (synthetic sample)

Model output

python scripts/ocr.py handwriting_line.jpg

王小明明天下午三點到臺北車站
Images are synthetic; names and numbers are fictional. Outputs are unedited. Red marks a disagreement between the two readers. All six form fields are right, and each value is checked again against the image. The handwritten/printed label is not reliable yet, so source is unknown for now. A question about a field on the form returns the checked value.

How it works

The vision encoder, trained from scratch, turns every 32×32 pixels into a token and reads images of any aspect ratio. Barbet reads those tokens with your instruction and writes plain text, Markdown, form JSON, or the answer to one question. The CTC head checks each line.

A full A4 page shrunk to the encoder’s 1,280-pixel limit leaves printed characters about 17 pixels tall, and writing 800 characters in one go invites skipped or repeated lines. So --page finds every line at full resolution and reads them one by one, each with a cross-check. On the public law pages this cut the character error rate from 21.4 % to 0.12 % (page-header logo excluded).

Try it yourself

Upload a photo. Please do not upload images with real personal data.

Loading the online demo…

If it takes too long, open the demo in a new tab.

The demo GPU is provided free by ZaoSeq. You may wait in a short queue. Images stay in memory and are never saved as files.

Results

Test Result Notes
30 real handwritten forms, 13 fields each 84.6 % of fields exactly right; Qwen3.8-27B 85.9 %; other open OCR systems (0.8B to 5.3B) 51.8 % to 78.7 % in-house, not public (personal data)
30 public pages of Taiwanese law (--page) 0.12 % CER page-header logo excluded; 7.9 % with it
10 public NIST pages in English (--page) 6.7 % CER, median 3.8 % tuned on 5 pages; 7.1 % on the 5 unseen ones
Unflagged lines about 0.05 % CER 9.1 % of 986 law-page lines are flagged
Form fields to JSON (--task kv) field F1 98.6 % in-house
Handwritten phone, ID and date strings 92.2 % character accuracy in-house
4-bit quantized 7.99 % vs 7.94 % in BF16 (logo included) 2.1 GB peak GPU memory

The public test pages, download script and scorer are in eval/ on GitHub.

Limitations

In tables of contents, dot leaders are removed before reading and put back after, so the number of dots may differ. Unfamiliar names may be read as similar common words, usually flagged. Use --page for full printed pages; do not use it for signs, street photos or handwriting photos. Vertical book pages and street photos are weaker (10 to 17 errors per 100 characters). Dense posters drop text; crop them first. Tables are read as lines, not structure. Use --task kv for forms. The whole-image default mode misspelled SikaDeer as SikkaDeer on the sample page; use --page or --task markdown for full pages. The handwritten/printed source label is unknown for now. Simplified Chinese, Japanese and classical texts are untested. Misspellings are copied as written, by design. Always check results by hand before they enter medical, legal, financial or household records.

Get started

Code and weights are Apache 2.0. Downloading the weights from Hugging Face requires a short access form, approved automatically. Five step-by-step tutorials are on GitHub.

FAQ

Is there an open OCR model for Traditional Chinese handwriting?

Yes. SikaDeer-OCR is an open model for Taiwanese handwriting, forms and printed documents. On 30 real handwritten forms it reads 84.6 % of fields exactly, close to Qwen3.8-27B, a general model, at 85.9 %.

Can I use it commercially?

Yes. Code and weights are Apache 2.0. Downloading the weights requires a short access form and agreeing to the Acceptable Use Policy; requests are approved automatically.

What hardware do I need?

An NVIDIA GPU with 8 GB or more is recommended. The 4-bit version needs about 2.1 GB with almost no loss in accuracy. CPU works but can take minutes per page.

Thanks to Taipei-1, NTU Speech Lab and NTU SPML Lab for their support, and to every contributor.