skillfed

cnstd

Python3 package for Chinese/English Scene Text Detection (STD), Mathematical Formula Detection (MFD), and Layout Analysis, with free pretrained models

cnstd v1.2.8 98.9K downloads/30d#13,055 on PyPI794
Permissive license Apache 2.0 Active released

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 cnstd

uv

uv add cnstd

poetry

poetry add cnstd

Installing 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

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

Tags

scene text detectionOCR text localizationmathematical formula detectionlayout analysis documenttext bounding box detectionChinese text detectiondocument layout recognition
ocr-detectiondocument-analysismultilingual

More Artificial Intelligence packages