Skip to content

ddddocr

Python library that reads text from common captchas offline, using pre-trained models.

Stars
14.9k
Forks
2.4k
Licence
MIT
Language
Python
Last update
8 months ago
Type
Library

What it is

ddddocr is a Python library for recognizing text in captcha images without calling an online service; it runs models locally. It is mainly used by developers who need to automate or test sites that show image captchas. The README also describes sliding-captcha gap detection and simple object detection.

  • Read a short digit or letter captcha image from a file with classification()
  • Restrict recognition to digits only with set_ranges()
  • Get per-character probabilities with probability=True for custom post-processing
  • Detect object positions in an image with det=True
  • Load a custom-trained ONNX model with import_onnx_path and charsets_path

Great for

  • Developers automating tests on their own sites that use simple image captchas
  • Python users who want a local, offline OCR call with a few lines of code
  • Projects needing digit or letter captcha reading with character-set limits
  • Users who want to try a recognition model before training a custom one

Not ideal for

  • Anyone wanting to bypass captchas on sites they do not own or have permission to test, since the README targets legitimate recognition use and the project carries legal and ethical risk
  • Users on 32-bit Windows or 32-bit Linux, which the README lists as unsupported
  • Users needing guaranteed accuracy on complex or modern captchas, since the README says results vary and advises training custom models for harder cases
Step-by-step guide: how to use ddddocrInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python (the README says the maximum supported version is 3.12) · pip

    Install from PyPI

    pip install ddddocr
  2. 2

    Run it

    • Install the package with pip install ddddocr
    • Create one DdddOcr() object and reuse it, since re-initializing is slow
    • Read an image file as bytes and call ocr.classification(image)
    • Print the returned string
  3. 3

    Get the most out of it

    • Use set_ranges() to limit output to the characters you expect, which the README shows reduces wrong characters
    • Try beta=True if the default model performs poorly on your captcha type
    • Use probability=True to inspect per-character confidence before accepting a result
    • Set use_gpu=True with a correct CUDA and onnxruntime-gpu setup for large batches

Downloads

Strengths

  • Runs offline locally, so no external recognition service is required for the basic OCR call
  • The README documents a small, clear API with a few options such as beta, set_ranges and probability output
  • Supports Windows, Linux and macOS on 64-bit CPUs and offers optional GPU use

Trade-offs

  • Accuracy depends on the captcha type; the README does not give benchmark numbers and suggests custom training for hard cases
  • GPU use needs CUDA and a matching onnxruntime-gpu build, and initialization fails otherwise
  • Several README sections are sponsor-heavy and the parameter docs mention features (like old) that currently have no effect

How it compares

ProjectStarsTypeLevelUpdatedBest for
ddddocr (this)14.9kLibrarybeginner8 months agoDevelopers automating tests on their own sites that use simple image captchas
Skill_Seekers15.3kDev toolintermediate1 months agoDevelopers who want an AI assistant to know a specific library's documentation
zerox12.3kLibraryintermediate1.5 years agoDevelopers building pipelines that feed documents into AI or search systems

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.