DdddOcr is a Python library for recognizing text captchas, detecting targets, and locating slider puzzle gaps locally. It uses ONNX runtime models with optional GPU acceleration and a built-in HTTP API mode.
Overview
DdddOcr packages lightweight neural models trained on large synthetic captcha datasets so scripts can solve common verification images without calling third-party recognition services. The design emphasizes minimal dependencies and a small set of initialization flags for OCR, detection-only, or slider workflows.
Text mode handles numeric, alphanumeric, Chinese, and special-character challenges, with optional beta models, probability output, character set limits, and color filtering to suppress background noise. Detection mode returns bounding boxes for likely captcha regions. Slider helpers offer edge matching for transparent cutouts and image-difference comparison for gap finding.
Custom ONNX models and charset JSON files from the ddddtrainer toolchain can replace the built-in weights. Operators may run recognition in process or start a FastAPI service via python -m ddddocr api, including Docker and Docker Compose examples for networked use. Inputs are validated for size, format, and byte limits with structured errors.
Supported platforms include 64-bit Linux and ARM64, macOS x64 with Apple silicon notes, and GPU paths where CUDA and onnxruntime-gpu are installed.
Key features
- Built-in OCR captcha models
- Target detection bounding boxes
- Slider edge and diff algorithms
- Custom ONNX model import
- Optional GPU via onnxruntime-gpu
- Character range and color filters
- REST API and Docker deployment
- Batch-friendly reusable instances
Use cases
- Automating login captcha fields
- Slider puzzle gap detection
- Scraping flows with verification images
- Self-hosted captcha microservice
- Testing with custom trained models