python-doctr 0.7.0__tar.gz → 0.8.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-doctr-0.7.0/python_doctr.egg-info → python-doctr-0.8.1}/PKG-INFO +67 -31
- {python-doctr-0.7.0 → python-doctr-0.8.1}/README.md +57 -15
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/__init__.py +2 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/cord.py +6 -4
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/datasets/base.py +3 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/datasets/pytorch.py +4 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/datasets/tensorflow.py +4 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/detection.py +6 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/doc_artefacts.py +2 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/funsd.py +7 -8
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/generator/base.py +3 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/generator/pytorch.py +3 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/generator/tensorflow.py +3 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/ic03.py +3 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/ic13.py +2 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/iiit5k.py +6 -4
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/iiithws.py +2 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/imgur5k.py +3 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/loader.py +4 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/mjsynth.py +2 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/ocr.py +2 -1
- python-doctr-0.8.1/doctr/datasets/orientation.py +40 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/recognition.py +3 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/sroie.py +2 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/svhn.py +2 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/svt.py +3 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/synthtext.py +2 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/utils.py +27 -11
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/vocabs.py +26 -1
- python-doctr-0.8.1/doctr/datasets/wildreceipt.py +111 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/file_utils.py +3 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/io/elements.py +52 -35
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/io/html.py +5 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/io/image/base.py +5 -4
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/io/image/pytorch.py +12 -7
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/io/image/tensorflow.py +11 -6
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/io/pdf.py +5 -4
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/io/reader.py +13 -5
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/_utils.py +30 -53
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/artefacts/barcode.py +4 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/artefacts/face.py +4 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/builder.py +58 -43
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/__init__.py +1 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/magc_resnet/pytorch.py +5 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/magc_resnet/tensorflow.py +5 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/mobilenet/pytorch.py +16 -4
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/mobilenet/tensorflow.py +29 -20
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/predictor/pytorch.py +3 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/predictor/tensorflow.py +2 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/resnet/pytorch.py +23 -13
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/resnet/tensorflow.py +33 -26
- python-doctr-0.8.1/doctr/models/classification/textnet/pytorch.py +275 -0
- python-doctr-0.8.1/doctr/models/classification/textnet/tensorflow.py +267 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/vgg/pytorch.py +4 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/vgg/tensorflow.py +5 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/vit/pytorch.py +9 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/vit/tensorflow.py +9 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/zoo.py +7 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/core.py +1 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/__init__.py +1 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/_utils/pytorch.py +7 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/_utils/tensorflow.py +7 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/core.py +9 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/differentiable_binarization/base.py +37 -25
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/differentiable_binarization/pytorch.py +80 -104
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/differentiable_binarization/tensorflow.py +74 -55
- python-doctr-0.8.1/doctr/models/detection/fast/base.py +256 -0
- python-doctr-0.8.1/doctr/models/detection/fast/pytorch.py +442 -0
- python-doctr-0.8.1/doctr/models/detection/fast/tensorflow.py +428 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/linknet/base.py +12 -5
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/linknet/pytorch.py +28 -15
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/linknet/tensorflow.py +68 -88
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/predictor/pytorch.py +16 -6
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/predictor/tensorflow.py +13 -5
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/zoo.py +19 -16
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/factory/hub.py +20 -10
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/kie_predictor/base.py +2 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/kie_predictor/pytorch.py +28 -36
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/kie_predictor/tensorflow.py +27 -27
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/modules/__init__.py +1 -0
- python-doctr-0.8.1/doctr/models/modules/layers/pytorch.py +166 -0
- python-doctr-0.8.1/doctr/models/modules/layers/tensorflow.py +175 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/modules/transformer/pytorch.py +24 -22
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/modules/transformer/tensorflow.py +6 -4
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/modules/vision_transformer/pytorch.py +2 -4
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/modules/vision_transformer/tensorflow.py +2 -4
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/obj_detection/faster_rcnn/pytorch.py +4 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/predictor/base.py +14 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/predictor/pytorch.py +26 -29
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/predictor/tensorflow.py +25 -22
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/preprocessor/pytorch.py +14 -9
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/preprocessor/tensorflow.py +10 -5
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/core.py +4 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/crnn/pytorch.py +23 -16
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/crnn/tensorflow.py +25 -17
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/master/base.py +4 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/master/pytorch.py +20 -9
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/master/tensorflow.py +20 -8
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/parseq/base.py +4 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/parseq/pytorch.py +28 -22
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/parseq/tensorflow.py +22 -11
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/predictor/_utils.py +3 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/predictor/pytorch.py +3 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/predictor/tensorflow.py +2 -1
- python-doctr-0.8.1/doctr/models/recognition/sar/__init__.py +6 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/sar/pytorch.py +14 -7
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/sar/tensorflow.py +23 -14
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/utils.py +5 -1
- python-doctr-0.8.1/doctr/models/recognition/vitstr/__init__.py +6 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/vitstr/base.py +4 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/vitstr/pytorch.py +22 -13
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/vitstr/tensorflow.py +21 -10
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/zoo.py +4 -2
- python-doctr-0.8.1/doctr/models/utils/__init__.py +6 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/utils/pytorch.py +24 -6
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/utils/tensorflow.py +22 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/zoo.py +21 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/transforms/functional/base.py +8 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/transforms/functional/pytorch.py +23 -6
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/transforms/functional/tensorflow.py +25 -5
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/transforms/modules/base.py +12 -5
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/transforms/modules/pytorch.py +10 -12
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/transforms/modules/tensorflow.py +17 -9
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/utils/common_types.py +1 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/utils/data.py +4 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/utils/fonts.py +3 -2
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/utils/geometry.py +95 -26
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/utils/metrics.py +36 -22
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/utils/multithreading.py +5 -3
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/utils/repr.py +3 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/utils/visualization.py +31 -8
- python-doctr-0.8.1/doctr/version.py +1 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/pyproject.toml +35 -33
- {python-doctr-0.7.0 → python-doctr-0.8.1/python_doctr.egg-info}/PKG-INFO +67 -31
- {python-doctr-0.7.0 → python-doctr-0.8.1}/python_doctr.egg-info/SOURCES.txt +12 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/python_doctr.egg-info/requires.txt +8 -14
- {python-doctr-0.7.0 → python-doctr-0.8.1}/setup.py +2 -2
- python-doctr-0.7.0/doctr/version.py +0 -1
- {python-doctr-0.7.0 → python-doctr-0.8.1}/LICENSE +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/datasets/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/datasets/generator/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/io/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/io/image/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/artefacts/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/magc_resnet/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/mobilenet/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/predictor/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/resnet/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/classification/vit → python-doctr-0.8.1/doctr/models/classification/textnet}/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/classification/vgg/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/detection/differentiable_binarization → python-doctr-0.8.1/doctr/models/classification/vit}/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/_utils/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/detection/linknet → python-doctr-0.8.1/doctr/models/detection/differentiable_binarization}/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/modules/transformer → python-doctr-0.8.1/doctr/models/detection/fast}/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/modules/vision_transformer → python-doctr-0.8.1/doctr/models/detection/linknet}/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/detection/predictor/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/factory/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/kie_predictor/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/preprocessor → python-doctr-0.8.1/doctr/models/modules/layers}/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/recognition/crnn → python-doctr-0.8.1/doctr/models/modules/transformer}/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/recognition/master → python-doctr-0.8.1/doctr/models/modules/vision_transformer}/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/obj_detection/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/obj_detection/faster_rcnn/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/predictor/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/recognition/parseq → python-doctr-0.8.1/doctr/models/preprocessor}/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/recognition/sar → python-doctr-0.8.1/doctr/models/recognition/crnn}/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/recognition/vitstr → python-doctr-0.8.1/doctr/models/recognition/master}/__init__.py +0 -0
- {python-doctr-0.7.0/doctr/models/utils → python-doctr-0.8.1/doctr/models/recognition/parseq}/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/models/recognition/predictor/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/transforms/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/transforms/functional/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/transforms/modules/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/doctr/utils/__init__.py +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/python_doctr.egg-info/dependency_links.txt +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/python_doctr.egg-info/top_level.txt +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/python_doctr.egg-info/zip-safe +0 -0
- {python-doctr-0.7.0 → python-doctr-0.8.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-doctr
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: Document Text Recognition (docTR): deep Learning for high-performance OCR on documents.
|
|
5
5
|
Author-email: Mindee <contact@mindee.com>
|
|
6
6
|
Maintainer: François-Guillaume Fernandez, Charles Gaillard, Olivier Dulcy, Felix Dittrich
|
|
@@ -209,7 +209,7 @@ License: Apache License
|
|
|
209
209
|
Project-URL: documentation, https://mindee.github.io/doctr
|
|
210
210
|
Project-URL: repository, https://github.com/mindee/doctr
|
|
211
211
|
Project-URL: tracker, https://github.com/mindee/doctr/issues
|
|
212
|
-
Project-URL: changelog, https://github.
|
|
212
|
+
Project-URL: changelog, https://mindee.github.io/doctr/changelog.html
|
|
213
213
|
Keywords: OCR,deep learning,computer vision,tensorflow,pytorch,text detection,text recognition
|
|
214
214
|
Classifier: Development Status :: 4 - Beta
|
|
215
215
|
Classifier: Intended Audience :: Developers
|
|
@@ -236,17 +236,17 @@ Requires-Dist: pyclipper<2.0.0,>=1.2.0
|
|
|
236
236
|
Requires-Dist: shapely<3.0.0,>=1.6.0
|
|
237
237
|
Requires-Dist: langdetect<2.0.0,>=1.0.9
|
|
238
238
|
Requires-Dist: rapidfuzz<4.0.0,>=3.0.0
|
|
239
|
+
Requires-Dist: huggingface-hub<1.0.0,>=0.20.0
|
|
239
240
|
Requires-Dist: matplotlib>=3.1.0
|
|
240
241
|
Requires-Dist: weasyprint>=55.0
|
|
241
|
-
Requires-Dist: Pillow>=
|
|
242
|
+
Requires-Dist: Pillow>=9.2.0
|
|
242
243
|
Requires-Dist: defusedxml>=0.7.0
|
|
243
244
|
Requires-Dist: mplcursors>=0.3
|
|
244
245
|
Requires-Dist: unidecode>=1.0.0
|
|
245
246
|
Requires-Dist: tqdm>=4.30.0
|
|
246
|
-
Requires-Dist: huggingface-hub>=0.5.0
|
|
247
247
|
Provides-Extra: tf
|
|
248
|
-
Requires-Dist: tensorflow<
|
|
249
|
-
Requires-Dist: tf2onnx<2.0.0,>=1.
|
|
248
|
+
Requires-Dist: tensorflow<2.16.0,>=2.11.0; extra == "tf"
|
|
249
|
+
Requires-Dist: tf2onnx<2.0.0,>=1.16.0; extra == "tf"
|
|
250
250
|
Provides-Extra: torch
|
|
251
251
|
Requires-Dist: torch<3.0.0,>=1.12.0; extra == "torch"
|
|
252
252
|
Requires-Dist: torchvision>=0.13.0; extra == "torch"
|
|
@@ -259,11 +259,8 @@ Requires-Dist: onnxruntime>=1.11.0; extra == "testing"
|
|
|
259
259
|
Requires-Dist: requests>=2.20.0; extra == "testing"
|
|
260
260
|
Requires-Dist: psutil>=5.9.5; extra == "testing"
|
|
261
261
|
Provides-Extra: quality
|
|
262
|
-
Requires-Dist: ruff>=0.
|
|
263
|
-
Requires-Dist: isort>=5.7.0; extra == "quality"
|
|
264
|
-
Requires-Dist: black>=22.1; extra == "quality"
|
|
262
|
+
Requires-Dist: ruff>=0.1.5; extra == "quality"
|
|
265
263
|
Requires-Dist: mypy>=0.812; extra == "quality"
|
|
266
|
-
Requires-Dist: pydocstyle[toml]>=6.1.1; extra == "quality"
|
|
267
264
|
Requires-Dist: pre-commit>=2.17.0; extra == "quality"
|
|
268
265
|
Provides-Extra: docs
|
|
269
266
|
Requires-Dist: sphinx!=3.5.0,>=3.0.0; extra == "docs"
|
|
@@ -275,8 +272,8 @@ Requires-Dist: sphinx-markdown-tables>=0.0.15; extra == "docs"
|
|
|
275
272
|
Requires-Dist: sphinx-tabs>=3.3.0; extra == "docs"
|
|
276
273
|
Requires-Dist: furo>=2022.3.4; extra == "docs"
|
|
277
274
|
Provides-Extra: dev
|
|
278
|
-
Requires-Dist: tensorflow<
|
|
279
|
-
Requires-Dist: tf2onnx<2.0.0,>=1.
|
|
275
|
+
Requires-Dist: tensorflow<2.16.0,>=2.11.0; extra == "dev"
|
|
276
|
+
Requires-Dist: tf2onnx<2.0.0,>=1.16.0; extra == "dev"
|
|
280
277
|
Requires-Dist: torch<3.0.0,>=1.12.0; extra == "dev"
|
|
281
278
|
Requires-Dist: torchvision>=0.13.0; extra == "dev"
|
|
282
279
|
Requires-Dist: onnx<3.0.0,>=1.12.0; extra == "dev"
|
|
@@ -286,11 +283,8 @@ Requires-Dist: hdf5storage>=0.1.18; extra == "dev"
|
|
|
286
283
|
Requires-Dist: onnxruntime>=1.11.0; extra == "dev"
|
|
287
284
|
Requires-Dist: requests>=2.20.0; extra == "dev"
|
|
288
285
|
Requires-Dist: psutil>=5.9.5; extra == "dev"
|
|
289
|
-
Requires-Dist: ruff>=0.
|
|
290
|
-
Requires-Dist: isort>=5.7.0; extra == "dev"
|
|
291
|
-
Requires-Dist: black>=22.1; extra == "dev"
|
|
286
|
+
Requires-Dist: ruff>=0.1.5; extra == "dev"
|
|
292
287
|
Requires-Dist: mypy>=0.812; extra == "dev"
|
|
293
|
-
Requires-Dist: pydocstyle[toml]>=6.1.1; extra == "dev"
|
|
294
288
|
Requires-Dist: pre-commit>=2.17.0; extra == "dev"
|
|
295
289
|
Requires-Dist: sphinx!=3.5.0,>=3.0.0; extra == "dev"
|
|
296
290
|
Requires-Dist: sphinxemoji>=0.1.8; extra == "dev"
|
|
@@ -302,10 +296,11 @@ Requires-Dist: sphinx-tabs>=3.3.0; extra == "dev"
|
|
|
302
296
|
Requires-Dist: furo>=2022.3.4; extra == "dev"
|
|
303
297
|
|
|
304
298
|
<p align="center">
|
|
305
|
-
<img src="https://github.com/mindee/doctr/
|
|
299
|
+
<img src="https://github.com/mindee/doctr/raw/main/docs/images/Logo_doctr.gif" width="40%">
|
|
306
300
|
</p>
|
|
307
301
|
|
|
308
|
-
[](https://slack.mindee.com) [](LICENSE)  [](https://codecov.io/gh/mindee/doctr) [](https://www.codefactor.io/repository/github/mindee/doctr) [](https://app.codacy.com/gh/mindee/doctr?utm_source=github.com&utm_medium=referral&utm_content=mindee/doctr&utm_campaign=Badge_Grade) [](https://mindee.github.io/doctr) [](https://slack.mindee.com) [](LICENSE)  [](https://github.com/mindee/doctr/pkgs/container/doctr) [](https://codecov.io/gh/mindee/doctr) [](https://www.codefactor.io/repository/github/mindee/doctr) [](https://app.codacy.com/gh/mindee/doctr?utm_source=github.com&utm_medium=referral&utm_content=mindee/doctr&utm_campaign=Badge_Grade) [](https://mindee.github.io/doctr) [](https://pypi.org/project/python-doctr/) [](https://huggingface.co/spaces/mindee/doctr) [](https://colab.research.google.com/github/mindee/notebooks/blob/main/doctr/quicktour.ipynb)
|
|
303
|
+
|
|
309
304
|
|
|
310
305
|
**Optical Character Recognition made seamless & accessible to anyone, powered by TensorFlow 2 & PyTorch**
|
|
311
306
|
|
|
@@ -314,7 +309,7 @@ What you can expect from this repository:
|
|
|
314
309
|
- efficient ways to parse textual information (localize and identify each word) from your documents
|
|
315
310
|
- guidance on how to integrate this in your current architecture
|
|
316
311
|
|
|
317
|
-

|
|
318
313
|
|
|
319
314
|
## Quick Tour
|
|
320
315
|
|
|
@@ -377,10 +372,10 @@ If both options are set to False, the predictor will always fit and return rotat
|
|
|
377
372
|
To interpret your model's predictions, you can visualize them interactively as follows:
|
|
378
373
|
|
|
379
374
|
```python
|
|
380
|
-
result.show(
|
|
375
|
+
result.show()
|
|
381
376
|
```
|
|
382
377
|
|
|
383
|
-

|
|
384
379
|
|
|
385
380
|
Or even rebuild the original document from its predictions:
|
|
386
381
|
|
|
@@ -391,7 +386,7 @@ synthetic_pages = result.synthesize()
|
|
|
391
386
|
plt.imshow(synthetic_pages[0]); plt.axis('off'); plt.show()
|
|
392
387
|
```
|
|
393
388
|
|
|
394
|
-

|
|
395
390
|
|
|
396
391
|
The `ocr_predictor` returns a `Document` object with a nested structure (with `Page`, `Block`, `Line`, `Word`, `Artefact`).
|
|
397
392
|
To get a better understanding of our document model, check our [documentation](https://mindee.github.io/doctr/modules/io.html#document-structure):
|
|
@@ -404,7 +399,7 @@ json_output = result.export()
|
|
|
404
399
|
|
|
405
400
|
### Use the KIE predictor
|
|
406
401
|
|
|
407
|
-
The KIE predictor is a more flexible predictor compared to OCR as your detection model can detect multiple classes in a document. For example, you can have a detection model to detect just dates and
|
|
402
|
+
The KIE predictor is a more flexible predictor compared to OCR as your detection model can detect multiple classes in a document. For example, you can have a detection model to detect just dates and addresses in a document.
|
|
408
403
|
|
|
409
404
|
The KIE predictor makes it possible to use detector with multiple classes with a recognition model and to have the whole pipeline already setup for you.
|
|
410
405
|
|
|
@@ -430,7 +425,7 @@ The KIE predictor results per page are in a dictionary format with each key repr
|
|
|
430
425
|
|
|
431
426
|
### If you are looking for support from the Mindee team
|
|
432
427
|
|
|
433
|
-
[](https://mindee.com/product/doctr)
|
|
434
429
|
|
|
435
430
|
## Installation
|
|
436
431
|
|
|
@@ -438,7 +433,7 @@ The KIE predictor results per page are in a dictionary format with each key repr
|
|
|
438
433
|
|
|
439
434
|
Python 3.8 (or higher) and [pip](https://pip.pypa.io/en/stable/) are required to install docTR.
|
|
440
435
|
|
|
441
|
-
Since we use [weasyprint](https://weasyprint.
|
|
436
|
+
Since we use [weasyprint](https://weasyprint.org/), you will need extra dependencies if you are not running Linux.
|
|
442
437
|
|
|
443
438
|
For MacOS users, you can install them as follows:
|
|
444
439
|
|
|
@@ -499,6 +494,7 @@ Credits where it's due: this repository is implementing, among others, architect
|
|
|
499
494
|
|
|
500
495
|
- DBNet: [Real-time Scene Text Detection with Differentiable Binarization](https://arxiv.org/pdf/1911.08947.pdf).
|
|
501
496
|
- LinkNet: [LinkNet: Exploiting Encoder Representations for Efficient Semantic Segmentation](https://arxiv.org/pdf/1707.03718.pdf)
|
|
497
|
+
- FAST: [FAST: Faster Arbitrarily-Shaped Text Detector with Minimalist Kernel Representation](https://arxiv.org/pdf/2111.02394.pdf)
|
|
502
498
|
|
|
503
499
|
### Text Recognition
|
|
504
500
|
|
|
@@ -518,7 +514,7 @@ The full package documentation is available [here](https://mindee.github.io/doct
|
|
|
518
514
|
|
|
519
515
|
A minimal demo app is provided for you to play with our end-to-end OCR models!
|
|
520
516
|
|
|
521
|
-

|
|
522
518
|
|
|
523
519
|
#### Live demo
|
|
524
520
|
|
|
@@ -558,14 +554,54 @@ USE_TORCH=1 streamlit run demo/app.py
|
|
|
558
554
|
Instead of having your demo actually running Python, you would prefer to run everything in your web browser?
|
|
559
555
|
Check out our [TensorFlow.js demo](https://github.com/mindee/doctr-tfjs-demo) to get started!
|
|
560
556
|
|
|
561
|
-

|
|
562
558
|
|
|
563
559
|
### Docker container
|
|
564
560
|
|
|
565
|
-
|
|
561
|
+
[We offer Docker container support for easy testing and deployment](https://github.com/mindee/doctr/pkgs/container/doctr).
|
|
562
|
+
|
|
563
|
+
#### Using GPU with docTR Docker Images
|
|
564
|
+
|
|
565
|
+
The docTR Docker images are GPU-ready and based on CUDA `11.8`.
|
|
566
|
+
However, to use GPU support with these Docker images, please ensure that Docker is configured to use your GPU.
|
|
567
|
+
|
|
568
|
+
To verify and configure GPU support for Docker, please follow the instructions provided in the [NVIDIA Container Toolkit Installation Guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html).
|
|
569
|
+
|
|
570
|
+
Once Docker is configured to use GPUs, you can run docTR Docker containers with GPU support:
|
|
571
|
+
|
|
572
|
+
```shell
|
|
573
|
+
docker run -it --gpus all ghcr.io/mindee/doctr:tf-py3.8.18-gpu-2023-09 bash
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
#### Available Tags
|
|
577
|
+
|
|
578
|
+
The Docker images for docTR follow a specific tag nomenclature: `<framework>-py<python_version>-<system>-<doctr_version|YYYY-MM>`. Here's a breakdown of the tag structure:
|
|
579
|
+
|
|
580
|
+
- `<framework>`: `tf` (TensorFlow) or `torch` (PyTorch).
|
|
581
|
+
- `<python_version>`: `3.8.18`, `3.9.18`, or `3.10.13`.
|
|
582
|
+
- `<system>`: `cpu` or `gpu`
|
|
583
|
+
- `<doctr_version>`: a tag >= `v0.7.1`
|
|
584
|
+
- `<YYYY-MM>`: e.g. `2023-09`
|
|
585
|
+
|
|
586
|
+
Here are examples of different image tags:
|
|
587
|
+
|
|
588
|
+
| Tag | Description |
|
|
589
|
+
|----------------------------|---------------------------------------------------|
|
|
590
|
+
| `tf-py3.8.18-cpu-v0.7.1` | TensorFlow version `3.8.18` with docTR `v0.7.1`. |
|
|
591
|
+
| `torch-py3.9.18-gpu-2023-09`| PyTorch version `3.9.18` with GPU support and a monthly build from `2023-09`. |
|
|
592
|
+
|
|
593
|
+
#### Building Docker Images Locally
|
|
594
|
+
|
|
595
|
+
You can also build docTR Docker images locally on your computer.
|
|
596
|
+
|
|
597
|
+
```shell
|
|
598
|
+
docker build -t doctr .
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
You can specify custom Python versions and docTR versions using build arguments. For example, to build a docTR image with TensorFlow, Python version `3.9.10`, and docTR version `v0.7.0`, run the following command:
|
|
566
602
|
|
|
567
603
|
```shell
|
|
568
|
-
docker build . -
|
|
604
|
+
docker build -t doctr --build-arg FRAMEWORK=tf --build-arg PYTHON_VERSION=3.9.10 --build-arg DOCTR_VERSION=v0.7.0 .
|
|
569
605
|
```
|
|
570
606
|
|
|
571
607
|
### Example script
|
|
@@ -638,8 +674,8 @@ If you wish to cite this project, feel free to use this [BibTeX](http://www.bibt
|
|
|
638
674
|
|
|
639
675
|
If you scrolled down to this section, you most likely appreciate open source. Do you feel like extending the range of our supported characters? Or perhaps submitting a paper implementation? Or contributing in any other way?
|
|
640
676
|
|
|
641
|
-
You're in luck, we compiled a short guide (cf. [`CONTRIBUTING`](
|
|
677
|
+
You're in luck, we compiled a short guide (cf. [`CONTRIBUTING`](https://mindee.github.io/doctr/contributing/contributing.html)) for you to easily do so!
|
|
642
678
|
|
|
643
679
|
## License
|
|
644
680
|
|
|
645
|
-
Distributed under the Apache 2.0 License. See [`LICENSE`](
|
|
681
|
+
Distributed under the Apache 2.0 License. See [`LICENSE`](https://github.com/mindee/doctr?tab=Apache-2.0-1-ov-file#readme) for more information.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://github.com/mindee/doctr/
|
|
2
|
+
<img src="https://github.com/mindee/doctr/raw/main/docs/images/Logo_doctr.gif" width="40%">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
[](https://slack.mindee.com) [](LICENSE)  [](https://codecov.io/gh/mindee/doctr) [](https://www.codefactor.io/repository/github/mindee/doctr) [](https://app.codacy.com/gh/mindee/doctr?utm_source=github.com&utm_medium=referral&utm_content=mindee/doctr&utm_campaign=Badge_Grade) [](https://mindee.github.io/doctr) [](https://slack.mindee.com) [](LICENSE)  [](https://github.com/mindee/doctr/pkgs/container/doctr) [](https://codecov.io/gh/mindee/doctr) [](https://www.codefactor.io/repository/github/mindee/doctr) [](https://app.codacy.com/gh/mindee/doctr?utm_source=github.com&utm_medium=referral&utm_content=mindee/doctr&utm_campaign=Badge_Grade) [](https://mindee.github.io/doctr) [](https://pypi.org/project/python-doctr/) [](https://huggingface.co/spaces/mindee/doctr) [](https://colab.research.google.com/github/mindee/notebooks/blob/main/doctr/quicktour.ipynb)
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
**Optical Character Recognition made seamless & accessible to anyone, powered by TensorFlow 2 & PyTorch**
|
|
8
9
|
|
|
@@ -11,7 +12,7 @@ What you can expect from this repository:
|
|
|
11
12
|
- efficient ways to parse textual information (localize and identify each word) from your documents
|
|
12
13
|
- guidance on how to integrate this in your current architecture
|
|
13
14
|
|
|
14
|
-

|
|
15
16
|
|
|
16
17
|
## Quick Tour
|
|
17
18
|
|
|
@@ -74,10 +75,10 @@ If both options are set to False, the predictor will always fit and return rotat
|
|
|
74
75
|
To interpret your model's predictions, you can visualize them interactively as follows:
|
|
75
76
|
|
|
76
77
|
```python
|
|
77
|
-
result.show(
|
|
78
|
+
result.show()
|
|
78
79
|
```
|
|
79
80
|
|
|
80
|
-

|
|
81
82
|
|
|
82
83
|
Or even rebuild the original document from its predictions:
|
|
83
84
|
|
|
@@ -88,7 +89,7 @@ synthetic_pages = result.synthesize()
|
|
|
88
89
|
plt.imshow(synthetic_pages[0]); plt.axis('off'); plt.show()
|
|
89
90
|
```
|
|
90
91
|
|
|
91
|
-

|
|
92
93
|
|
|
93
94
|
The `ocr_predictor` returns a `Document` object with a nested structure (with `Page`, `Block`, `Line`, `Word`, `Artefact`).
|
|
94
95
|
To get a better understanding of our document model, check our [documentation](https://mindee.github.io/doctr/modules/io.html#document-structure):
|
|
@@ -101,7 +102,7 @@ json_output = result.export()
|
|
|
101
102
|
|
|
102
103
|
### Use the KIE predictor
|
|
103
104
|
|
|
104
|
-
The KIE predictor is a more flexible predictor compared to OCR as your detection model can detect multiple classes in a document. For example, you can have a detection model to detect just dates and
|
|
105
|
+
The KIE predictor is a more flexible predictor compared to OCR as your detection model can detect multiple classes in a document. For example, you can have a detection model to detect just dates and addresses in a document.
|
|
105
106
|
|
|
106
107
|
The KIE predictor makes it possible to use detector with multiple classes with a recognition model and to have the whole pipeline already setup for you.
|
|
107
108
|
|
|
@@ -127,7 +128,7 @@ The KIE predictor results per page are in a dictionary format with each key repr
|
|
|
127
128
|
|
|
128
129
|
### If you are looking for support from the Mindee team
|
|
129
130
|
|
|
130
|
-
[](https://mindee.com/product/doctr)
|
|
131
132
|
|
|
132
133
|
## Installation
|
|
133
134
|
|
|
@@ -135,7 +136,7 @@ The KIE predictor results per page are in a dictionary format with each key repr
|
|
|
135
136
|
|
|
136
137
|
Python 3.8 (or higher) and [pip](https://pip.pypa.io/en/stable/) are required to install docTR.
|
|
137
138
|
|
|
138
|
-
Since we use [weasyprint](https://weasyprint.
|
|
139
|
+
Since we use [weasyprint](https://weasyprint.org/), you will need extra dependencies if you are not running Linux.
|
|
139
140
|
|
|
140
141
|
For MacOS users, you can install them as follows:
|
|
141
142
|
|
|
@@ -196,6 +197,7 @@ Credits where it's due: this repository is implementing, among others, architect
|
|
|
196
197
|
|
|
197
198
|
- DBNet: [Real-time Scene Text Detection with Differentiable Binarization](https://arxiv.org/pdf/1911.08947.pdf).
|
|
198
199
|
- LinkNet: [LinkNet: Exploiting Encoder Representations for Efficient Semantic Segmentation](https://arxiv.org/pdf/1707.03718.pdf)
|
|
200
|
+
- FAST: [FAST: Faster Arbitrarily-Shaped Text Detector with Minimalist Kernel Representation](https://arxiv.org/pdf/2111.02394.pdf)
|
|
199
201
|
|
|
200
202
|
### Text Recognition
|
|
201
203
|
|
|
@@ -215,7 +217,7 @@ The full package documentation is available [here](https://mindee.github.io/doct
|
|
|
215
217
|
|
|
216
218
|
A minimal demo app is provided for you to play with our end-to-end OCR models!
|
|
217
219
|
|
|
218
|
-

|
|
219
221
|
|
|
220
222
|
#### Live demo
|
|
221
223
|
|
|
@@ -255,14 +257,54 @@ USE_TORCH=1 streamlit run demo/app.py
|
|
|
255
257
|
Instead of having your demo actually running Python, you would prefer to run everything in your web browser?
|
|
256
258
|
Check out our [TensorFlow.js demo](https://github.com/mindee/doctr-tfjs-demo) to get started!
|
|
257
259
|
|
|
258
|
-

|
|
259
261
|
|
|
260
262
|
### Docker container
|
|
261
263
|
|
|
262
|
-
|
|
264
|
+
[We offer Docker container support for easy testing and deployment](https://github.com/mindee/doctr/pkgs/container/doctr).
|
|
265
|
+
|
|
266
|
+
#### Using GPU with docTR Docker Images
|
|
267
|
+
|
|
268
|
+
The docTR Docker images are GPU-ready and based on CUDA `11.8`.
|
|
269
|
+
However, to use GPU support with these Docker images, please ensure that Docker is configured to use your GPU.
|
|
270
|
+
|
|
271
|
+
To verify and configure GPU support for Docker, please follow the instructions provided in the [NVIDIA Container Toolkit Installation Guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html).
|
|
272
|
+
|
|
273
|
+
Once Docker is configured to use GPUs, you can run docTR Docker containers with GPU support:
|
|
274
|
+
|
|
275
|
+
```shell
|
|
276
|
+
docker run -it --gpus all ghcr.io/mindee/doctr:tf-py3.8.18-gpu-2023-09 bash
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
#### Available Tags
|
|
280
|
+
|
|
281
|
+
The Docker images for docTR follow a specific tag nomenclature: `<framework>-py<python_version>-<system>-<doctr_version|YYYY-MM>`. Here's a breakdown of the tag structure:
|
|
282
|
+
|
|
283
|
+
- `<framework>`: `tf` (TensorFlow) or `torch` (PyTorch).
|
|
284
|
+
- `<python_version>`: `3.8.18`, `3.9.18`, or `3.10.13`.
|
|
285
|
+
- `<system>`: `cpu` or `gpu`
|
|
286
|
+
- `<doctr_version>`: a tag >= `v0.7.1`
|
|
287
|
+
- `<YYYY-MM>`: e.g. `2023-09`
|
|
288
|
+
|
|
289
|
+
Here are examples of different image tags:
|
|
290
|
+
|
|
291
|
+
| Tag | Description |
|
|
292
|
+
|----------------------------|---------------------------------------------------|
|
|
293
|
+
| `tf-py3.8.18-cpu-v0.7.1` | TensorFlow version `3.8.18` with docTR `v0.7.1`. |
|
|
294
|
+
| `torch-py3.9.18-gpu-2023-09`| PyTorch version `3.9.18` with GPU support and a monthly build from `2023-09`. |
|
|
295
|
+
|
|
296
|
+
#### Building Docker Images Locally
|
|
297
|
+
|
|
298
|
+
You can also build docTR Docker images locally on your computer.
|
|
299
|
+
|
|
300
|
+
```shell
|
|
301
|
+
docker build -t doctr .
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
You can specify custom Python versions and docTR versions using build arguments. For example, to build a docTR image with TensorFlow, Python version `3.9.10`, and docTR version `v0.7.0`, run the following command:
|
|
263
305
|
|
|
264
306
|
```shell
|
|
265
|
-
docker build . -
|
|
307
|
+
docker build -t doctr --build-arg FRAMEWORK=tf --build-arg PYTHON_VERSION=3.9.10 --build-arg DOCTR_VERSION=v0.7.0 .
|
|
266
308
|
```
|
|
267
309
|
|
|
268
310
|
### Example script
|
|
@@ -335,8 +377,8 @@ If you wish to cite this project, feel free to use this [BibTeX](http://www.bibt
|
|
|
335
377
|
|
|
336
378
|
If you scrolled down to this section, you most likely appreciate open source. Do you feel like extending the range of our supported characters? Or perhaps submitting a paper implementation? Or contributing in any other way?
|
|
337
379
|
|
|
338
|
-
You're in luck, we compiled a short guide (cf. [`CONTRIBUTING`](
|
|
380
|
+
You're in luck, we compiled a short guide (cf. [`CONTRIBUTING`](https://mindee.github.io/doctr/contributing/contributing.html)) for you to easily do so!
|
|
339
381
|
|
|
340
382
|
## License
|
|
341
383
|
|
|
342
|
-
Distributed under the Apache 2.0 License. See [`LICENSE`](
|
|
384
|
+
Distributed under the Apache 2.0 License. See [`LICENSE`](https://github.com/mindee/doctr?tab=Apache-2.0-1-ov-file#readme) for more information.
|
|
@@ -13,12 +13,14 @@ from .imgur5k import *
|
|
|
13
13
|
from .mjsynth import *
|
|
14
14
|
from .ocr import *
|
|
15
15
|
from .recognition import *
|
|
16
|
+
from .orientation import *
|
|
16
17
|
from .sroie import *
|
|
17
18
|
from .svhn import *
|
|
18
19
|
from .svt import *
|
|
19
20
|
from .synthtext import *
|
|
20
21
|
from .utils import *
|
|
21
22
|
from .vocabs import *
|
|
23
|
+
from .wildreceipt import *
|
|
22
24
|
|
|
23
25
|
if is_tf_available():
|
|
24
26
|
from .loader import *
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2024, Mindee.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -29,6 +29,7 @@ class CORD(VisionDataset):
|
|
|
29
29
|
>>> img, target = train_set[0]
|
|
30
30
|
|
|
31
31
|
Args:
|
|
32
|
+
----
|
|
32
33
|
train: whether the subset should be the training one
|
|
33
34
|
use_polygons: whether polygons should be considered as rotated bounding box (instead of straight ones)
|
|
34
35
|
recognition_task: whether the dataset should be used for recognition task
|
|
@@ -109,9 +110,10 @@ class CORD(VisionDataset):
|
|
|
109
110
|
for crop, label in zip(crops, list(text_targets)):
|
|
110
111
|
self.data.append((crop, label))
|
|
111
112
|
else:
|
|
112
|
-
self.data.append(
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
self.data.append((
|
|
114
|
+
img_path,
|
|
115
|
+
dict(boxes=np.asarray(box_targets, dtype=int).clip(min=0), labels=list(text_targets)),
|
|
116
|
+
))
|
|
115
117
|
|
|
116
118
|
self.root = tmp_root
|
|
117
119
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2024, Mindee.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -59,7 +59,7 @@ class _AbstractDataset:
|
|
|
59
59
|
# Conditions to assess it is detection model with multiple classes and avoid confusion with other tasks.
|
|
60
60
|
if (
|
|
61
61
|
isinstance(target, dict)
|
|
62
|
-
and all(
|
|
62
|
+
and all(isinstance(item, np.ndarray) for item in target.values())
|
|
63
63
|
and set(target.keys()) != {"boxes", "labels"} # avoid confusion with obj detection target
|
|
64
64
|
):
|
|
65
65
|
img_transformed = _copy_tensor(img)
|
|
@@ -82,6 +82,7 @@ class _VisionDataset(_AbstractDataset):
|
|
|
82
82
|
"""Implements an abstract dataset
|
|
83
83
|
|
|
84
84
|
Args:
|
|
85
|
+
----
|
|
85
86
|
url: URL of the dataset
|
|
86
87
|
file_name: name of the file once downloaded
|
|
87
88
|
file_hash: expected SHA256 of the file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2024, Mindee.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -18,6 +18,8 @@ __all__ = ["AbstractDataset", "VisionDataset"]
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class AbstractDataset(_AbstractDataset):
|
|
21
|
+
"""Abstract class for all datasets"""
|
|
22
|
+
|
|
21
23
|
def _read_sample(self, index: int) -> Tuple[torch.Tensor, Any]:
|
|
22
24
|
img_name, target = self.data[index]
|
|
23
25
|
|
|
@@ -53,5 +55,5 @@ class AbstractDataset(_AbstractDataset):
|
|
|
53
55
|
return images, list(targets)
|
|
54
56
|
|
|
55
57
|
|
|
56
|
-
class VisionDataset(AbstractDataset, _VisionDataset):
|
|
58
|
+
class VisionDataset(AbstractDataset, _VisionDataset): # noqa: D101
|
|
57
59
|
pass
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2024, Mindee.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -18,6 +18,8 @@ __all__ = ["AbstractDataset", "VisionDataset"]
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class AbstractDataset(_AbstractDataset):
|
|
21
|
+
"""Abstract class for all datasets"""
|
|
22
|
+
|
|
21
23
|
def _read_sample(self, index: int) -> Tuple[tf.Tensor, Any]:
|
|
22
24
|
img_name, target = self.data[index]
|
|
23
25
|
|
|
@@ -53,5 +55,5 @@ class AbstractDataset(_AbstractDataset):
|
|
|
53
55
|
return images, list(targets)
|
|
54
56
|
|
|
55
57
|
|
|
56
|
-
class VisionDataset(AbstractDataset, _VisionDataset):
|
|
58
|
+
class VisionDataset(AbstractDataset, _VisionDataset): # noqa: D101
|
|
57
59
|
pass
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2024, Mindee.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -26,6 +26,7 @@ class DetectionDataset(AbstractDataset):
|
|
|
26
26
|
>>> img, target = train_set[0]
|
|
27
27
|
|
|
28
28
|
Args:
|
|
29
|
+
----
|
|
29
30
|
img_folder: folder with all the images of the dataset
|
|
30
31
|
label_path: path to the annotations of each image
|
|
31
32
|
use_polygons: whether polygons should be considered as rotated bounding box (instead of straight ones)
|
|
@@ -66,14 +67,16 @@ class DetectionDataset(AbstractDataset):
|
|
|
66
67
|
def format_polygons(
|
|
67
68
|
self, polygons: Union[List, Dict], use_polygons: bool, np_dtype: Type
|
|
68
69
|
) -> Tuple[np.ndarray, List[str]]:
|
|
69
|
-
"""
|
|
70
|
+
"""Format polygons into an array
|
|
70
71
|
|
|
71
72
|
Args:
|
|
73
|
+
----
|
|
72
74
|
polygons: the bounding boxes
|
|
73
75
|
use_polygons: whether polygons should be considered as rotated bounding box (instead of straight ones)
|
|
74
76
|
np_dtype: dtype of array
|
|
75
77
|
|
|
76
78
|
Returns:
|
|
79
|
+
-------
|
|
77
80
|
geoms: bounding boxes as np array
|
|
78
81
|
polygons_classes: list of classes for each bounding box
|
|
79
82
|
"""
|
|
@@ -92,4 +95,4 @@ class DetectionDataset(AbstractDataset):
|
|
|
92
95
|
|
|
93
96
|
@property
|
|
94
97
|
def class_names(self):
|
|
95
|
-
return sorted(
|
|
98
|
+
return sorted(set(self._class_names))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2024, Mindee.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -26,6 +26,7 @@ class DocArtefacts(VisionDataset):
|
|
|
26
26
|
>>> img, target = train_set[0]
|
|
27
27
|
|
|
28
28
|
Args:
|
|
29
|
+
----
|
|
29
30
|
train: whether the subset should be the training one
|
|
30
31
|
use_polygons: whether polygons should be considered as rotated bounding box (instead of straight ones)
|
|
31
32
|
**kwargs: keyword arguments from `VisionDataset`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2024, Mindee.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -29,6 +29,7 @@ class FUNSD(VisionDataset):
|
|
|
29
29
|
>>> img, target = train_set[0]
|
|
30
30
|
|
|
31
31
|
Args:
|
|
32
|
+
----
|
|
32
33
|
train: whether the subset should be the training one
|
|
33
34
|
use_polygons: whether polygons should be considered as rotated bounding box (instead of straight ones)
|
|
34
35
|
recognition_task: whether the dataset should be used for recognition task
|
|
@@ -81,7 +82,7 @@ class FUNSD(VisionDataset):
|
|
|
81
82
|
text_targets, box_targets = zip(*_targets)
|
|
82
83
|
if use_polygons:
|
|
83
84
|
# xmin, ymin, xmax, ymax -> (x, y) coordinates of top left, top right, bottom right, bottom left corners
|
|
84
|
-
box_targets = [
|
|
85
|
+
box_targets = [ # type: ignore[assignment]
|
|
85
86
|
[
|
|
86
87
|
[box[0], box[1]],
|
|
87
88
|
[box[2], box[1]],
|
|
@@ -100,12 +101,10 @@ class FUNSD(VisionDataset):
|
|
|
100
101
|
if not any(char in label for char in ["☑", "☐", "\uf703", "\uf702"]):
|
|
101
102
|
self.data.append((crop, label))
|
|
102
103
|
else:
|
|
103
|
-
self.data.append(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
)
|
|
108
|
-
)
|
|
104
|
+
self.data.append((
|
|
105
|
+
img_path,
|
|
106
|
+
dict(boxes=np.asarray(box_targets, dtype=np_dtype), labels=list(text_targets)),
|
|
107
|
+
))
|
|
109
108
|
|
|
110
109
|
self.root = tmp_root
|
|
111
110
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2024, Mindee.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -24,6 +24,7 @@ def synthesize_text_img(
|
|
|
24
24
|
"""Generate a synthetic text image
|
|
25
25
|
|
|
26
26
|
Args:
|
|
27
|
+
----
|
|
27
28
|
text: the text to render as an image
|
|
28
29
|
font_size: the size of the font
|
|
29
30
|
font_family: the font family (has to be installed on your system)
|
|
@@ -31,9 +32,9 @@ def synthesize_text_img(
|
|
|
31
32
|
text_color: text color on the final image
|
|
32
33
|
|
|
33
34
|
Returns:
|
|
35
|
+
-------
|
|
34
36
|
PIL image of the text
|
|
35
37
|
"""
|
|
36
|
-
|
|
37
38
|
background_color = (0, 0, 0) if background_color is None else background_color
|
|
38
39
|
text_color = (255, 255, 255) if text_color is None else text_color
|
|
39
40
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2021-
|
|
1
|
+
# Copyright (C) 2021-2024, Mindee.
|
|
2
2
|
|
|
3
3
|
# This program is licensed under the Apache License 2.0.
|
|
4
4
|
# See LICENSE or go to <https://opensource.org/licenses/Apache-2.0> for full license details.
|
|
@@ -18,6 +18,7 @@ class CharacterGenerator(_CharacterGenerator):
|
|
|
18
18
|
>>> img, target = ds[0]
|
|
19
19
|
|
|
20
20
|
Args:
|
|
21
|
+
----
|
|
21
22
|
vocab: vocabulary to take the character from
|
|
22
23
|
num_samples: number of samples that will be generated iterating over the dataset
|
|
23
24
|
cache_samples: whether generated images should be cached firsthand
|
|
@@ -39,6 +40,7 @@ class WordGenerator(_WordGenerator):
|
|
|
39
40
|
>>> img, target = ds[0]
|
|
40
41
|
|
|
41
42
|
Args:
|
|
43
|
+
----
|
|
42
44
|
vocab: vocabulary to take the character from
|
|
43
45
|
min_chars: minimum number of characters in a word
|
|
44
46
|
max_chars: maximum number of characters in a word
|