JunTeng1113/OCR-for-NKUST-Student-ID-Card

OCR for NKUST student ID cards, derived from OCR-for-Taiwan-National-Identity-Card

★ 0Forks 0PythonGitHub ↗Compare

README

OCR for NKUST Student ID Card

本開源專案基於 OCR-for-Taiwan-National-Identity-Card(台灣國民身分證 OCR),沿用其 Flask API、PaddleOCR 與前端結構,改為辨識高科大學生證欄位。

辨識國立高雄科技大學學生證反面(有照片與文字的那一面)上的欄位:

  • 照片
  • 姓名
  • 學號
  • 學制
  • 系所

上傳 JPEG 或 PNG,後端以版面裁切加上 PaddleOCR 繁體辨識,前端顯示結果表。

環境

  • Windows
  • Python 3.10
  • Node.js(前端)

模型

將權重放到 BackendAPI/InferenceModel/:

資料夾 用途
ch_PP-OCRv4_det_server_infer 文字偵測
chinese_cht_PP-OCRv3_rec_infer 繁體辨識

原專案模型包:Google Drive(請使用其中的 ch_PP-OCRv4_det_server_infer)。

繁體 rec 請另外下載 chinese_cht_PP-OCRv3_rec_infer,解壓後放到 BackendAPI/InferenceModel/chinese_cht_PP-OCRv3_rec_infer。字典使用專案內的 BackendAPI/ppocr/utils/dict/chinese_cht_dict.txt。

啟動後端

cd BackendAPI
python 20240226Flask.py

預設 http://0.0.0.0:8689。可在 20240226Flask.py 的 app.run 改主機與連接埠。

辨識 API:POST /IDCard_Detection/predict(路徑名稱沿用原專案)。

啟動前端

  1. 編輯 SimpleFrontend/public/script.js,把 fetch 的網址改成你的後端,例如 http://127.0.0.1:8689/IDCard_Detection/predict。
  2. 安裝並啟動:
cd SimpleFrontend
npm install
node server.js

瀏覽器打開 http://localhost:3000,按「上傳學生證反面」,可選 JPEG 或 PNG。

前端請用 http://localhost:3000,不要用 file://。後端已允許此來源的 CORS。

辨識說明

  • 欄位位置以學生證反面版面裁切。
  • 學號、學制、系所會去掉「學號/學制/系所」與 |、丨 等標籤雜訊;學號會抽出「字母 + 數字」格式。
  • 繁體姓名仍可能被 OCR 誤成形近字,必要時請人工核對。

授權與來源

本專案衍生自 KetsuRyo/OCR-for-Taiwan-National-Identity-Card。原專案的授權與第三人元件(PaddleOCR 等)請一併遵守。

Contributors

KetsuRyoJunTeng1113

Issues