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)
# TGHU8913889 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.4-cp313-cp313-win_amd64.whl (681.9 kB view details)

Uploaded CPython 3.13Windows x86-64

cnrocr-0.3.4-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.4-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.4-cp313-cp313-macosx_11_0_arm64.whl (721.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

cnrocr-0.3.4-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.4-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.4-cp312-cp312-macosx_11_0_arm64.whl (733.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

cnrocr-0.3.4-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.4-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.4-cp311-cp311-macosx_11_0_arm64.whl (742.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

cnrocr-0.3.4-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.4-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.4-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.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: cnrocr-0.3.4-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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 889e10170401a82c0cadd31394238c011779be619ca452659b58b58c2e4d3049
MD5 99053dd689bddaf4254443073052d5ad
BLAKE2b-256 5d62d0254b462b6db939c1c3179c460c2597800adbe3699e6814c916c438a32b

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.4-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.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 951f23af41bd163389babe94751d5d5f48994bffa67ada332a69a4ee8b2e94d8
MD5 518107ed9dd5fa168822230cfdadd25e
BLAKE2b-256 4af948a5daa707ebf654ee944011e9686d3a9c570cb221c5a2f41e18629415d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cnrocr-0.3.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d1291f570e18c8cba85824d3060564233503a4e858b1a2fc7a414b9c0d56adf0
MD5 8153f080b392deef2236ecdbfaabfb07
BLAKE2b-256 cc04ca819f78c27c786bdd60790020859f05b86f96330ecd68d4b55528379e03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cnrocr-0.3.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb901ca647dc56aeb0821d073a7d8939cc376de82d9adcd767a9bd6e0636785a
MD5 118e4f684f06b0115bd4e5bfea60843c
BLAKE2b-256 7b04a8dff23a26ac62759bacaf4f03ebd6f84a80dfb57301c086c3a9896e6c6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cnrocr-0.3.4-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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5052e6db550e2c9295debc9a87dac568374fe64c2a391f25b923d382a82c9488
MD5 68fa893e0eaf5f9affa48bb61a806ab7
BLAKE2b-256 633cd4f18d9a62e482c83cc08e3529be031985b1e60b1252f029bed8021e9071

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.4-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.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e83ff5921f9a3d0bddb905402c0ccf61e42b14a53ba2d0ae5c17310b87842274
MD5 060301a8befb3dc29157219e9ba09449
BLAKE2b-256 5531d4823245e62b551f2a865a8e52333a34c253299660d40fb93df0af18217b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cnrocr-0.3.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b6dfbd2d20d1ae73b8086a0d9121b937d0763809b2ffac82373ac10ba2497cab
MD5 083c56bb7e07cc70b2a9ae41251b4269
BLAKE2b-256 70e2e554e6c89d5aba758c59610b86251474bf1d271d66cc7a84a53252e3a5e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cnrocr-0.3.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 389cb5bf4a42112d69fc3315dd64c181a8fc37a58293d41294ae50120ab5c1d8
MD5 edf3c6782bcc4a9948baa79f86ab85e3
BLAKE2b-256 0b26b3a07bed16bced837d412dbd01c70ed36496be0bd64efd4ea3d7d0aaaa72

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cnrocr-0.3.4-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.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 07de35981eb1b25250b6ef3b54c5daf7353fcff7a6ea1a017590a162cba8937d
MD5 cfdcd4f269f9df21d5e7c9765e649c54
BLAKE2b-256 edf7732603bf4ee98744f32bea1e4bc0fc1383da4b22102a483985577a113cf8

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.4-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.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b3b664fb8bd26879813f050a31525426c2f010d6a7145f7805f738c368894c3e
MD5 cfd2870f9b7d6235a716eaefbaefa9e3
BLAKE2b-256 b57b8dea4cfc70078487b7979da2698a3fa686951b4ceccd9613ee05398a5b31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cnrocr-0.3.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0b37be88bf3f76f5e11ecd028e691d5c23d896d5843e3d02257e79f22f675383
MD5 729d75de15d1d06115837302dfceb2cd
BLAKE2b-256 21dc139c52a5bac869c3819fa7c9325b3389487e6c49a34e43393c6af2e2b666

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cnrocr-0.3.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 381aaccf88791d30fef1fb60be4f05c99f8af05edcb806277fc67338a7bd5dcc
MD5 3f8e9c9b8c8e20c1c46c8a80d219f66f
BLAKE2b-256 3278039b27416906ecc9b62f808d6ac1941ff88fc35b1576b9b82a857d1571ef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cnrocr-0.3.4-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.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f8860bab99d413accfd05ce1727c4ef5d558515918e66b52e0e758e3b8422cbb
MD5 e949c921c145ad0abe350aad11146c2d
BLAKE2b-256 98078878195f1a71556e06bdc7cf96469406f5b57bb31f47dd5759fd4c0ef570

See more details on using hashes here.

File details

Details for the file cnrocr-0.3.4-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.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f7d02edf3590e01608be02694182e5748abedfe10343fe6fee95ffd5e15d1395
MD5 67528b276ffafffe77ffc7f0186c8e11
BLAKE2b-256 78bfe3d27c5f9c21aadaeddfc0305d5cff724366105849b77cf3b7cd917c0d1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cnrocr-0.3.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a37271fe83804cd263ea1eb8120af32c44f0215353c744d9a3b8e00ca25c2b0f
MD5 59085189574c6ea8d0915b6801e5224c
BLAKE2b-256 eb72d273189b780bfd5f6097b1a350dada24c10773c730db19c09c5bd8850350

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cnrocr-0.3.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a7d035a8cb3088f614217f963fe1edd17fe531a85a152a45f5836dbc90264736
MD5 bbcc99a6fad944b0413b8ea3b9025b2f
BLAKE2b-256 7430d1b754501ff35ef4c144c5db3b06a8d5a939a8db4dcbec51f4350ba0e30b

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

This release

0.3.4 This release

16 files

0.3.3

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