Releases: felixdittrich92/OnnxTR
v0.8.1
NOTE: OnnxTR v0.8.0 requires Python >=3.10
New Contributors
Publicly available pre-built Docker images: here
OnnxTR model collection: OnnxTR Hugging Face collection
Full Changelog: v0.8.0...v0.8.1
v0.8.0
What's Changed
NOTE: OnnxTR v0.8.0 requires Python >=3.10
New Features
- Add run_options_provider for EngineConfig by @florian-cronn in #87
from random import random
from onnxruntime import RunOptions, SessionOptions
from onnxtr.models import ocr_predictor, EngineConfig
def arena_shrinkage_handler(run_options: RunOptions) -> RunOptions:
"""
Shrink the memory arena on 10% of inference runs.
"""
if random() < 0.1:
run_options.add_run_config_entry("memory.enable_memory_arena_shrinkage", "cpu:0")
return run_options
engine_config = EngineConfig(run_options_provider=arena_shrinkage_handler)
engine_config.session_options.enable_mem_pattern = False
predictor = ocr_predictor(
det_engine_cfg=engine_config,
reco_engine_cfg=engine_config,
clf_engine_cfg=engine_config
)New Contributors
- @florian-cronn made their first contribution in #87
Publicly available pre-built Docker images: here
OnnxTR model collection: OnnxTR Hugging Face collection
Full Changelog: v0.7.1...v0.8.0
v0.7.1
What's Changed
NOTE: OnnxTR v0.7.1 requires Python >=3.10
New Features
- [Sync] Add VIPTR reco models by @felixdittrich92 in #73
Publicly available pre-built Docker images: here
OnnxTR model collection: OnnxTR Hugging Face collection
Full Changelog: v0.6.3...v0.7.1
v0.6.3
What's Changed
NOTE: OnnxTR v0.6.3 requires Python >=3.10
Bug Fixes
- [Fix] Adjust Resize logic - closer to PyTorch by @felixdittrich92 in #76
Improvements
- [Sync] Drop shapely and replace op with opencv by @felixdittrich92 in #74
Publicly available pre-built Docker images: here
OnnxTR model collection: OnnxTR Hugging Face collection
Full Changelog: v0.6.2...v0.6.3
v0.6.2
What's Changed
NOTE: OnnxTR v0.6.2 requires Python >=3.10
Bug Fixes
- [Fix] pathlib issue windows with older onnxruntime versions by @felixdittrich92 in #62
Publicly available pre-built Docker images: here
OnnxTR model collection: OnnxTR Hugging Face collection
Full Changelog: v0.6.1...v0.6.2
v0.6.1
What's Changed
NOTE: OnnxTR v0.6.1 requires Python >=3.10
- Small fix for custom loaded detection models where
assume_straight_pages=Falsewasn't set correctly. - Maintenance updates
Publicly available pre-built Docker images: here
OnnxTR model collection: OnnxTR Hugging Face collection
Full Changelog: v0.6.0...v0.6.1
v0.6.0
What's Changed
NOTE: OnnxTR v0.6.0 requires Python >=3.10
New version specifiers
To further enhance OnnxTR as a go-to solution for production environments, two new installation options are introduced, tailored for OpenVINO-powered deployments:
pip install "onnxtr[openvino]"
pip install "onnxtr[openvino-headless]" # same as "onnxtr[openvino]" but with opencv-headlessOpenVINO™ (Open Visual Inference and Neural Network Optimization) is an open-source toolkit developed by Intel to optimize and deploy AI inference across a variety of hardware. It is specifically designed for Intel architectures but supports multiple hardware targets, including CPUs, GPUs, NPUs, and so on. OpenVINO is particularly well-suited for applications requiring high-performance inference, such as computer vision, natural language processing, and edge AI scenarios.
As you can see this provides a great performance boost:
Publicly available pre-built Docker images added
Can be found here
OnnxTR demo
OnnxTR Hugging Face collection
Full Changelog: v0.5.1...v0.6.0
v0.5.1
What's Changed
- Improved
result.syntesize() - Updated Hugging Face demo
Full Changelog: v0.5.0...v0.5.1
v0.5.0
What's Changed
New version specifiers
To go further forward making OnnxTR the choice for production scenarios 2 new installation options was added:
pip install "onnxtr[cpu-headless]" # same as "onnxtr[cpu]" but with opencv-headless
pip install "onnxtr[gpu-headless]" # same as "onnxtr[gpu]" but with opencv-headless
Disable page orientation classification
- If you deal with documents which contains only small rotations (~ -45 to 45 degrees), you can disable the page orientation classification to speed up the inference.
- This will only have an effect with
assume_straight_pages=Falseand/orstraighten_pages=Trueand/ordetect_orientation=True.
from onnxtr.models import ocr_predictor
model = ocr_predictor(assume_straight_pages=False, disable_page_orientation=True)
Disable crop orientation classification
- If you deal with documents which contains only horizontal text, you can disable the crop orientation classification to speed up the inference.
- This will only have an effect with
assume_straight_pages=Falseand/orstraighten_pages=True.
from onnxtr.models import ocr_predictor
model = ocr_predictor(assume_straight_pages=False, disable_crop_orientation=True)
Loading custom exported orientation classification models
Syncronized with docTR:
from onnxtr.io import DocumentFile
from onnxtr.models import ocr_predictor, mobilenet_v3_small_page_orientation, mobilenet_v3_small_crop_orientation
from onnxtr.models.classification.zoo import crop_orientation_predictor, page_orientation_predictor
custom_page_orientation_model = mobilenet_v3_small_page_orientation("<PATH_TO_CUSTOM_EXPORTED_ONNX_MODEL>")
custom_crop_orientation_model = mobilenet_v3_small_crop_orientation("<PATH_TO_CUSTOM_EXPORTED_ONNX_MODEL>"))
predictor = ocr_predictor(assume_straight_pages=False, detect_orientation=True)
# Overwrite the default orientation models
predictor.crop_orientation_predictor = crop_orientation_predictor(custom_crop_orientation_model)
predictor.page_orientation_predictor = page_orientation_predictor(custom_page_orientation_model)
FP16 Support
- GPU only feature (OnnxTR needs to run on GPU)
- Added a script which can be used to convert the default FP32 models to FP16 (Input / Output will be unchanged fp32), this will further speed up the inference on GPU and lower the required VRAM
- Script is available at: https://github.com/felixdittrich92/OnnxTR/blob/main/scripts/convert_to_float16.py
Full Changelog: v0.4.1...v0.5.0
v0.4.1
What's Changed
- Fix:
straighten_pages=Truenow also displayed with.show()correctly - Added numpy 2.0 support
New Contributors
- @dependabot made their first contribution in #17
Full Changelog: v0.4.0...v0.4.1

