Plugin to run OCRmyPDF with the EasyOCR engine
Project description
OCRmyPDF EasyOCR
This is a plugin to run OCRmyPDF with the EasyOCR engine instead of Tesseract OCR, the default OCR engine for OCRmyPDF. Since EasyOCR is based on PyTorch, it makes use of Nvidia GPUs. Hopefully it will be more performant and accurate than Tesseract OCR.
It is currently experimental and does not implement all of the features of OCRmyPDF with Tesseract, and still relies on Tesseract for certain operations.
Requirements
- OCRmyPDF 17 or newer. As of 0.3.0, this plugin returns structured OCR
results to OCRmyPDF, which renders the text layer itself using its built-in
renderer. (For OCRmyPDF 14–16, use a
< 0.3.0release of this plugin.) - Python 3.11 or newer.
Installation
To use this plugin, first install PyTorch according to the official instructions, which may differ for your platform.
Then install OCRmyPDF-EasyOCR into the same virtual environment or conda environment as you installed PyTorch:
pip install git+https://github.com/ocrmypdf/OCRmyPDF-EasyOCR.git
Once installed, the plugin is discovered automatically through its entry point,
and OCRmyPDF uses EasyOCR for OCR by default (i.e. for --ocr-engine auto). You
can also select it explicitly with --ocr-engine easyocr, or fall back to the
built-in engines with --ocr-engine tesseract / --ocr-engine none. OCR still
depends on Tesseract for some non-OCR tasks (see below).
Development
This project uses uv for package management.
uv sync --group test # create the virtual environment and install dependencies
uv run pytest # run the test suite
The tests need poppler's pdftotext and a Tesseract installation available on
PATH, and will download EasyOCR's models on first run.
Troubleshooting
If you see a log message
Neither CUDA nor MPS are available - defaulting to CPU. Note: This module is much faster with a GPU
then PyTorch is not installed with GPU support.
Pass --easyocr-no-gpu to force CPU mode, or --easyocr-batch-size to tune the
EasyOCR batch size.
To do
Contributions, especially pull requests, are quite welcome!
This plugin is experimental and is missing some features:
- Tesseract is still required to determine page orientation.
- EasyOCR is effectively single-threaded, to eliminate race conditions; OCRmyPDF still parallelizes other stages of the pipeline across pages.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ocrmypdf_easyocr-0.3.0.tar.gz.
File metadata
- Download URL: ocrmypdf_easyocr-0.3.0.tar.gz
- Upload date:
- Size: 188.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f9d2d28ca6eb5e32f07133bf8c94c0990c7f73af50d0480f6ec48b6bc6456a9
|
|
| MD5 |
030a4d16d7f4c803a39f6dc8b74cbe15
|
|
| BLAKE2b-256 |
a8002dd828cd51b38f72f570cd17c80bddca5c1bab55ccb5fa07b6ad44ad995c
|
Provenance
The following attestation bundles were made for ocrmypdf_easyocr-0.3.0.tar.gz:
Publisher:
publish.yml on ocrmypdf/OCRmyPDF-EasyOCR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ocrmypdf_easyocr-0.3.0.tar.gz -
Subject digest:
0f9d2d28ca6eb5e32f07133bf8c94c0990c7f73af50d0480f6ec48b6bc6456a9 - Sigstore transparency entry: 1723817137
- Sigstore integration time:
-
Permalink:
ocrmypdf/OCRmyPDF-EasyOCR@bdc7ddeeaaa64d5ea87e2ec1f0c43e8e41e6f765 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/ocrmypdf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bdc7ddeeaaa64d5ea87e2ec1f0c43e8e41e6f765 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ocrmypdf_easyocr-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ocrmypdf_easyocr-0.3.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22ebb336a70f9d0d598034fb52314a60b624d748759a140ab84be3d03697ba52
|
|
| MD5 |
0af0c4321caea549d920206ae3340a35
|
|
| BLAKE2b-256 |
3eaec7a20ae350d9d8d66f8f9e96036c54dc28b83463dba8f0372148ae3bb958
|
Provenance
The following attestation bundles were made for ocrmypdf_easyocr-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on ocrmypdf/OCRmyPDF-EasyOCR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ocrmypdf_easyocr-0.3.0-py3-none-any.whl -
Subject digest:
22ebb336a70f9d0d598034fb52314a60b624d748759a140ab84be3d03697ba52 - Sigstore transparency entry: 1723817204
- Sigstore integration time:
-
Permalink:
ocrmypdf/OCRmyPDF-EasyOCR@bdc7ddeeaaa64d5ea87e2ec1f0c43e8e41e6f765 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/ocrmypdf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bdc7ddeeaaa64d5ea87e2ec1f0c43e8e41e6f765 -
Trigger Event:
push
-
Statement type: