--- id: cnocr version: "2.3.3" license: Apache 2.0 license_treatment: permissive maintenance: active --- # cnocr — Python3 package for Chinese/English OCR, with small pretrained models License: permissive · Maintenance: active · Downloads: 136.8K/mo ## What it is and what it does CnOCR is a Python OCR toolkit that detects and recognizes text in images, supporting Chinese (simplified and traditional), English, and digits. It ships with 20+ pre-trained models tuned for different scenarios—scene photos, document scans, single-line text, and pure numbers—so you can use it immediately after installation without training. The package automatically calls its companion text-detection engine (CnSTD) to locate text regions before recognition, making it suitable for both simple layouts (like screenshots) and complex real-world scenes. The library exposes a simple Python API (CnOcr class) and a command-line interface, plus an optional HTTP server for remote inference. It depends on PyTorch, torchvision, and related ML infrastructure (pytorch-lightning, wandb, torchmetrics), so installation pulls in a substantial ML stack. Model selection is configurable—you can swap detection and recognition models, specify language type for multilingual models, or use a lightweight rule-based detector for fast processing of simple documents. Use it for: - Extract text from screenshots, scanned documents, or book pages without training a custom model. - Build a document digitization pipeline that handles mixed Chinese and English text with automatic language detection. - Recognize pure-digit sequences (bank card numbers, ID codes) using specialized number-only models for higher accuracy. - Process vertical or rotated text in images using multilingual PP-OCRv6 models. - Deploy OCR as a microservice via the built-in HTTP endpoint for batch or real-time inference. - Train custom OCR models on domain-specific data using the provided training CLI. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. CnOCR recognizes text in images—Chinese (simplified and traditional), English, and digits—using pre-trained deep learning models, with built-in text detection and support for both scene photos and document scans. Yes, if you need Chinese OCR or multilingual text recognition. CnOCR is actively maintained, permissively licensed, and offers a low-friction installation with no compiled dependencies beyond standard ML libraries. The 20+ pre-trained models cover common scenarios (documents, scenes, numbers, vertical text), so most users can apply it without training. Trade-off: PyTorch and its ecosystem are large downloads; if you need only English OCR or have strict size constraints, lighter alternatives may be preferable. ## Install pip install cnocr uv add cnocr poetry add cnocr ## Installing cnocr Before you install: Low friction: pure Python wheel with no compiled dependencies beyond its runtime stack. Active maintenance—last commit 2026-07-05, 40 days since release. Requires PyTorch, torchvision, and related ML libraries, which are substantial downloads but standard for deep-learning packages. License in practice: Apache 2.0 permissive license allows commercial and private use without restriction, modification, or redistribution obligations beyond attribution. Quickstart: pip install cnocr[ort-cpu] from cnocr import CnOcr ocr = CnOcr() result = ocr.ocr('./image.jpg') print(result) Requires Python 3.8 or higher. First-time PyTorch installation may encounter platform-specific issues (OpenCV, CUDA, etc.) that are common but require manual resolution. Verify before relying: - Exact accuracy metrics or benchmarks against competing OCR systems are not provided in the fact sheet. - Whether the package supports GPU acceleration via CUDA beyond the install-time choice (ort-cpu vs ort-gpu) is unclear. - Performance characteristics (latency per image, throughput) are not documented in the excerpt. ## Package facts - License: Apache 2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 136.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags chinese ocr text recognition, optical character recognition python, scene text detection and recognition, document image ocr, chinese character recognition, multilingual ocr engine, text extraction from images, ocr-text-recognition, chinese-nlp, document-processing [View on SkillFed](https://skillfed.io/packages/cnocr) · [View on PyPI](https://pypi.org/project/cnocr/)