Note: docTR 0.10.0 requires python >= 3.9
Note: docTR 0.10.0 requires either TensorFlow >= 2.15.0 or PyTorch >= 2.0.0
What's Changed
Soft Breaking Changes (TensorFlow backend only) 🛠
- Changed the saving format from
/weights
to.weights.h5
NOTE: Please update your custom trained models and HuggingFace hub uploaded models, this will be the last release supporting manual loading from /weights
.
New features
- Added numpy 2.0 support @felixdittrich92
- New and updated notebooks was added @felixdittrich92 --> notebooks
- Custom orientation model loading @felixdittrich92
- Additional functionality to control the pipeline when dealing with rotated documents @milosacimovic @felixdittrich92
- Bulit-in datasets can now be loaded directly for detection with
detection_task=True
comparable to the existingrecognition_task=True
@felixdittrich92
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=False
and/orstraighten_pages=True
and/ordetect_orientation=True
.
from doctr.models import ocr_predictor
model = ocr_predictor(pretrained=True, 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=False
and/orstraighten_pages=True
.
from doctr.models import ocr_predictor
model = ocr_predictor(pretrained=True, assume_straight_pages=False, disable_crop_orientation=True)
Loading custom exported orientation classification models
You can now load your custom trained orientation models, the following snippet demonstrates how:
from doctr.io import DocumentFile
from doctr.models import ocr_predictor, mobilenet_v3_small_page_orientation, mobilenet_v3_small_crop_orientation
from doctr.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(pretrained=True, 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)
What's Changed
Breaking Changes 🛠
- [TF] First changes on the road to Keras v3 by @felixdittrich92 in #1724
- [Build] update minor version & update torch to >= 2.0 by @felixdittrich92 in #1747
New Features
- Disable page and crop orientation by @milosacimovic in #1735
Bug Fixes
- [Bug] fix straighten pages by @felixdittrich92 in #1697
- [Fix] Remove image padding after rotation correction with
straighten_pages=True
by @felixdittrich92 in #1731 - [datasets] Allow detection task for built-in datasets by @felixdittrich92 in #1717
- [Bug] Fix eval scripts + possible overflow in Resize by @felixdittrich92 in #1715
- [demo] Add missing viz dep for demo by @felixT2K in #1751
Improvements
- [Datasets] Add Vietnamese letters by @MinhChien9 in #1693
- feat: added ukrainian vocab by @holyCowMp3 in #1700
- [orientation] Enable usage of custom trained orientation models by @felixdittrich92 in #1708
- [demo] Automate doctr demo update via CI job by @felixdittrich92 in #1742
- [TF] Move model building & unify train scripts by @felixdittrich92 in #1744
- [demo/docs] Update notebook docs & minor demo update / fix by @felixT2K in #1755
- [Reconstitution] Improve reconstitution by @felixdittrich92 in #1750
Miscellaneous
- [misc] post release 0.9.1 by @felixT2K in #1689
- [build] NumPy 2.0 support by @felixdittrich92 in #1709
New Contributors
- @MinhChien9 made their first contribution in #1693
- @holyCowMp3 made their first contribution in #1700
- @milosacimovic made their first contribution in #1735
Full Changelog: v0.9.0...v0.10.0