glypharis 1.0.0__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.
- glypharis-1.0.0/LICENSE +201 -0
- glypharis-1.0.0/NOTICE +69 -0
- glypharis-1.0.0/PKG-INFO +190 -0
- glypharis-1.0.0/README.md +209 -0
- glypharis-1.0.0/docs/PYPI.md +139 -0
- glypharis-1.0.0/glypharis/__init__.py +45 -0
- glypharis-1.0.0/glypharis/check.py +408 -0
- glypharis-1.0.0/glypharis/cli.py +107 -0
- glypharis-1.0.0/glypharis/config/__init__.py +26 -0
- glypharis-1.0.0/glypharis/config/cli.py +50 -0
- glypharis-1.0.0/glypharis/config/loader.py +333 -0
- glypharis-1.0.0/glypharis/config/schema.py +522 -0
- glypharis-1.0.0/glypharis/data/__init__.py +1 -0
- glypharis-1.0.0/glypharis/data/audit.py +484 -0
- glypharis-1.0.0/glypharis/data/augment.py +368 -0
- glypharis-1.0.0/glypharis/data/counters.py +95 -0
- glypharis-1.0.0/glypharis/data/crops.py +139 -0
- glypharis-1.0.0/glypharis/data/det_augment.py +76 -0
- glypharis-1.0.0/glypharis/data/det_dataset.py +519 -0
- glypharis-1.0.0/glypharis/data/det_geometry.py +219 -0
- glypharis-1.0.0/glypharis/data/det_labels.py +283 -0
- glypharis-1.0.0/glypharis/data/download.py +386 -0
- glypharis-1.0.0/glypharis/data/exclusions.py +41 -0
- glypharis-1.0.0/glypharis/data/gdc.py +517 -0
- glypharis-1.0.0/glypharis/data/hiertext.py +103 -0
- glypharis-1.0.0/glypharis/data/linepack.py +147 -0
- glypharis-1.0.0/glypharis/data/pages.py +189 -0
- glypharis-1.0.0/glypharis/data/rec_dataset.py +226 -0
- glypharis-1.0.0/glypharis/data/registry.py +46 -0
- glypharis-1.0.0/glypharis/data/sources.py +128 -0
- glypharis-1.0.0/glypharis/data/synth.py +411 -0
- glypharis-1.0.0/glypharis/data/text.py +222 -0
- glypharis-1.0.0/glypharis/diagnostics/__init__.py +167 -0
- glypharis-1.0.0/glypharis/diagnostics/det.py +235 -0
- glypharis-1.0.0/glypharis/efficiency/__init__.py +13 -0
- glypharis-1.0.0/glypharis/efficiency/candidate.py +312 -0
- glypharis-1.0.0/glypharis/efficiency/conditions.py +192 -0
- glypharis-1.0.0/glypharis/efficiency/files.py +33 -0
- glypharis-1.0.0/glypharis/efficiency/fused_attention.py +168 -0
- glypharis-1.0.0/glypharis/efficiency/onnx_build.py +136 -0
- glypharis-1.0.0/glypharis/efficiency/phone_bundle.py +191 -0
- glypharis-1.0.0/glypharis/efficiency/quant.py +103 -0
- glypharis-1.0.0/glypharis/efficiency/threads.py +173 -0
- glypharis-1.0.0/glypharis/efficiency/v1.py +81 -0
- glypharis-1.0.0/glypharis/efficiency/variants.py +791 -0
- glypharis-1.0.0/glypharis/errors.py +43 -0
- glypharis-1.0.0/glypharis/eval/__init__.py +1 -0
- glypharis-1.0.0/glypharis/eval/access.py +68 -0
- glypharis-1.0.0/glypharis/eval/calib_stats.py +72 -0
- glypharis-1.0.0/glypharis/eval/det_matching.py +231 -0
- glypharis-1.0.0/glypharis/eval/det_overlay.py +177 -0
- glypharis-1.0.0/glypharis/eval/det_slices.py +367 -0
- glypharis-1.0.0/glypharis/eval/errors.py +654 -0
- glypharis-1.0.0/glypharis/eval/inputs.py +289 -0
- glypharis-1.0.0/glypharis/eval/page_metrics.py +277 -0
- glypharis-1.0.0/glypharis/eval/sets.py +129 -0
- glypharis-1.0.0/glypharis/eval/slices.py +119 -0
- glypharis-1.0.0/glypharis/eval/stats.py +303 -0
- glypharis-1.0.0/glypharis/eval/text_metrics.py +163 -0
- glypharis-1.0.0/glypharis/export/__init__.py +1 -0
- glypharis-1.0.0/glypharis/export/bundle.py +177 -0
- glypharis-1.0.0/glypharis/export/onnx.py +138 -0
- glypharis-1.0.0/glypharis/hub.py +558 -0
- glypharis-1.0.0/glypharis/models/__init__.py +1 -0
- glypharis-1.0.0/glypharis/models/det/__init__.py +33 -0
- glypharis-1.0.0/glypharis/models/det/backbone.py +129 -0
- glypharis-1.0.0/glypharis/models/det/dbnet.py +170 -0
- glypharis-1.0.0/glypharis/models/det/detector.py +189 -0
- glypharis-1.0.0/glypharis/models/det/loss.py +109 -0
- glypharis-1.0.0/glypharis/models/det/postprocess.py +474 -0
- glypharis-1.0.0/glypharis/models/det/preprocess.py +86 -0
- glypharis-1.0.0/glypharis/models/det/runtime.py +75 -0
- glypharis-1.0.0/glypharis/models/rec/__init__.py +5 -0
- glypharis-1.0.0/glypharis/models/rec/base.py +19 -0
- glypharis-1.0.0/glypharis/models/rec/crnn.py +126 -0
- glypharis-1.0.0/glypharis/models/rec/svtr.py +162 -0
- glypharis-1.0.0/glypharis/pipeline/__init__.py +6 -0
- glypharis-1.0.0/glypharis/pipeline/calibration.py +56 -0
- glypharis-1.0.0/glypharis/pipeline/frozen.py +371 -0
- glypharis-1.0.0/glypharis/pipeline/ocr.py +318 -0
- glypharis-1.0.0/glypharis/pipeline/reading_order.py +121 -0
- glypharis-1.0.0/glypharis/pipeline/recognizer.py +223 -0
- glypharis-1.0.0/glypharis/sample/README.md +16 -0
- glypharis-1.0.0/glypharis/sample/expected.json +33 -0
- glypharis-1.0.0/glypharis/sample/page.png +0 -0
- glypharis-1.0.0/glypharis/server.py +219 -0
- glypharis-1.0.0/glypharis/training/__init__.py +1 -0
- glypharis-1.0.0/glypharis/training/checkpoint.py +72 -0
- glypharis-1.0.0/glypharis/training/det_eval.py +610 -0
- glypharis-1.0.0/glypharis/training/det_report.py +636 -0
- glypharis-1.0.0/glypharis/training/det_trainer.py +701 -0
- glypharis-1.0.0/glypharis/training/loop.py +616 -0
- glypharis-1.0.0/glypharis/training/optim.py +48 -0
- glypharis-1.0.0/glypharis/training/rec_trainer.py +540 -0
- glypharis-1.0.0/glypharis/training/report.py +212 -0
- glypharis-1.0.0/glypharis/utils/__init__.py +37 -0
- glypharis-1.0.0/glypharis/utils/determinism.py +89 -0
- glypharis-1.0.0/glypharis/utils/device.py +114 -0
- glypharis-1.0.0/glypharis/utils/gitinfo.py +39 -0
- glypharis-1.0.0/glypharis/utils/logsetup.py +71 -0
- glypharis-1.0.0/glypharis/utils/monitor.py +123 -0
- glypharis-1.0.0/glypharis/utils/seed.py +63 -0
- glypharis-1.0.0/glypharis.egg-info/PKG-INFO +190 -0
- glypharis-1.0.0/glypharis.egg-info/SOURCES.txt +195 -0
- glypharis-1.0.0/glypharis.egg-info/dependency_links.txt +1 -0
- glypharis-1.0.0/glypharis.egg-info/entry_points.txt +4 -0
- glypharis-1.0.0/glypharis.egg-info/requires.txt +27 -0
- glypharis-1.0.0/glypharis.egg-info/top_level.txt +1 -0
- glypharis-1.0.0/pyproject.toml +129 -0
- glypharis-1.0.0/setup.cfg +4 -0
- glypharis-1.0.0/tests/test_ablation_ladder.py +76 -0
- glypharis-1.0.0/tests/test_api.py +127 -0
- glypharis-1.0.0/tests/test_audit.py +248 -0
- glypharis-1.0.0/tests/test_augment.py +90 -0
- glypharis-1.0.0/tests/test_baselines.py +538 -0
- glypharis-1.0.0/tests/test_check.py +334 -0
- glypharis-1.0.0/tests/test_checkpoint_retry.py +37 -0
- glypharis-1.0.0/tests/test_citation.py +165 -0
- glypharis-1.0.0/tests/test_compute_ledger.py +263 -0
- glypharis-1.0.0/tests/test_config.py +241 -0
- glypharis-1.0.0/tests/test_derive_values.py +497 -0
- glypharis-1.0.0/tests/test_det_config.py +253 -0
- glypharis-1.0.0/tests/test_det_dataset.py +416 -0
- glypharis-1.0.0/tests/test_det_eval.py +376 -0
- glypharis-1.0.0/tests/test_det_geometry.py +203 -0
- glypharis-1.0.0/tests/test_det_labels.py +273 -0
- glypharis-1.0.0/tests/test_det_loss.py +156 -0
- glypharis-1.0.0/tests/test_det_model.py +380 -0
- glypharis-1.0.0/tests/test_det_phase9.py +118 -0
- glypharis-1.0.0/tests/test_det_postprocess.py +616 -0
- glypharis-1.0.0/tests/test_det_training.py +711 -0
- glypharis-1.0.0/tests/test_download.py +422 -0
- glypharis-1.0.0/tests/test_e2e_profile.py +355 -0
- glypharis-1.0.0/tests/test_efficiency_helpers.py +458 -0
- glypharis-1.0.0/tests/test_epoch_lines.py +48 -0
- glypharis-1.0.0/tests/test_errors.py +493 -0
- glypharis-1.0.0/tests/test_eval.py +209 -0
- glypharis-1.0.0/tests/test_experiment_comparison.py +389 -0
- glypharis-1.0.0/tests/test_experiment_summary.py +467 -0
- glypharis-1.0.0/tests/test_export.py +110 -0
- glypharis-1.0.0/tests/test_ext_eval.py +659 -0
- glypharis-1.0.0/tests/test_ext_metrics.py +372 -0
- glypharis-1.0.0/tests/test_freeze_final.py +122 -0
- glypharis-1.0.0/tests/test_frozen.py +422 -0
- glypharis-1.0.0/tests/test_gdc.py +276 -0
- glypharis-1.0.0/tests/test_gdc_align.py +112 -0
- glypharis-1.0.0/tests/test_gdc_exclusion.py +40 -0
- glypharis-1.0.0/tests/test_gdc_scan_build.py +60 -0
- glypharis-1.0.0/tests/test_glyph_c.py +40 -0
- glypharis-1.0.0/tests/test_glyph_c_eval.py +117 -0
- glypharis-1.0.0/tests/test_gpu_memory_cap.py +30 -0
- glypharis-1.0.0/tests/test_hardening.py +132 -0
- glypharis-1.0.0/tests/test_hardening_check.py +141 -0
- glypharis-1.0.0/tests/test_hiertext_eval_launch.py +86 -0
- glypharis-1.0.0/tests/test_hub.py +700 -0
- glypharis-1.0.0/tests/test_inputs.py +251 -0
- glypharis-1.0.0/tests/test_numtrace.py +1246 -0
- glypharis-1.0.0/tests/test_official_eval.py +454 -0
- glypharis-1.0.0/tests/test_pack_release.py +460 -0
- glypharis-1.0.0/tests/test_package_check.py +242 -0
- glypharis-1.0.0/tests/test_packaging.py +429 -0
- glypharis-1.0.0/tests/test_phase14_baselines.py +722 -0
- glypharis-1.0.0/tests/test_phase14_prepare.py +357 -0
- glypharis-1.0.0/tests/test_phase14_score.py +1229 -0
- glypharis-1.0.0/tests/test_phase15_errors.py +1146 -0
- glypharis-1.0.0/tests/test_phase15_glyphsynth.py +294 -0
- glypharis-1.0.0/tests/test_phase16_baselines.py +240 -0
- glypharis-1.0.0/tests/test_phase16_profiles.py +866 -0
- glypharis-1.0.0/tests/test_phase16_reference.py +483 -0
- glypharis-1.0.0/tests/test_phase16_score.py +909 -0
- glypharis-1.0.0/tests/test_phase16_variants.py +853 -0
- glypharis-1.0.0/tests/test_phase17_v1_check.py +103 -0
- glypharis-1.0.0/tests/test_phase22_android.py +2078 -0
- glypharis-1.0.0/tests/test_phase22_bundle.py +87 -0
- glypharis-1.0.0/tests/test_phase22_candidate.py +221 -0
- glypharis-1.0.0/tests/test_phase22_closure.py +172 -0
- glypharis-1.0.0/tests/test_phase22_eval.py +871 -0
- glypharis-1.0.0/tests/test_phase22_score.py +709 -0
- glypharis-1.0.0/tests/test_phase22_v1_compare.py +1072 -0
- glypharis-1.0.0/tests/test_phase22_v1_repro.py +973 -0
- glypharis-1.0.0/tests/test_pipeline.py +152 -0
- glypharis-1.0.0/tests/test_prepare_benchmarks.py +198 -0
- glypharis-1.0.0/tests/test_preprocess.py +242 -0
- glypharis-1.0.0/tests/test_reading_order.py +82 -0
- glypharis-1.0.0/tests/test_rec_svtr.py +80 -0
- glypharis-1.0.0/tests/test_rec_training.py +809 -0
- glypharis-1.0.0/tests/test_references.py +83 -0
- glypharis-1.0.0/tests/test_release_workflow.py +323 -0
- glypharis-1.0.0/tests/test_scripts.py +42 -0
- glypharis-1.0.0/tests/test_seed_determinism.py +87 -0
- glypharis-1.0.0/tests/test_server.py +239 -0
- glypharis-1.0.0/tests/test_synth.py +132 -0
- glypharis-1.0.0/tests/test_synth_study.py +110 -0
- glypharis-1.0.0/tests/test_text.py +147 -0
- glypharis-1.0.0/tests/test_trace_numbers.py +1563 -0
- glypharis-1.0.0/tests/test_utils.py +153 -0
- glypharis-1.0.0/tests/test_v1_code_diff.py +147 -0
glypharis-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
glypharis-1.0.0/NOTICE
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
GLYPHARIS
|
|
2
|
+
Copyright 2026 DuhItzAniket
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE). The licence
|
|
5
|
+
covers the source code and the project's own text in this repository, except for the material
|
|
6
|
+
listed below, which keeps its own terms.
|
|
7
|
+
|
|
8
|
+
Material in this repository that the Apache License does not cover
|
|
9
|
+
-----------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
1. HierText and Open Images material (CC BY-SA 4.0)
|
|
12
|
+
|
|
13
|
+
The images, crops, quoted lines and word pairs taken from HierText, and the tables derived
|
|
14
|
+
from it, in reports/, docs/RELEASE_NOTES_v1.0.md, docs/FINAL_VALIDATION.md, MODEL_CARD.md,
|
|
15
|
+
release/huggingface/README.md and research/paper/ come from HierText (Long et al.,
|
|
16
|
+
"Towards End-to-End Unified Scene Text Detection and Layout Analysis", CVPR 2022,
|
|
17
|
+
https://github.com/google-research-datasets/hiertext). HierText is released under
|
|
18
|
+
CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/), and this material is shared
|
|
19
|
+
under the same licence. Its images come from Open Images
|
|
20
|
+
(https://storage.googleapis.com/openimages/web/index.html), which lists them as CC BY 2.0
|
|
21
|
+
(https://creativecommons.org/licenses/by/2.0/) and gives no warranty about the licence of
|
|
22
|
+
any one image. The material was changed: crops were cut from the images, resized and
|
|
23
|
+
converted to grey scale, and previews show them after the augmentations named there. Author
|
|
24
|
+
and source are not recorded per image; line keys begin with the HierText image ID.
|
|
25
|
+
|
|
26
|
+
This notice is the attribution for that material in full. The list of report files written
|
|
27
|
+
before they carried their own attribution line is in reports/README.md, "Attribution of
|
|
28
|
+
HierText and Open Images material". reports/ is in the tagged GitHub repository but is left
|
|
29
|
+
out of source archives made with git archive and of the Zenodo deposit (.gitattributes,
|
|
30
|
+
export-ignore); DATASETS.md, which records the licences of every dataset, is in both.
|
|
31
|
+
|
|
32
|
+
2. Quoted GDC lines and GDC word pairs (their sources' licences)
|
|
33
|
+
|
|
34
|
+
reports/error_cases/phase15/ quotes lines from the openly licensed and public-domain source
|
|
35
|
+
documents of the project's GDC test set, each with its key, URL and licence, and
|
|
36
|
+
reports/confusion_analysis/GW-REC-040/ holds GDC word-confusion pairs pooled over all of its
|
|
37
|
+
source documents. These remain under the licences of their sources, which are listed in
|
|
38
|
+
DATASETS.md, "GDC source documents". Like the rest of reports/, these files are in the tagged
|
|
39
|
+
GitHub repository only (see item 1).
|
|
40
|
+
|
|
41
|
+
3. Data records under data/manifests/
|
|
42
|
+
|
|
43
|
+
The manifests record identifiers, URLs, sizes and hashes of third-party datasets, weights and
|
|
44
|
+
evaluators. They are data records about those sources, not code, and the sources themselves
|
|
45
|
+
keep their own terms (DATASETS.md).
|
|
46
|
+
|
|
47
|
+
4. Gradle wrapper
|
|
48
|
+
|
|
49
|
+
mobile/android-bench/gradle/wrapper/gradle-wrapper.jar, mobile/android-bench/gradlew and
|
|
50
|
+
mobile/android-bench/gradlew.bat are third-party files by the Gradle authors, distributed
|
|
51
|
+
under the Apache License, Version 2.0.
|
|
52
|
+
|
|
53
|
+
Not in this repository
|
|
54
|
+
----------------------
|
|
55
|
+
|
|
56
|
+
- Model weights. The v1 weights are not in this repository or in the code packages, and the
|
|
57
|
+
Apache License does not cover them. They are distributed separately as the asset
|
|
58
|
+
glypharis-v1.tar.gz of the GitHub release v1.0, under CC BY-SA 4.0 with attribution to
|
|
59
|
+
HierText and Open Images; LICENSE-WEIGHTS and NOTICE.md in the archive give the licence and
|
|
60
|
+
the attribution. The detector was initialised from ImageNet-1K weights, whose terms do not
|
|
61
|
+
clearly allow commercial use, and is kept as a disclosed exception
|
|
62
|
+
(docs/decisions/ADR-0014-weights-and-backbone-terms.md, "Phase 23 outcome"). The weights are
|
|
63
|
+
not described as cleared for commercial use.
|
|
64
|
+
- Datasets, the official evaluators, fonts and the GDC-scan document are not in the repository.
|
|
65
|
+
Their sources and terms are recorded in DATASETS.md.
|
|
66
|
+
- glypharis/sample/page.png is set in Open Sans (SIL OFL 1.1); the font file is not included.
|
|
67
|
+
|
|
68
|
+
DATASETS.md, MODEL_CARD.md and ADR-0014 record what the publishers state and how the project
|
|
69
|
+
handled it. They are not legal advice.
|
glypharis-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: glypharis
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Lightweight OCR engine for document images: text-line detector + CTC line recognizer.
|
|
5
|
+
Author: DuhItzAniket
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/DuhItzAniket/Glypharis
|
|
8
|
+
Project-URL: Source, https://github.com/DuhItzAniket/Glypharis
|
|
9
|
+
Project-URL: Issues, https://github.com/DuhItzAniket/Glypharis/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/DuhItzAniket/Glypharis/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: ocr,text recognition,text detection,document images,ctc,dbnet,pytorch,onnx
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
22
|
+
Requires-Python: <3.12,>=3.11.4
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
License-File: NOTICE
|
|
26
|
+
Requires-Dist: torch>=2.14
|
|
27
|
+
Requires-Dist: torchvision>=0.29
|
|
28
|
+
Requires-Dist: numpy>=2.4
|
|
29
|
+
Requires-Dist: pyyaml>=6.0
|
|
30
|
+
Requires-Dist: pillow>=12.3
|
|
31
|
+
Requires-Dist: opencv-contrib-python-headless>=5.0
|
|
32
|
+
Requires-Dist: rapidfuzz>=3.14
|
|
33
|
+
Requires-Dist: shapely>=2.2
|
|
34
|
+
Requires-Dist: scipy>=1.17
|
|
35
|
+
Requires-Dist: onnxruntime>=1.31
|
|
36
|
+
Provides-Extra: train
|
|
37
|
+
Requires-Dist: matplotlib>=3.11; extra == "train"
|
|
38
|
+
Requires-Dist: fonttools>=4.66; extra == "train"
|
|
39
|
+
Requires-Dist: pypdfium2>=5.14; extra == "train"
|
|
40
|
+
Requires-Dist: psutil>=7.2; extra == "train"
|
|
41
|
+
Requires-Dist: nvidia-ml-py>=13.615; extra == "train"
|
|
42
|
+
Provides-Extra: export
|
|
43
|
+
Requires-Dist: onnx>=1.23; extra == "export"
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest>=9.1; extra == "dev"
|
|
46
|
+
Requires-Dist: ruff>=0.17; extra == "dev"
|
|
47
|
+
Requires-Dist: mypy>=2.4; extra == "dev"
|
|
48
|
+
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
|
|
49
|
+
Requires-Dist: types-psutil>=7.2; extra == "dev"
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
|
|
52
|
+
# GLYPHARIS
|
|
53
|
+
|
|
54
|
+
A lightweight OCR engine for document images. It recovers readable text from scanned, photographed,
|
|
55
|
+
degraded, or image-only document pages and returns it as structured output: lines, boxes, confidence,
|
|
56
|
+
and timing.
|
|
57
|
+
|
|
58
|
+
GLYPHARIS is built as a research project. Every model is trained and evaluated on a single laptop GPU,
|
|
59
|
+
every experiment is registered before it runs, and every reported number traces back to a generated
|
|
60
|
+
report in the [repository](https://github.com/DuhItzAniket/Glypharis/tree/v1.0).
|
|
61
|
+
|
|
62
|
+
v1.0 is the release of v1 (GW-REC-034 with GW-DET-001): the code under Apache-2.0, published here
|
|
63
|
+
as `glypharis` 1.0.0, and the v1 weights as the asset `glypharis-v1.tar.gz` of the
|
|
64
|
+
[GitHub release v1.0](https://github.com/DuhItzAniket/Glypharis/releases/tag/v1.0), which
|
|
65
|
+
`glypharis.download_model` fetches and checks against pinned hashes.
|
|
66
|
+
|
|
67
|
+
> **The weights are a separate download.** This package is the code only: it holds no weights.
|
|
68
|
+
> `glypharis.download_model("glypharis-v1")` fetches them once; they carry their own terms (see
|
|
69
|
+
> Licence below).
|
|
70
|
+
|
|
71
|
+
## Install
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
pip install glypharis
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
GLYPHARIS needs Python 3.11 (3.11.4 or later). pip installs the default PyTorch build for your
|
|
78
|
+
platform; for a particular build (CPU only, or a CUDA version), install `torch` and `torchvision`
|
|
79
|
+
from the [PyTorch index](https://pytorch.org/get-started/locally/) first. The project's own pins are in
|
|
80
|
+
[requirements/README.md](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/requirements/README.md).
|
|
81
|
+
|
|
82
|
+
The core install reads pages with either backend (PyTorch or ONNX Runtime). Two extras add the rest:
|
|
83
|
+
|
|
84
|
+
| Extra | Adds | For |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| `glypharis[export]` | `onnx` | writing bundles and ONNX files (`write_bundle`), quantisation |
|
|
87
|
+
| `glypharis[train]` | `matplotlib`, `fonttools`, `pypdfium2`, `psutil`, `nvidia-ml-py` | training, data preparation and reports, which also need the repository's scripts and configs |
|
|
88
|
+
|
|
89
|
+
## Models
|
|
90
|
+
|
|
91
|
+
A model bundle is a directory with `manifest.json`, two release files and two ONNX files.
|
|
92
|
+
`GlypharisOCR.from_pretrained` takes a bundle's path or its name, looks names up in
|
|
93
|
+
`$GLYPHARIS_MODELS`, `~/.glypharis/models` and `./models`, and never reaches the network.
|
|
94
|
+
|
|
95
|
+
`glypharis.download_model(name)` fetches a registered model's release archive, checks its size and
|
|
96
|
+
SHA-256 and the bundle's manifest against the pins in `glypharis.hub`, and installs it where
|
|
97
|
+
`from_pretrained` finds it (the first `GLYPHARIS_MODELS` entry, else `~/.glypharis/models`).
|
|
98
|
+
`glypharis-ocr` and `glypharis-serve` do the same for a registered name that is not installed, unless
|
|
99
|
+
`--no-download` is given or `GLYPHARIS_OFFLINE` is set. Only `glypharis-v1` is registered; its
|
|
100
|
+
archive is the asset `glypharis-v1.tar.gz` of the
|
|
101
|
+
[GitHub release v1.0](https://github.com/DuhItzAniket/Glypharis/releases/tag/v1.0), beside
|
|
102
|
+
`glypharis-v1.tar.gz.sha256`. `glypharis-check` checks that an installed bundle is the released one
|
|
103
|
+
and reads a sample page shipped with the package; it says nothing about accuracy.
|
|
104
|
+
|
|
105
|
+
## Using it
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import glypharis
|
|
109
|
+
from glypharis import GlypharisOCR
|
|
110
|
+
|
|
111
|
+
glypharis.download_model("glypharis-v1") # once: fetches and checks the release asset
|
|
112
|
+
ocr = GlypharisOCR.from_pretrained("glypharis-v1") # a model bundle by name or path
|
|
113
|
+
result = ocr.predict("page.png") # path, image file bytes, PIL image or numpy array
|
|
114
|
+
|
|
115
|
+
print(result.text) # lines in reading order
|
|
116
|
+
for line in result.lines:
|
|
117
|
+
print(line.text, line.confidence, line.bbox)
|
|
118
|
+
print(result.to_json()) # the same as structured JSON
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
From the command line:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
glypharis-ocr --image page.png --output results
|
|
125
|
+
glypharis-ocr --input-dir scans/ --recursive --format json txt
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Each image gives `results/<name>.json` and `results/<name>.txt`. The default backend is PyTorch on the
|
|
129
|
+
CPU; `--backend onnx` (or `backend="onnx"`) uses ONNX Runtime, which matches PyTorch within the
|
|
130
|
+
project's export tolerances but is slower on the CPU
|
|
131
|
+
([model card](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/MODEL_CARD.md)).
|
|
132
|
+
|
|
133
|
+
Over HTTP (standard library only, one request at a time, for local use without authentication or
|
|
134
|
+
TLS):
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
glypharis-serve --model glypharis-v1 --port 8080
|
|
138
|
+
curl --data-binary @page.png http://127.0.0.1:8080/ocr
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`POST /ocr` takes the image file as the request body and answers with the same JSON; `GET /health`
|
|
142
|
+
reports the versions.
|
|
143
|
+
|
|
144
|
+
## How it works
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
image ─▶ preprocessing ─▶ GLYPHARIS-Det (line detector) ─▶ crop + rectify
|
|
148
|
+
─▶ GLYPHARIS-Rec (CTC line recognizer) ─▶ reading order ─▶ structured result
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- **GLYPHARIS-Det**: DBNet-style text-line detector with a MobileNetV3 backbone.
|
|
152
|
+
- **GLYPHARIS-Rec**: SVTR-style CTC line recognizer in v1 (a CNN + BiLSTM + CTC recognizer is the
|
|
153
|
+
baseline).
|
|
154
|
+
- Stands alone: any application can call it with an image. It contains no application-specific code.
|
|
155
|
+
|
|
156
|
+
What v1 is, how it measured and where it fails are in the
|
|
157
|
+
[model card](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/MODEL_CARD.md), with every number
|
|
158
|
+
traced to its experiment and report.
|
|
159
|
+
|
|
160
|
+
## Licence
|
|
161
|
+
|
|
162
|
+
The code is licensed under Apache-2.0
|
|
163
|
+
([LICENSE](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/LICENSE)).
|
|
164
|
+
[NOTICE](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/NOTICE) lists the material in the
|
|
165
|
+
repository that the licence does not cover.
|
|
166
|
+
|
|
167
|
+
The weights are not part of this package. They are distributed under CC BY-SA 4.0 with attribution
|
|
168
|
+
to HierText and Open Images
|
|
169
|
+
([ADR-0014](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/docs/decisions/ADR-0014-weights-and-backbone-terms.md)),
|
|
170
|
+
and their archive carries `LICENSE-WEIGHTS` and a `NOTICE.md` with the attribution. The detector was
|
|
171
|
+
initialised from ImageNet weights, a disclosed exception to the project's commercial-use rule
|
|
172
|
+
([ADR-0009](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/docs/decisions/ADR-0009-no-synthtext.md)),
|
|
173
|
+
and the weights are not described as cleared for commercial use. The owner decided on 2026-11-22 to
|
|
174
|
+
publish them under these terms without the qualified advice ADR-0014 had asked for; this is the
|
|
175
|
+
project's chosen handling, not a legal conclusion. The terms of each dataset are in
|
|
176
|
+
[DATASETS.md](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/DATASETS.md).
|
|
177
|
+
|
|
178
|
+
## Citing
|
|
179
|
+
|
|
180
|
+
Cite with [CITATION.cff](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/CITATION.cff); a Zenodo
|
|
181
|
+
DOI is added after the deposit.
|
|
182
|
+
|
|
183
|
+
## Links
|
|
184
|
+
|
|
185
|
+
- [Repository at the tag `v1.0`](https://github.com/DuhItzAniket/Glypharis/tree/v1.0)
|
|
186
|
+
- [Release v1.0, with the weights](https://github.com/DuhItzAniket/Glypharis/releases/tag/v1.0)
|
|
187
|
+
- [Release notes](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/docs/RELEASE_NOTES_v1.0.md)
|
|
188
|
+
- [Model card](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/MODEL_CARD.md)
|
|
189
|
+
- [Changelog](https://github.com/DuhItzAniket/Glypharis/blob/v1.0/CHANGELOG.md)
|
|
190
|
+
- [Issues](https://github.com/DuhItzAniket/Glypharis/issues)
|