cnocr
Python3 package for Chinese/English OCR, with small pretrained models
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- 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.
- Low friction: pure Python wheel with no compiled dependencies beyond its runtime stack.
License · maintenance · safety
Apache 2.0 (permissive) — Apache 2.0 permissive license allows commercial and private use without restriction, modification, or redistribution obligations beyond attribution.
last release 2026-07-05 (40 days) · last repo commit 2026-07-05 · 3,766 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 136,800 downloads/mo, #11,387 on PyPI
Alternatives
Verify before relying
pip install cnocr[ort-cpu]
from cnocr import CnOcr
ocr = CnOcr()
result = ocr.ocr('./image.jpg')
print(result)- 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.
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 on this page. Verify before relying on it.
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
cnocr on PyPI
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.
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.
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)
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 the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 12 packagesclicktqdmtorchtorchvisionnumpypytorch-lightningwandbtorchmetricspillowonnxcnstdrapidocr |
| Maintenance | Actively maintained 40 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 136,800 / month, #11,387 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: ImplementationTopic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: cnocr-2.3.3-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “chinese ocr text recognition”
- cnocrCnOCR recognizes text in images—Chinese (simplified and traditional),…
- rapidocr-onnxruntimePerforms optical character recognition (OCR) on images to extract…
- easyocrEasyOCR performs optical character recognition on images across 80+…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also cnstd · rapidocr-onnxruntime · rapidocr · easyocr · paddleocr · paddlex · python-doctr · opencc-python-reimplemented · ddddocr · zhconv