Skip to main content

cnrocr

PyPI Python Downloads Platform License

Container number detection and recognition — ISO 6346 end-to-end, ONNX only.

A region detector locates the number, ISO type code, owner code and serial on the container; an OCR recognizer reads each crop with a spec-constrained beam search. Fragments split across panels are merged back into a single number and validated against the ISO 6346 check digit.

No PyTorch required. The runtime is onnxruntime + numpy + pillow.


Install

pip install cnrocr           # CPU
pip install cnrocr[gpu]      # NVIDIA CUDA via onnxruntime-gpu

Model weights (~113 MB) are not bundled in the wheel. They are downloaded on first use and cached locally:

cnrocr models download       # optional — happens automatically otherwise

Python API

from cnrocr import ContainerOCR

ocr = ContainerOCR()                      # weights resolved from cache
result = ocr.read("gate_cam.jpg")

for c in result.containers:
    print(c.number, c.iso_type, c.confidence, c.needs_review)
# TGHU8913884 22G1 0.9997 False

Multiple images

results = ocr.read_many(["a.jpg", "b.jpg", "c.jpg"], batch_size=8)

read_many treats the images as unrelated — N images in, N results out.

Multi-view fusion

When several cameras photograph the same container, fuse them into one answer instead of voting on strings:

mv = ocr.read_multiview(["cam1.jpg", "cam2.jpg", "cam3.jpg"])
print(mv.number, mv.agreement, mv.mode)

Beam-search candidates from every view are summed in log space, so a character that one view is unsure about can be settled by the others. If the views appear to be looking at different containers, they are not fused — mv.consensus becomes False rather than producing a confident wrong answer.

Review triage

A check digit alone is not enough. The constrained decoder only emits spec-conforming candidates, so when the true string is absent from the beam it will confidently output a plausible wrong number that still passes the check digit. needs_review combines the check digit, the spec flag and a confidence floor:

if c.needs_review:
    print(c.review_reason)     # "low confidence (0.612 < 0.7)"

Owner code registry (optional)

Real-world owner codes are registered with the BIC. Supplying the list filters out invented codes that would otherwise pass both the format check and the check digit:

from cnrocr import OwnerCodeRegistry
ocr = ContainerOCR(registry=OwnerCodeRegistry.from_file("bic_codes.txt"))

The list is not shipped with this package.


Command line

cnrocr read gate_cam.jpg
cnrocr read *.jpg --json --device cuda
cnrocr multiview cam1.jpg cam2.jpg cam3.jpg
cnrocr models status
cnrocr check                    # diagnose install, providers, cache

--fail-on-review makes the process exit with code 2 when any result needs human review, which is convenient in batch pipelines.


Evaluation limit

Without a licence, cnrocr processes 10 images per day. The counter is per image, not per call, and resets at 00:00 UTC.

cnrocr license      # licence status and today's usage

When the quota runs out the process exits with code 3 and prints how to ask for a licence. Nothing is processed on a call that would exceed the quota — it is all or nothing, so a refused call costs no quota.

To request an unrestricted licence, email vislab2026@gmail.com with your name, organisation and intended use. You will receive a key:

# Windows
setx CNROCR_LICENSE "eyJlbWFpbCI6..."

# macOS / Linux
export CNROCR_LICENSE='eyJlbWFpbCI6...'

The key may also be saved to a file named license in the cache directory (cnrocr models path shows where). Verify with cnrocr check.


Weights and caching

Platform Location
Cache (Windows) %LOCALAPPDATA%\cnrocr\Cache\models\<set>
Cache (macOS) ~/Library/Caches/cnrocr/models/<set>
Cache (Linux) ~/.cache/cnrocr/models/<set>

Every file is verified against a SHA-256 recorded in the wheel. Released assets are immutable: a new model set ships under a new tag and a new library version, so upgrading never invalidates an existing install.

The weights are encrypted and are decrypted into memory when a session is built. The cache holds ciphertext only; no plaintext model is written to disk.

Environment overrides:

Variable Effect
CNROCR_MODEL_DIR Use this directory as-is; never download
CNROCR_CACHE_DIR Relocate the cache root
CNROCR_WEIGHTS_BASE_URL Fetch weights from somewhere else (file:// works)

License

Proprietary. Evaluation and non-commercial research use only — see LICENSE. Contact the copyright holder for commercial licensing.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cnrocr-0.3.3-cp313-cp313-win_amd64.whl (681.9 kB view details)

Uploaded CPython 3.13Windows x86-64

cnrocr-0.3.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cnrocr-0.3.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (5.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

cnrocr-0.3.3-cp313-cp313-macosx_11_0_arm64.whl (721.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cnrocr-0.3.3-cp312-cp312-win_amd64.whl (687.2 kB view details)

Uploaded CPython 3.12Windows x86-64

cnrocr-0.3.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cnrocr-0.3.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (5.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

cnrocr-0.3.3-cp312-cp312-macosx_11_0_arm64.whl (733.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cnrocr-0.3.3-cp311-cp311-win_amd64.whl (702.2 kB view details)

Uploaded CPython 3.11Windows x86-64

cnrocr-0.3.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cnrocr-0.3.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (5.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

cnrocr-0.3.3-cp311-cp311-macosx_11_0_arm64.whl (742.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

cnrocr-0.3.3-cp310-cp310-win_amd64.whl (701.8 kB view details)

Uploaded CPython 3.10Windows x86-64

cnrocr-0.3.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cnrocr-0.3.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (5.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

cnrocr-0.3.3-cp310-cp310-macosx_11_0_arm64.whl (748.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file cnrocr-0.3.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: cnrocr-0.3.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 681.9 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.13

File hashes

Hashes for cnrocr-0.3.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 05f94e8b0ae8802a7b1546f40a99283505521842d9930fa6b01d438a822b72d7
MD5 3f77f3d297bddf107e9a578f5ea7a2e7
BLAKE2b-256 c25ed61a4920c9165420910d41ccc6ebf6962fda596669b5e159b01b6ebc2adf

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 33718ab5d50155b22337f02391f317237d53c54c1311db1033502f7508c27d9b
MD5 b5a80bc653d57ff159e94980b133d16c
BLAKE2b-256 cf8fd3338262e558ca6fd70728b14138619e6c8fa43b2834a47a600c81145de8

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 36b4b15f46595eb7000e0841628483df95542bc0470965300a578428b71ec240
MD5 68ebab38c377cc03f82f5e4ff0bf24d3
BLAKE2b-256 74f26c8016dc9ef7025d5e9bf4499935a2aa4b4d56f15c7911228f5f82a7b238

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b71494f8c8df19c5b32bc5be4e17b72a00f7f571d419667e2ed23781f1bb326
MD5 f9a5124f3d94895855db4abbc8705fb5
BLAKE2b-256 48c3aeaf5af1ec21fd019d1037060137a85edd605ae126b034d1463e6359f50e

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: cnrocr-0.3.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 687.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.13

File hashes

Hashes for cnrocr-0.3.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 74e2f1c61394f4a32ce17d86a3846abd6749a9b5f7745a891938d77167fe5a54
MD5 fecac6351e30a4598cb28dd145def29a
BLAKE2b-256 e3881831d4200de41032529ffafd860de5c6fe8665bc771d59935ff74c5e2eee

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 42bea859c19c58d75c216b75c6dd4528dcd525e70047ce2a252131962e425e54
MD5 6894d34527f75d0bf50559d0e368cd19
BLAKE2b-256 fea50f78367ff02e4de66520c55824071a5697382254a5a8a37622307e0b87e8

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3be54268d46b2a3e37606b28b50a378c02e64ba8d886cbf092da03f48170aa68
MD5 7a945c2cd5455172038463a38a9a7250
BLAKE2b-256 74fab8912b5316c2681e20591882e3c062d1d9c0917ac72f7adc2ac3c2d9ee83

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 88a3c2e15b86654b03550e9f91710f0b6d080543dcd1c3fd7ae4984f170dcf72
MD5 e6aeca0e1a2b60c08c36d509c4aa6938
BLAKE2b-256 e8e546a141cefc760308de3ebe81074ee4478e180ee0764cd066e5af92a51f9a

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: cnrocr-0.3.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 702.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.13

File hashes

Hashes for cnrocr-0.3.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 354e330b0cb4f171233f205abccb3d3b5770a0fd9e2dede6bc9b90275d178f82
MD5 44405b795e29eae43c538fc854b8b479
BLAKE2b-256 8a31420f9d62e2707e16b98bf5593ab228c3f3f8f98636b8c2173de5bda5d0fa

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 689aab5e6ca5c70a8da7a8e7baea193ce931b8f77a8ce3753344002dc2b6dd53
MD5 0ca0dfe21f1186b4ae05278f62b42556
BLAKE2b-256 80bd701c60617059c5682dc36f1fd65426260b73658f15eb8597b54abb1cec5d

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 be36329e73f79bebc7c162ad083b7f764a7775c8398f620148a94fab1172e0b2
MD5 607c1b1b2801e1626b1c73e88776d449
BLAKE2b-256 0df459dfc19de2b04c42d5e12fbd6e992e2bcb1283e9e85fd89d5d71aa8d499b

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fc804a202b2c3c17425b6079d1126bf12b148b12e3b0159c111d1b9ecb340f76
MD5 792c2f8b19565491dd78f3388ca9afd9
BLAKE2b-256 15be9e44b6d0e16a29110c5e6f52c705a76d115ea66d2d06d714895a94b80a7d

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: cnrocr-0.3.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 701.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.13

File hashes

Hashes for cnrocr-0.3.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c02301c2ec958c0e0e96aa675826182fad25fb71370ef8d3e65dbadab206ce22
MD5 9e92acfcfd2c34318f425c7bd79e1cc4
BLAKE2b-256 43b5f1b8ed7a02cdd58cb4de5924b340acf4beb7173f5b3f250413f011375212

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 80469f01359b73f35ed6cf6d6f28c4fc888e7f07bbd9734c209eea23e40b307b
MD5 5482f193752ce35cdd64754d8b8dd30c
BLAKE2b-256 c54c7866030efeba9f05c093169c690abd351baebff343045872d4b6557e66b2

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 98b08d5d92e84f7e8dcd1c9b9f392a76f0228617c924b43f36b0fbb6c3cf2aab
MD5 e98cecdff34b15fad6a535ad76f220aa
BLAKE2b-256 0c7a9a86bd83f5ca8daa9846d89e161277a873a559cd11c52843a640cc980eca

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cnrocr-0.3.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 94f4365e53b3da0234d17684aaf980834d0c02dcda5e8967111d9cbd0ed15aa8
MD5 c0c6d43d3211654b5d148c40bf1618bb
BLAKE2b-256 fcb44995e1da2d470990fd3d289904d6398ea65d57c85a1516b2e62cea233bb3

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.11

20 files

0.6.10

1 file

0.6.9

1 file

0.6.8

1 file

0.6.7

20 files

0.6.6

20 files

0.6.5

20 files

0.6.4

20 files

0.6.3

20 files

0.6.2

20 files

0.6.1

20 files

0.6.0

20 files

0.5.10

20 files

0.5.9

20 files

0.5.8

20 files

0.5.7

20 files

0.5.6

20 files

0.5.5

20 files

0.5.4

20 files

0.5.3

20 files

0.5.2

20 files

0.5.1

20 files

0.5.0

20 files

0.4.2

20 files

0.4.1

20 files

0.4.0

20 files

0.3.4

16 files

This release

0.3.3 This release

16 files

0.3.2

16 files

0.3.1

16 files

0.3.0

16 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page