arcships/light-ocr
Fast, offline OCR for Node.js & C++. PP-OCRv6 with Core ML / WebGPU hardware acceleration — recognize text in images with confidence scores & coordinates. npm: @arcships/light-ocr
What it solves
light-ocr 是一個為 Node.js 和 C++ 應用程式設計的快速、離線光學字元辨識 (OCR) 引擎。它允許開發者在使用者機器的本地端從影像 (JPEG, PNG, 或原始像素資料) 中提取文字,從而消除對外部雲端 API 的需求,並確保資料隱私。
How it works
該專案使用 PP-OCRv6 Small 模型來辨識文字。它提供了一個高效能的 C++ 核心,並為 Node.js 提供綁定。為了優化速度並降低 CPU 負載,它會自動偵測硬體並套用加速:在 Apple Silicon (macOS 15+) 上使用 Core ML,在 Linux 和 Windows 上使用 WebGPU (透過 Vulkan 或 D3D12)。
Who it’s for
開發者正在構建需要從影像中進行本地、高效能文字辨識,且不依賴雲端服務的 Node.js 或 C++ 應用程式。
Highlights
- Local Processing: All images and results stay on the machine, ensuring privacy.
- Hardware Acceleration: Automatic support for Core ML and WebGPU to significantly speed up recognition and reduce CPU usage.
- Tiled Mode: An optional mode to preserve the accuracy of accuracy of small or dense text in high-resolution images.
- Lighweight Installation: The npm package includes the model and prebuilt components for many platforms.
- Detailed Output: Returns text, confidence scores, and quadrilateral coordinates for every recognized line.
*Note: In the translation, translation of the highlights section'
Highlights
- 本地處理: All images and results stay on the machine, ensuring privacy.
- 硬體加速: 自動支援 Core ML 和 WebGPU,以顯著提升辨識速度並降低 CPU 使用率。
- 分塊模式 (Tiled Mode): 一個可選模式,用於在解析度高的影像中保留小文字或密集文字的辨識精確度。
- 輕量化安裝: npm package 包含模型與主要平台的預建組件。
- 詳細輸出: 回傳文字、信心分數與每一行辨識結果的四邊形座標。