python-doctr 1.0.1__py3-none-any.whl → 1.2.0__py3-none-any.whl

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.
Files changed (143) hide show
  1. doctr/cli/__init__.py +0 -0
  2. doctr/cli/main.py +669 -0
  3. doctr/datasets/__init__.py +2 -0
  4. doctr/datasets/coco_text.py +4 -2
  5. doctr/datasets/cord.py +2 -1
  6. doctr/datasets/datasets/base.py +12 -24
  7. doctr/datasets/datasets/pytorch.py +14 -4
  8. doctr/datasets/detection.py +14 -3
  9. doctr/datasets/doc_artefacts.py +2 -1
  10. doctr/datasets/funsd.py +2 -1
  11. doctr/datasets/generator/base.py +121 -37
  12. doctr/datasets/generator/pytorch.py +5 -6
  13. doctr/datasets/ic03.py +9 -7
  14. doctr/datasets/ic13.py +4 -2
  15. doctr/datasets/iiit5k.py +2 -1
  16. doctr/datasets/iiithws.py +4 -2
  17. doctr/datasets/imgur5k.py +4 -2
  18. doctr/datasets/layout.py +129 -0
  19. doctr/datasets/mjsynth.py +4 -2
  20. doctr/datasets/ocr.py +2 -1
  21. doctr/datasets/orientation.py +2 -1
  22. doctr/datasets/recognition.py +5 -4
  23. doctr/datasets/sroie.py +2 -1
  24. doctr/datasets/svhn.py +2 -1
  25. doctr/datasets/svt.py +10 -8
  26. doctr/datasets/synthtext.py +2 -1
  27. doctr/datasets/table_structure.py +97 -0
  28. doctr/datasets/utils.py +104 -21
  29. doctr/datasets/vocabs.py +320 -148
  30. doctr/datasets/wildreceipt.py +4 -2
  31. doctr/file_utils.py +3 -1
  32. doctr/io/__init__.py +3 -0
  33. doctr/io/elements.py +381 -271
  34. doctr/io/exporters.py +1915 -0
  35. doctr/io/figures.py +313 -0
  36. doctr/io/image/base.py +54 -7
  37. doctr/io/image/pytorch.py +13 -5
  38. doctr/io/pdf.py +6 -5
  39. doctr/io/reader.py +268 -18
  40. doctr/io/sources.py +636 -0
  41. doctr/models/__init__.py +3 -0
  42. doctr/models/_utils.py +206 -13
  43. doctr/models/builder.py +590 -137
  44. doctr/models/classification/__init__.py +3 -0
  45. doctr/models/classification/hgnetv2/__init__.py +1 -0
  46. doctr/models/classification/hgnetv2/pytorch.py +352 -0
  47. doctr/models/classification/magc_resnet/pytorch.py +1 -1
  48. doctr/models/classification/mobilenet/pytorch.py +6 -6
  49. doctr/models/classification/predictor/pytorch.py +34 -2
  50. doctr/models/classification/resnet/pytorch.py +5 -5
  51. doctr/models/classification/starnet/__init__.py +1 -0
  52. doctr/models/classification/starnet/pytorch.py +202 -0
  53. doctr/models/classification/textnet/pytorch.py +6 -5
  54. doctr/models/classification/vgg/pytorch.py +3 -2
  55. doctr/models/classification/vip/layers/pytorch.py +4 -4
  56. doctr/models/classification/vip/pytorch.py +4 -4
  57. doctr/models/classification/vit/pytorch.py +3 -3
  58. doctr/models/classification/vit_det/__init__.py +1 -0
  59. doctr/models/classification/vit_det/layers/__init__.py +1 -0
  60. doctr/models/classification/vit_det/layers/pytorch.py +215 -0
  61. doctr/models/classification/vit_det/pytorch.py +346 -0
  62. doctr/models/classification/zoo.py +14 -2
  63. doctr/models/detection/_utils/base.py +23 -7
  64. doctr/models/detection/core.py +32 -18
  65. doctr/models/detection/differentiable_binarization/base.py +23 -9
  66. doctr/models/detection/differentiable_binarization/pytorch.py +10 -4
  67. doctr/models/detection/fast/base.py +22 -6
  68. doctr/models/detection/fast/pytorch.py +24 -11
  69. doctr/models/detection/linknet/base.py +22 -6
  70. doctr/models/detection/linknet/pytorch.py +10 -3
  71. doctr/models/detection/predictor/pytorch.py +43 -2
  72. doctr/models/detection/zoo.py +6 -2
  73. doctr/models/factory/hub.py +59 -41
  74. doctr/models/formula/__init__.py +2 -0
  75. doctr/models/formula/formulanet/__init__.py +2 -0
  76. doctr/models/formula/formulanet/base.py +70 -0
  77. doctr/models/formula/formulanet/pytorch.py +587 -0
  78. doctr/models/formula/predictor/__init__.py +1 -0
  79. doctr/models/formula/predictor/pytorch.py +132 -0
  80. doctr/models/formula/zoo.py +102 -0
  81. doctr/models/kie_predictor/base.py +23 -1
  82. doctr/models/kie_predictor/pytorch.py +87 -15
  83. doctr/models/layout/__init__.py +2 -0
  84. doctr/models/layout/lw_detr/__init__.py +1 -0
  85. doctr/models/layout/lw_detr/base.py +309 -0
  86. doctr/models/layout/lw_detr/layers/__init__.py +1 -0
  87. doctr/models/layout/lw_detr/layers/pytorch.py +785 -0
  88. doctr/models/layout/lw_detr/pytorch.py +895 -0
  89. doctr/models/layout/predictor/__init__.py +1 -0
  90. doctr/models/layout/predictor/pytorch.py +114 -0
  91. doctr/models/layout/zoo.py +94 -0
  92. doctr/models/modules/layers/pytorch.py +139 -3
  93. doctr/models/modules/transformer/pytorch.py +151 -31
  94. doctr/models/predictor/base.py +415 -17
  95. doctr/models/predictor/pytorch.py +109 -12
  96. doctr/models/preprocessor/pytorch.py +82 -25
  97. doctr/models/reading_order/__init__.py +1 -0
  98. doctr/models/reading_order/base.py +1127 -0
  99. doctr/models/recognition/core.py +14 -1
  100. doctr/models/recognition/crnn/pytorch.py +40 -16
  101. doctr/models/recognition/master/base.py +4 -1
  102. doctr/models/recognition/master/pytorch.py +84 -22
  103. doctr/models/recognition/parseq/base.py +4 -1
  104. doctr/models/recognition/parseq/pytorch.py +126 -25
  105. doctr/models/recognition/predictor/_utils.py +131 -14
  106. doctr/models/recognition/predictor/pytorch.py +68 -12
  107. doctr/models/recognition/sar/pytorch.py +21 -7
  108. doctr/models/recognition/utils.py +80 -50
  109. doctr/models/recognition/viptr/pytorch.py +38 -14
  110. doctr/models/recognition/vitstr/base.py +4 -1
  111. doctr/models/recognition/vitstr/pytorch.py +11 -7
  112. doctr/models/recognition/zoo.py +36 -9
  113. doctr/models/table_structure/__init__.py +2 -0
  114. doctr/models/table_structure/grid.py +430 -0
  115. doctr/models/table_structure/predictor/__init__.py +1 -0
  116. doctr/models/table_structure/predictor/pytorch.py +231 -0
  117. doctr/models/table_structure/tablecenternet/__init__.py +2 -0
  118. doctr/models/table_structure/tablecenternet/base.py +675 -0
  119. doctr/models/table_structure/tablecenternet/pytorch.py +525 -0
  120. doctr/models/table_structure/zoo.py +87 -0
  121. doctr/models/utils/pytorch.py +381 -25
  122. doctr/models/zoo.py +141 -4
  123. doctr/transforms/functional/base.py +6 -0
  124. doctr/transforms/functional/pytorch.py +134 -6
  125. doctr/transforms/modules/base.py +261 -82
  126. doctr/transforms/modules/pytorch.py +396 -76
  127. doctr/utils/common_types.py +21 -1
  128. doctr/utils/data.py +24 -11
  129. doctr/utils/fonts.py +64 -17
  130. doctr/utils/geometry.py +167 -28
  131. doctr/utils/metrics.py +481 -19
  132. doctr/utils/multithreading.py +127 -4
  133. doctr/utils/reconstitution.py +696 -132
  134. doctr/utils/visualization.py +73 -10
  135. doctr/version.py +1 -1
  136. {python_doctr-1.0.1.dist-info → python_doctr-1.2.0.dist-info}/METADATA +119 -249
  137. python_doctr-1.2.0.dist-info/RECORD +191 -0
  138. {python_doctr-1.0.1.dist-info → python_doctr-1.2.0.dist-info}/WHEEL +1 -1
  139. python_doctr-1.2.0.dist-info/entry_points.txt +2 -0
  140. python_doctr-1.0.1.dist-info/RECORD +0 -149
  141. {python_doctr-1.0.1.dist-info → python_doctr-1.2.0.dist-info}/licenses/LICENSE +0 -0
  142. {python_doctr-1.0.1.dist-info → python_doctr-1.2.0.dist-info}/top_level.txt +0 -0
  143. {python_doctr-1.0.1.dist-info → python_doctr-1.2.0.dist-info}/zip-safe +0 -0
@@ -1,211 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-doctr
3
- Version: 1.0.1
3
+ Version: 1.2.0
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
7
- License: Apache License
8
- Version 2.0, January 2004
9
- http://www.apache.org/licenses/
10
-
11
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
12
-
13
- 1. Definitions.
14
-
15
- "License" shall mean the terms and conditions for use, reproduction,
16
- and distribution as defined by Sections 1 through 9 of this document.
17
-
18
- "Licensor" shall mean the copyright owner or entity authorized by
19
- the copyright owner that is granting the License.
20
-
21
- "Legal Entity" shall mean the union of the acting entity and all
22
- other entities that control, are controlled by, or are under common
23
- control with that entity. For the purposes of this definition,
24
- "control" means (i) the power, direct or indirect, to cause the
25
- direction or management of such entity, whether by contract or
26
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
27
- outstanding shares, or (iii) beneficial ownership of such entity.
28
-
29
- "You" (or "Your") shall mean an individual or Legal Entity
30
- exercising permissions granted by this License.
31
-
32
- "Source" form shall mean the preferred form for making modifications,
33
- including but not limited to software source code, documentation
34
- source, and configuration files.
35
-
36
- "Object" form shall mean any form resulting from mechanical
37
- transformation or translation of a Source form, including but
38
- not limited to compiled object code, generated documentation,
39
- and conversions to other media types.
40
-
41
- "Work" shall mean the work of authorship, whether in Source or
42
- Object form, made available under the License, as indicated by a
43
- copyright notice that is included in or attached to the work
44
- (an example is provided in the Appendix below).
45
-
46
- "Derivative Works" shall mean any work, whether in Source or Object
47
- form, that is based on (or derived from) the Work and for which the
48
- editorial revisions, annotations, elaborations, or other modifications
49
- represent, as a whole, an original work of authorship. For the purposes
50
- of this License, Derivative Works shall not include works that remain
51
- separable from, or merely link (or bind by name) to the interfaces of,
52
- the Work and Derivative Works thereof.
53
-
54
- "Contribution" shall mean any work of authorship, including
55
- the original version of the Work and any modifications or additions
56
- to that Work or Derivative Works thereof, that is intentionally
57
- submitted to Licensor for inclusion in the Work by the copyright owner
58
- or by an individual or Legal Entity authorized to submit on behalf of
59
- the copyright owner. For the purposes of this definition, "submitted"
60
- means any form of electronic, verbal, or written communication sent
61
- to the Licensor or its representatives, including but not limited to
62
- communication on electronic mailing lists, source code control systems,
63
- and issue tracking systems that are managed by, or on behalf of, the
64
- Licensor for the purpose of discussing and improving the Work, but
65
- excluding communication that is conspicuously marked or otherwise
66
- designated in writing by the copyright owner as "Not a Contribution."
67
-
68
- "Contributor" shall mean Licensor and any individual or Legal Entity
69
- on behalf of whom a Contribution has been received by Licensor and
70
- subsequently incorporated within the Work.
71
-
72
- 2. Grant of Copyright License. Subject to the terms and conditions of
73
- this License, each Contributor hereby grants to You a perpetual,
74
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
- copyright license to reproduce, prepare Derivative Works of,
76
- publicly display, publicly perform, sublicense, and distribute the
77
- Work and such Derivative Works in Source or Object form.
78
-
79
- 3. Grant of Patent License. Subject to the terms and conditions of
80
- this License, each Contributor hereby grants to You a perpetual,
81
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82
- (except as stated in this section) patent license to make, have made,
83
- use, offer to sell, sell, import, and otherwise transfer the Work,
84
- where such license applies only to those patent claims licensable
85
- by such Contributor that are necessarily infringed by their
86
- Contribution(s) alone or by combination of their Contribution(s)
87
- with the Work to which such Contribution(s) was submitted. If You
88
- institute patent litigation against any entity (including a
89
- cross-claim or counterclaim in a lawsuit) alleging that the Work
90
- or a Contribution incorporated within the Work constitutes direct
91
- or contributory patent infringement, then any patent licenses
92
- granted to You under this License for that Work shall terminate
93
- as of the date such litigation is filed.
94
-
95
- 4. Redistribution. You may reproduce and distribute copies of the
96
- Work or Derivative Works thereof in any medium, with or without
97
- modifications, and in Source or Object form, provided that You
98
- meet the following conditions:
99
-
100
- (a) You must give any other recipients of the Work or
101
- Derivative Works a copy of this License; and
102
-
103
- (b) You must cause any modified files to carry prominent notices
104
- stating that You changed the files; and
105
-
106
- (c) You must retain, in the Source form of any Derivative Works
107
- that You distribute, all copyright, patent, trademark, and
108
- attribution notices from the Source form of the Work,
109
- excluding those notices that do not pertain to any part of
110
- the Derivative Works; and
111
-
112
- (d) If the Work includes a "NOTICE" text file as part of its
113
- distribution, then any Derivative Works that You distribute must
114
- include a readable copy of the attribution notices contained
115
- within such NOTICE file, excluding those notices that do not
116
- pertain to any part of the Derivative Works, in at least one
117
- of the following places: within a NOTICE text file distributed
118
- as part of the Derivative Works; within the Source form or
119
- documentation, if provided along with the Derivative Works; or,
120
- within a display generated by the Derivative Works, if and
121
- wherever such third-party notices normally appear. The contents
122
- of the NOTICE file are for informational purposes only and
123
- do not modify the License. You may add Your own attribution
124
- notices within Derivative Works that You distribute, alongside
125
- or as an addendum to the NOTICE text from the Work, provided
126
- that such additional attribution notices cannot be construed
127
- as modifying the License.
128
-
129
- You may add Your own copyright statement to Your modifications and
130
- may provide additional or different license terms and conditions
131
- for use, reproduction, or distribution of Your modifications, or
132
- for any such Derivative Works as a whole, provided Your use,
133
- reproduction, and distribution of the Work otherwise complies with
134
- the conditions stated in this License.
135
-
136
- 5. Submission of Contributions. Unless You explicitly state otherwise,
137
- any Contribution intentionally submitted for inclusion in the Work
138
- by You to the Licensor shall be under the terms and conditions of
139
- this License, without any additional terms or conditions.
140
- Notwithstanding the above, nothing herein shall supersede or modify
141
- the terms of any separate license agreement you may have executed
142
- with Licensor regarding such Contributions.
143
-
144
- 6. Trademarks. This License does not grant permission to use the trade
145
- names, trademarks, service marks, or product names of the Licensor,
146
- except as required for reasonable and customary use in describing the
147
- origin of the Work and reproducing the content of the NOTICE file.
148
-
149
- 7. Disclaimer of Warranty. Unless required by applicable law or
150
- agreed to in writing, Licensor provides the Work (and each
151
- Contributor provides its Contributions) on an "AS IS" BASIS,
152
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
153
- implied, including, without limitation, any warranties or conditions
154
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
155
- PARTICULAR PURPOSE. You are solely responsible for determining the
156
- appropriateness of using or redistributing the Work and assume any
157
- risks associated with Your exercise of permissions under this License.
158
-
159
- 8. Limitation of Liability. In no event and under no legal theory,
160
- whether in tort (including negligence), contract, or otherwise,
161
- unless required by applicable law (such as deliberate and grossly
162
- negligent acts) or agreed to in writing, shall any Contributor be
163
- liable to You for damages, including any direct, indirect, special,
164
- incidental, or consequential damages of any character arising as a
165
- result of this License or out of the use or inability to use the
166
- Work (including but not limited to damages for loss of goodwill,
167
- work stoppage, computer failure or malfunction, or any and all
168
- other commercial damages or losses), even if such Contributor
169
- has been advised of the possibility of such damages.
170
-
171
- 9. Accepting Warranty or Additional Liability. While redistributing
172
- the Work or Derivative Works thereof, You may choose to offer,
173
- and charge a fee for, acceptance of support, warranty, indemnity,
174
- or other liability obligations and/or rights consistent with this
175
- License. However, in accepting such obligations, You may act only
176
- on Your own behalf and on Your sole responsibility, not on behalf
177
- of any other Contributor, and only if You agree to indemnify,
178
- defend, and hold each Contributor harmless for any liability
179
- incurred by, or claims asserted against, such Contributor by reason
180
- of your accepting any such warranty or additional liability.
181
-
182
- END OF TERMS AND CONDITIONS
183
-
184
- APPENDIX: How to apply the Apache License to your work.
185
-
186
- To apply the Apache License to your work, attach the following
187
- boilerplate notice, with the fields enclosed by brackets "[]"
188
- replaced with your own identifying information. (Don't include
189
- the brackets!) The text should be enclosed in the appropriate
190
- comment syntax for the file format. We also recommend that a
191
- file or class name and description of purpose be included on the
192
- same "printed page" as the copyright notice for easier
193
- identification within third-party archives.
194
-
195
- Copyright 2022 Mindee
196
-
197
- Licensed under the Apache License, Version 2.0 (the "License");
198
- you may not use this file except in compliance with the License.
199
- You may obtain a copy of the License at
200
-
201
- http://www.apache.org/licenses/LICENSE-2.0
202
-
203
- Unless required by applicable law or agreed to in writing, software
204
- distributed under the License is distributed on an "AS IS" BASIS,
205
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
206
- See the License for the specific language governing permissions and
207
- limitations under the License.
208
-
7
+ License-Expression: Apache-2.0
209
8
  Project-URL: documentation, https://mindee.github.io/doctr
210
9
  Project-URL: repository, https://github.com/mindee/doctr
211
10
  Project-URL: tracker, https://github.com/mindee/doctr/issues
@@ -215,32 +14,31 @@ Classifier: Development Status :: 4 - Beta
215
14
  Classifier: Intended Audience :: Developers
216
15
  Classifier: Intended Audience :: Education
217
16
  Classifier: Intended Audience :: Science/Research
218
- Classifier: License :: OSI Approved :: Apache Software License
219
17
  Classifier: Natural Language :: English
220
18
  Classifier: Operating System :: OS Independent
221
19
  Classifier: Programming Language :: Python :: 3
222
- Classifier: Programming Language :: Python :: 3.10
223
20
  Classifier: Programming Language :: Python :: 3.11
224
21
  Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
225
24
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
226
- Requires-Python: <4,>=3.10.0
25
+ Requires-Python: <4,>=3.11.0
227
26
  Description-Content-Type: text/markdown
228
27
  License-File: LICENSE
229
- Requires-Dist: torch<3.0.0,>=2.0.0
230
- Requires-Dist: torchvision>=0.15.0
28
+ Requires-Dist: torch<3.0.0,>=2.11.0
29
+ Requires-Dist: torchvision>=0.26.0
231
30
  Requires-Dist: onnx<3.0.0,>=1.12.0
232
31
  Requires-Dist: numpy<3.0.0,>=1.16.0
233
32
  Requires-Dist: scipy<2.0.0,>=1.4.0
234
33
  Requires-Dist: h5py<4.0.0,>=3.1.0
235
- Requires-Dist: opencv-python<5.0.0,>=4.5.0
34
+ Requires-Dist: opencv-python<6.0.0,>=4.5.0
236
35
  Requires-Dist: pypdfium2<6.0.0,>=4.11.0
237
36
  Requires-Dist: pyclipper<2.0.0,>=1.2.0
238
37
  Requires-Dist: shapely<3.0.0,>=1.6.0
239
38
  Requires-Dist: langdetect<2.0.0,>=1.0.9
240
39
  Requires-Dist: rapidfuzz<4.0.0,>=3.0.0
241
- Requires-Dist: huggingface-hub<2.0.0,>=0.20.0
242
- Requires-Dist: Pillow>=9.2.0
243
- Requires-Dist: defusedxml>=0.7.0
40
+ Requires-Dist: huggingface-hub<3.0.0,>=1.0.0
41
+ Requires-Dist: Pillow>=10.1.0
244
42
  Requires-Dist: anyascii>=0.3.2
245
43
  Requires-Dist: validators>=0.18.0
246
44
  Requires-Dist: tqdm>=4.30.0
@@ -252,58 +50,68 @@ Requires-Dist: mplcursors>=0.3; extra == "viz"
252
50
  Provides-Extra: contrib
253
51
  Requires-Dist: onnxruntime>=1.11.0; extra == "contrib"
254
52
  Provides-Extra: testing
255
- Requires-Dist: pytest>=5.3.2; extra == "testing"
256
- Requires-Dist: coverage[toml]>=4.5.4; extra == "testing"
53
+ Requires-Dist: pytest-cov>=7.0.0; extra == "testing"
257
54
  Requires-Dist: onnxruntime>=1.11.0; extra == "testing"
55
+ Requires-Dist: onnxscript>=0.5.0; extra == "testing"
258
56
  Requires-Dist: requests>=2.20.0; extra == "testing"
259
57
  Requires-Dist: psutil>=5.9.5; extra == "testing"
58
+ Requires-Dist: pandas>=2.0.0; extra == "testing"
260
59
  Provides-Extra: quality
261
60
  Requires-Dist: ruff>=0.1.5; extra == "quality"
262
61
  Requires-Dist: mypy>=0.812; extra == "quality"
263
62
  Requires-Dist: pre-commit>=2.17.0; extra == "quality"
264
63
  Provides-Extra: docs
265
- Requires-Dist: sphinx!=3.5.0,>=3.0.0; extra == "docs"
266
- Requires-Dist: sphinxemoji>=0.1.8; extra == "docs"
267
- Requires-Dist: sphinx-copybutton>=0.3.1; extra == "docs"
64
+ Requires-Dist: sphinx>=8.0.0; extra == "docs"
268
65
  Requires-Dist: docutils<0.23; extra == "docs"
269
- Requires-Dist: recommonmark>=0.7.1; extra == "docs"
270
- Requires-Dist: sphinx-markdown-tables>=0.0.15; extra == "docs"
66
+ Requires-Dist: pydata-sphinx-theme>=0.23.0; extra == "docs"
67
+ Requires-Dist: myst-parser>=4.0.0; extra == "docs"
68
+ Requires-Dist: sphinx-design>=0.6.0; extra == "docs"
69
+ Requires-Dist: sphinx-copybutton>=0.5.2; extra == "docs"
70
+ Requires-Dist: sphinx-reredirects>=0.1.5; extra == "docs"
71
+ Requires-Dist: sphinxemoji>=0.1.8; extra == "docs"
271
72
  Requires-Dist: sphinx-tabs>=3.3.0; extra == "docs"
272
- Requires-Dist: furo>=2022.3.4; extra == "docs"
273
73
  Provides-Extra: dev
274
- Requires-Dist: torch<3.0.0,>=2.0.0; extra == "dev"
275
- Requires-Dist: torchvision>=0.15.0; extra == "dev"
74
+ Requires-Dist: torch<3.0.0,>=2.11.0; extra == "dev"
75
+ Requires-Dist: torchvision>=0.26.0; extra == "dev"
276
76
  Requires-Dist: onnx<3.0.0,>=1.12.0; extra == "dev"
277
77
  Requires-Dist: weasyprint>=55.0; extra == "dev"
278
78
  Requires-Dist: matplotlib>=3.1.0; extra == "dev"
279
79
  Requires-Dist: mplcursors>=0.3; extra == "dev"
280
- Requires-Dist: pytest>=5.3.2; extra == "dev"
281
- Requires-Dist: coverage[toml]>=4.5.4; extra == "dev"
80
+ Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
282
81
  Requires-Dist: onnxruntime>=1.11.0; extra == "dev"
82
+ Requires-Dist: onnxscript>=0.5.0; extra == "dev"
283
83
  Requires-Dist: requests>=2.20.0; extra == "dev"
284
84
  Requires-Dist: psutil>=5.9.5; extra == "dev"
85
+ Requires-Dist: pandas>=2.0.0; extra == "dev"
285
86
  Requires-Dist: ruff>=0.3.0; extra == "dev"
286
87
  Requires-Dist: mypy>=1.0; extra == "dev"
287
88
  Requires-Dist: pre-commit>=3.0.0; extra == "dev"
288
- Requires-Dist: sphinx!=3.5.0,>=3.0.0; extra == "dev"
289
- Requires-Dist: sphinxemoji>=0.1.8; extra == "dev"
290
- Requires-Dist: sphinx-copybutton>=0.3.1; extra == "dev"
89
+ Requires-Dist: sphinx>=8.0.0; extra == "dev"
291
90
  Requires-Dist: docutils<0.23; extra == "dev"
292
- Requires-Dist: recommonmark>=0.7.1; extra == "dev"
293
- Requires-Dist: sphinx-markdown-tables>=0.0.15; extra == "dev"
91
+ Requires-Dist: pydata-sphinx-theme>=0.23.0; extra == "dev"
92
+ Requires-Dist: myst-parser>=4.0.0; extra == "dev"
93
+ Requires-Dist: sphinx-design>=0.6.0; extra == "dev"
94
+ Requires-Dist: sphinx-copybutton>=0.5.2; extra == "dev"
95
+ Requires-Dist: sphinx-reredirects>=0.1.5; extra == "dev"
96
+ Requires-Dist: sphinxemoji>=0.1.8; extra == "dev"
294
97
  Requires-Dist: sphinx-tabs>=3.3.0; extra == "dev"
295
- Requires-Dist: furo>=2022.3.4; extra == "dev"
296
98
  Dynamic: license-file
297
99
 
298
100
  <p align="center">
299
101
  <img src="https://github.com/mindee/doctr/raw/main/docs/images/Logo_doctr.gif" width="40%">
300
102
  </p>
301
103
 
302
- [![Slack Icon](https://img.shields.io/badge/Slack-Community-4A154B?style=flat-square&logo=slack&logoColor=white)](https://slack.mindee.com) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) ![Build Status](https://github.com/mindee/doctr/workflows/builds/badge.svg) [![Docker Images](https://img.shields.io/badge/Docker-4287f5?style=flat&logo=docker&logoColor=white)](https://github.com/mindee/doctr/pkgs/container/doctr) [![codecov](https://codecov.io/gh/mindee/doctr/branch/main/graph/badge.svg?token=577MO567NM)](https://codecov.io/gh/mindee/doctr) [![CodeFactor](https://www.codefactor.io/repository/github/mindee/doctr/badge?s=bae07db86bb079ce9d6542315b8c6e70fa708a7e)](https://www.codefactor.io/repository/github/mindee/doctr) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/340a76749b634586a498e1c0ab998f08)](https://app.codacy.com/gh/mindee/doctr?utm_source=github.com&utm_medium=referral&utm_content=mindee/doctr&utm_campaign=Badge_Grade) [![Doc Status](https://github.com/mindee/doctr/workflows/doc-status/badge.svg)](https://mindee.github.io/doctr) [![Pypi](https://img.shields.io/badge/pypi-v1.0.0-blue.svg)](https://pypi.org/project/python-doctr/) [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/mindee/doctr) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mindee/notebooks/blob/main/doctr/quicktour.ipynb) [![Gurubase](https://img.shields.io/badge/Gurubase-Ask%20docTR%20Guru-006BFF)](https://gurubase.io/g/doctr)
104
+ [![Slack Icon](https://img.shields.io/badge/Slack-Community-4A154B?style=flat-square&logo=slack&logoColor=white)](https://slack.mindee.com) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) ![Build Status](https://github.com/mindee/doctr/workflows/builds/badge.svg) [![Docker Images](https://img.shields.io/badge/Docker-4287f5?style=flat&logo=docker&logoColor=white)](https://github.com/mindee/doctr/pkgs/container/doctr) [![codecov](https://codecov.io/gh/mindee/doctr/branch/main/graph/badge.svg?token=577MO567NM)](https://codecov.io/gh/mindee/doctr) [![CodeFactor](https://www.codefactor.io/repository/github/mindee/doctr/badge?s=bae07db86bb079ce9d6542315b8c6e70fa708a7e)](https://www.codefactor.io/repository/github/mindee/doctr) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/340a76749b634586a498e1c0ab998f08)](https://app.codacy.com/gh/mindee/doctr?utm_source=github.com&utm_medium=referral&utm_content=mindee/doctr&utm_campaign=Badge_Grade) [![Doc Status](https://github.com/mindee/doctr/workflows/doc-status/badge.svg)](https://mindee.github.io/doctr) [![Pypi](https://img.shields.io/badge/pypi-v1.2.0-blue.svg)](https://pypi.org/project/python-doctr/) [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/mindee/doctr) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mindee/notebooks/blob/main/doctr/quicktour.ipynb) [![Gurubase](https://img.shields.io/badge/Gurubase-Ask%20docTR%20Guru-006BFF)](https://gurubase.io/g/doctr)
303
105
 
304
106
 
305
107
  **Optical Character Recognition made seamless & accessible to anyone, powered by PyTorch**
306
108
 
109
+ ## Project responsibility
110
+
111
+ **docTR** was originally created by [Mindee](https://mindee.com). It is now actively developed and maintained by [t2k GmbH](https://www.text2knowledge.de/de).
112
+
113
+ [![Need help solving a complex use case?](https://github.com/mindee/doctr/raw/main/docs/images/doctr-need-help.png)](https://www.text2knowledge.de/de)
114
+
307
115
  What you can expect from this repository:
308
116
 
309
117
  - efficient ways to parse textual information (localize and identify each word) from your documents
@@ -316,12 +124,12 @@ What you can expect from this repository:
316
124
  ### Getting your pretrained model
317
125
 
318
126
  End-to-End OCR is achieved in docTR using a two-stage approach: text detection (localizing words), then text recognition (identify all characters in the word).
319
- As such, you can select the architecture used for [text detection](https://mindee.github.io/doctr/latest/modules/models.html#doctr-models-detection), and the one for [text recognition](https://mindee.github.io/doctr/latest//modules/models.html#doctr-models-recognition) from the list of available implementations.
127
+ As such, you can select the architecture used for [text detection](https://mindee.github.io/doctr/latest/models/detection.html), and the one for [text recognition](https://mindee.github.io/doctr/latest/models/recognition.html) from the list of available implementations.
320
128
 
321
129
  ```python
322
130
  from doctr.models import ocr_predictor
323
131
 
324
- model = ocr_predictor(det_arch='db_resnet50', reco_arch='crnn_vgg16_bn', pretrained=True)
132
+ model = ocr_predictor(det_arch="db_resnet50", reco_arch="crnn_vgg16_bn", pretrained=True)
325
133
  ```
326
134
 
327
135
  ### Reading files
@@ -330,6 +138,7 @@ Documents can be interpreted from PDF or images:
330
138
 
331
139
  ```python
332
140
  from doctr.io import DocumentFile
141
+
333
142
  # PDF
334
143
  pdf_doc = DocumentFile.from_pdf("path/to/your/doc.pdf")
335
144
  # Image
@@ -355,6 +164,47 @@ doc = DocumentFile.from_pdf("path/to/your/doc.pdf")
355
164
  result = model(doc)
356
165
  ```
357
166
 
167
+ ### Detecting the document layout
168
+
169
+ You can additionally run a layout detection model as part of the pipeline by passing `detect_layout=True`. The detected regions (e.g. `Title`, `Text`, `Table`, `Page-header`, `Page-footer`) are attached to every page and rendered by `.show()`:
170
+
171
+ ```python
172
+ from doctr.io import DocumentFile
173
+ from doctr.models import ocr_predictor
174
+
175
+ model = ocr_predictor(pretrained=True, detect_layout=True)
176
+ doc = DocumentFile.from_images("path/to/your/doc.jpg")
177
+ result = model(doc)
178
+
179
+ # Access the detected layout regions of the first page
180
+ for region in result.pages[0].layout:
181
+ print(region.type, region.confidence, region.geometry)
182
+ ```
183
+
184
+ ### Recognizing tables and formulas
185
+
186
+ With `detect_tables=True`, the tables found by the layout model are rebuilt as a grid of rows, columns and cells. With `detect_formulas=True`, formulas are read as LaTeX. Both are rendered in the exports, e.g. as Markdown tables and `$$...$$` display math:
187
+
188
+ ```python
189
+ from doctr.io import DocumentFile
190
+ from doctr.models import ocr_predictor
191
+
192
+ model = ocr_predictor(pretrained=True, detect_tables=True, detect_formulas=True)
193
+ doc = DocumentFile.from_pdf("path/to/your/doc.pdf")
194
+ result = model(doc)
195
+
196
+ page = result.pages[0]
197
+ # Tables: a row/column grid of strings
198
+ for table in page.tables:
199
+ print(table.num_rows, table.num_cols, table.to_grid())
200
+ # Formulas: the LaTeX source and its confidence
201
+ for formula in page.formulas:
202
+ print(formula.value, formula.confidence)
203
+
204
+ # Markdown export with tables and display math
205
+ print(result.export_as_markdown())
206
+ ```
207
+
358
208
  ### Dealing with rotated documents
359
209
 
360
210
  Should you use docTR on documents that include rotated pages, or pages with multiple box orientations,
@@ -384,13 +234,15 @@ Or even rebuild the original document from its predictions:
384
234
  import matplotlib.pyplot as plt
385
235
 
386
236
  synthetic_pages = result.synthesize()
387
- plt.imshow(synthetic_pages[0]); plt.axis('off'); plt.show()
237
+ plt.imshow(synthetic_pages[0])
238
+ plt.axis("off")
239
+ plt.show()
388
240
  ```
389
241
 
390
242
  ![Synthesis sample](https://github.com/mindee/doctr/raw/main/docs/images/synthesized_sample.png)
391
243
 
392
244
  The `ocr_predictor` returns a `Document` object with a nested structure (with `Page`, `Block`, `Line`, `Word`, `Artefact`).
393
- To get a better understanding of our document model, check our [documentation](https://mindee.github.io/doctr/modules/io.html#document-structure):
245
+ To get a better understanding of our document model, check our [documentation](https://mindee.github.io/doctr/latest/getting_started/concepts.html#the-document-tree):
394
246
 
395
247
  You can also export them as a nested dict, more appropriate for JSON format:
396
248
 
@@ -409,7 +261,7 @@ from doctr.io import DocumentFile
409
261
  from doctr.models import kie_predictor
410
262
 
411
263
  # Model
412
- model = kie_predictor(det_arch='db_resnet50', reco_arch='crnn_vgg16_bn', pretrained=True)
264
+ model = kie_predictor(det_arch="db_resnet50", reco_arch="crnn_vgg16_bn", pretrained=True)
413
265
  # PDF
414
266
  doc = DocumentFile.from_pdf("path/to/your/doc.pdf")
415
267
  # Analyze
@@ -424,15 +276,11 @@ for class_name in predictions.keys():
424
276
 
425
277
  The KIE predictor results per page are in a dictionary format with each key representing a class name and it's value are the predictions for that class.
426
278
 
427
- ### If you are looking for support from the Mindee team
428
-
429
- [![Bad OCR test detection image asking the developer if they need help](https://github.com/mindee/doctr/raw/main/docs/images/doctr-need-help.png)](https://mindee.com/product/doctr)
430
-
431
279
  ## Installation
432
280
 
433
281
  ### Prerequisites
434
282
 
435
- Python 3.10 (or higher) and [pip](https://pip.pypa.io/en/stable/) are required to install docTR.
283
+ Python 3.11 (or higher) and [pip](https://pip.pypa.io/en/stable/) are required to install docTR.
436
284
 
437
285
  ### Latest release
438
286
 
@@ -486,6 +334,18 @@ Credits where it's due: this repository is implementing, among others, architect
486
334
  - PARSeq: [Scene Text Recognition with Permuted Autoregressive Sequence Models](https://arxiv.org/pdf/2207.06966).
487
335
  - VIPTR: [A Vision Permutable Extractor for Fast and Efficient Scene Text Recognition](https://arxiv.org/abs/2401.10110).
488
336
 
337
+ ### Layout Analysis
338
+
339
+ - LW-DETR: [A Transformer Replacement to YOLO for Real-Time Detection](https://arxiv.org/pdf/2406.03459v1).
340
+
341
+ ### Table Structure Recognition
342
+
343
+ - TableCenterNet: [A one-stage network for table structure recognition](https://arxiv.org/abs/2504.17522).
344
+
345
+ ### Formula Recognition
346
+
347
+ - FormulaNet (HGNetV2 encoder + transformer decoder): [PP-FormulaNet: Bridging Accuracy and Efficiency in Advanced Formula Recognition](https://arxiv.org/abs/2503.18382).
348
+
489
349
  ## More goodies
490
350
 
491
351
  ### Documentation
@@ -539,7 +399,7 @@ docker run -it --gpus all ghcr.io/mindee/doctr:torch-py3.9.18-2024-10 bash
539
399
  The Docker images for docTR follow a specific tag nomenclature: `<deps>-py<python_version>-<doctr_version|YYYY-MM>`. Here's a breakdown of the tag structure:
540
400
 
541
401
  - `<deps>`: `torch`, `torch-viz-html-contrib`.
542
- - `<python_version>`: `3.9.18`, `3.10.13` or `3.11.8`.
402
+ - `<python_version>`: `3.10.13`, `3.11.8`, etc.
543
403
  - `<doctr_version>`: a tag >= `v0.11.0`
544
404
  - `<YYYY-MM>`: e.g. `2014-10`
545
405
 
@@ -610,7 +470,7 @@ import requests
610
470
 
611
471
  params = {"det_arch": "db_resnet50", "reco_arch": "crnn_vgg16_bn"}
612
472
 
613
- with open('/path/to/your/doc.jpg', 'rb') as f:
473
+ with open("/path/to/your/doc.jpg", "rb") as f:
614
474
  files = [ # application/pdf, image/jpeg, image/png supported
615
475
  ("files", ("doc.jpg", f.read(), "image/jpeg")),
616
476
  ]
@@ -621,12 +481,6 @@ print(requests.post("http://localhost:8080/ocr", params=params, files=files).jso
621
481
 
622
482
  Looking for more illustrations of docTR features? You might want to check the [Jupyter notebooks](https://github.com/mindee/doctr/tree/main/notebooks) designed to give you a broader overview.
623
483
 
624
- ## Supported By
625
-
626
- This project is supported by [t2k GmbH](https://www.text2knowledge.de/de),
627
- <p align="center">
628
- <img src="https://github.com/mindee/doctr/raw/main/docs/images/t2k_logo.png" width="40%">
629
- </p>
630
484
 
631
485
  ## Citation
632
486
 
@@ -642,6 +496,22 @@ If you wish to cite this project, feel free to use this [BibTeX](http://www.bibt
642
496
  }
643
497
  ```
644
498
 
499
+ ## Custom Development and Support
500
+
501
+ [t2k GmbH](https://www.text2knowledge.de/de) offers professional services around docTR : whether you are building a product or contributing to the open-source project.
502
+
503
+ ### For organizations
504
+
505
+ Interested in docTR and want to develop, implement, or ship your own solution? t2k can help with:
506
+
507
+ - **Custom OCR development** : individual detection, recognition, and pipeline work built on docTR
508
+ - **Project implementation** : turning your ideas into production-ready docTR integrations
509
+ - **Technical consulting** : architecture, deployment, and integration guidance
510
+ - **Ongoing development** : feature extensions and implementation support tailored to your use case
511
+ - **Workshops & advisory** : verbal consulting, hands-on sessions, and recommendations for working with docTR
512
+
513
+ Contact [info@text2knowledge.de](mailto:info@text2knowledge.de) or visit our [home page](https://www.text2knowledge.de) to discuss your project.
514
+
645
515
  ## Contributing
646
516
 
647
517
  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?