cnstd
Python3 package for Chinese/English Scene Text Detection (STD), Mathematical Formula Detection (MFD), and Layout Analysis, with free pretrained models
What it is and what it does
CnSTD is a Python package for detecting text and other document elements in images. It provides pre-trained models for scene text detection (STD), mathematical formula detection (MFD), and layout analysis, supporting Chinese, English, and multiple other languages. The package includes models trained on standard OCR datasets and external models from PaddleOCR, available in both PyTorch and ONNX formats.
The package is typically used to locate and extract bounding boxes of text regions in images before passing them to an OCR engine for character recognition. It also detects mathematical formulas (inline and isolated) and identifies document layout elements like headers, footers, tables, and figures. Models range from lightweight mobile-optimized variants to larger, more accurate versions, and can run on CPU or GPU.
Use it for:
- Locate text regions in document images before feeding them to an OCR system for full text recognition
- Detect and classify mathematical formulas in scientific papers or textbooks for formula extraction pipelines
- Analyze document layout to identify structural elements like titles, tables, and figures for automated document parsing
- Process multilingual documents with language-specific detection models for Chinese, English, or other supported languages
- Deploy lightweight text detection on edge devices using MobileNet or ShuffleNet model variants
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Detects text and mathematical formulas in images using pre-trained deep learning models, supporting Chinese, English, and multiple languages with both PyTorch and ONNX backends.
Yes. Active maintenance, permissive Apache 2.0 license, no known vulnerabilities, and a mature model ecosystem make this a solid choice for text detection tasks. The 20-dependency footprint is typical for ML packages. Install if you need to locate text in images before OCR or analyze document layout; skip if you only need character recognition without localization.
Install
cnstd on PyPI
pip
pip install cnstduv
uv add cnstdpoetry
poetry add cnstdInstalling cnstd
Before you install
Low installation friction with a pure Python wheel. Active maintenance with recent release (40 days old) and 794 repository stars. Depends on 20 runtime packages including PyTorch, torchvision, and computer vision libraries—a substantial but standard ML stack.
License in practice
Apache 2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most production deployments.
Quickstart
pip install cnstd
from cnstd import CnStd
std = CnStd(model_name='multi_PP-OCRv6_det_small')
result = std.detect('path/to/image.jpg')
Requires Python 3.8 or later. First use triggers automatic model download to ~/.cnstd directory; manual download from Hugging Face or Baidu Cloud may be needed if auto-download fails.
Verify before relying
- Inference speed and accuracy metrics for different model variants under various image resolutions and hardware configurations
- Memory footprint and GPU VRAM requirements for each model backend
- Whether layout analysis supports document types beyond the 10 listed categories
Package facts
| License | Apache 2.0 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 20 — click, tqdm, pyyaml, unidecode, torch, torchvision, numpy, scipy, pandas, pytorch-lightning, pillow, opencv-python, shapely, pyclipper, matplotlib, seaborn, onnx, huggingface-hub, ultralytics, rapidocr |
| Maintenance | actively maintained — 40 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 98,858/month — #13,055 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cnstd-1.2.8-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
cnocrCnOCR recognizes text in images—Chinese…
permissive · top 15,000 on PyPI
rapidocr-onnxruntimePerforms optical character recognition (OCR) on…
permissive · top 5,000 on PyPI
rapidocrRapidOCR extracts text from images using…
permissive · top 5,000 on PyPI
nudenetDetects nudity in images using lightweight ONNX…
permissive · top 15,000 on PyPI
paddlexPaddleX is a low-code framework for training,…
permissive · top 5,000 on PyPI
paddleocrPaddleOCR extracts text, tables, and structured…
permissive · top 5,000 on PyPI
qrdetDetects and segments QR codes in images using a…
permissive · top 15,000 on PyPI
layoutparserLayoutParser provides deep learning-based…
permissive · top 5,000 on PyPI
surya-ocrSurya is an OCR and document intelligence model…
permissive · top 5,000 on PyPI
ocrmacExtracts text from images on macOS using…
permissive · top 15,000 on PyPI