DdddOcr is a universal offline CAPTCHA recognition SDK that leverages deep learning models to identify various types of CAPTCHAs, including alphanumeric, Chinese characters, slider puzzles, and special character combinations. It is designed with minimal dependencies for ease of use and offers a simple API. The current version is 1.6.1 and is actively maintained with frequent updates.
pip install ddddocrVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic text recognition using the DdddOcr class. It initializes the OCR engine once and then processes an image from bytes. Remember to initialize the `DdddOcr` object only once for performance.
Initialize the `ddddocr.DdddOcr()` object only once and reuse the instance for multiple recognition tasks.
Ensure that `ddddocr.DdddOcr()` is instantiated within each thread that requires OCR capabilities.
Rename your project directory to anything other than `ddddocr` to avoid conflicts with the installed package name.
Explicitly set only the desired mode (e.g., `ddddocr.DdddOcr(ocr=True, det=False)` for OCR or `ddddocr.DdddOcr(ocr=False, det=True)` for detection) to avoid unintended behavior.
Install the correct versions of CUDA and cuDNN matching your `onnxruntime-gpu` requirements. For static linking issues, manually place `onnxruntime` DLLs in the program's running directory or use `Ddddocr::set_onnxruntime_path` if using dynamic linking.
Initialize the `ddddocr.DdddOcr()` object once outside any loops and reuse it for all subsequent recognition calls. Example: `ocr = ddddocr.DdddOcr(); for img in images: result = ocr.classification(img_bytes)`
Rename your project directory to something other than `ddddocr`. This ensures that Python correctly imports the installed package.
Try using the Beta model by initializing with `ocr = ddddocr.DdddOcr(beta=True)`. For very specific cases, consider using the color filtering feature or importing a custom-trained model.
Initialize only the specific `DdddOcr` instance(s) needed for the current task. For example, if you only need OCR, use `ocr = ddddocr.DdddOcr(ocr=True, det=False)` and avoid initializing a separate detection object if not immediately required.
Verify your CUDA and cuDNN versions are compatible with your `onnxruntime-gpu` installation. Ensure the `onnxruntime` DLLs are accessible to your application (e.g., in the system's PATH, or application's running directory). For specific cases, especially with static linking, you might need to manually place or configure the `onnxruntime` library path.