Multiprocessing OCR with Tesseract
pip install tesseractmultiprocessing
Worth using if you:
-
have plenty of different files
-
are using numpy
Multi: 23.9910116
One CPU: 100.61128 #pytesseract
from tesseractmultiprocessing import tesser2df
from a_cv_imwrite_imread_plus import open_image_in_cv
from time import perf_counter
picslinks = [
r"https://github.com/hansalemaos/screenshots/raw/main/pandsnesteddicthtml.png",
r"https://github.com/hansalemaos/screenshots/raw/main/cv2_putTrueTypeText_000000.png",
r"https://github.com/hansalemaos/screenshots/raw/main/cv2_putTrueTypeText_000008.png",
r"https://github.com/hansalemaos/screenshots/raw/main/cv2_putTrueTypeText_000017.png",
]
picsunique = [open_image_in_cv(x) for x in picslinks]
pics = []
for _ in range(100):
pics.extend(picsunique)
start = perf_counter()
output = tesser2df(
pics,
language="eng",
pandas_kwargs={"on_bad_lines": "warn"},
tesser_args=(),
cpus=5,
tesser_path=r"C:\Program Files\Tesseract-OCR\tesseract.exe",
)
print(f"Multi: {perf_counter()-start}")
################################################################################
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
def st():
alla = []
for p in pics:
alla.append(pytesseract.image_to_data(p))
return alla
start = perf_counter()
output2 = st()
print(f"One CPU: {perf_counter()-start}")
# Multi: 23.9910116
# One CPU: 100.61128
# output[0]
# Out[4]:
# ( level page_num block_num par_num ... start_x start_y end_x end_y
# 0 1 1 0 0 ... 0 0 1465 654
# 1 2 1 1 0 ... 322 64 327 540
# 2 3 1 1 1 ... 322 64 327 540
# 3 4 1 1 1 ... 322 64 327 540
# 4 5 1 1 1 ... 322 64 327 540
# .. ... ... ... ... ... ... ... ... ...
# 60 5 1 11 1 ... 14 633 1448 644
# 61 2 1 12 0 ... 1445 15 1450 639
# 62 3 1 12 1 ... 1445 15 1450 639
# 63 4 1 12 1 ... 1445 15 1450 639
# 64 5 1 12 1 ... 1445 15 1450 639
#
# [65 rows x 19 columns],
# array([[[255, 255, 255],
# [255, 255, 255],
# [255, 255, 255],
# ...,
# [255, 255, 255],
# [255, 255, 255],
# [255, 255, 255]],
#
# [[255, 255, 255],
# [255, 255, 255],
# [255, 255, 255],
# ...,
# [255, 255, 255],
# [255, 255, 255],
# [255, 255, 255]],
Metadata
Release files for tesseractmultiprocessing 0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tesseractmultiprocessing-0.10.tar.gz | 5.5 kB | Without provenance | Details for tesseractmultiprocessing-0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tesseractmultiprocessing-0.10-py3-none-any.whl | Python 3 | none | any | Details for tesseractmultiprocessing-0.10-py3-none-any.whl |
Total release size: 12.8 kB
Release files / tesseractmultiprocessing-0.10.tar.gz
| Download URL | tesseractmultiprocessing-0.10.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c8ba358a549d25f8439ba7159586d149cc6f1a5f34d7b63f721f51dc01d7d33
|
|
BLAKE2b-256 checksum How to use checksums |
8f85b5818df606ef38ffba3cfad84fc2db62f9d71c9e96fe78bba39ad901e32c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / tesseractmultiprocessing-0.10-py3-none-any.whl
| Download URL | tesseractmultiprocessing-0.10-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
014a045bcc22b01414a7111ecebc3f11d1098ec2dd422431d07e139e35b58d5a
|
|
BLAKE2b-256 checksum How to use checksums |
3c816e6e1c27ab48f33feb0d2a007544e9ed01d9c057959ac9a2eb3d8638a630
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for tesseractmultiprocessing 0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.