fastplateocr-py 0.1.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.
Files changed (131) hide show
  1. fastplateocr_py-0.1.0/.gitignore +42 -0
  2. fastplateocr_py-0.1.0/LICENSE +201 -0
  3. fastplateocr_py-0.1.0/MANIFEST.in +8 -0
  4. fastplateocr_py-0.1.0/PKG-INFO +197 -0
  5. fastplateocr_py-0.1.0/README.md +167 -0
  6. fastplateocr_py-0.1.0/build_package.py +170 -0
  7. fastplateocr_py-0.1.0/configs/det/yolo26/yolo26n_rep_mixer.yml +41 -0
  8. fastplateocr_py-0.1.0/configs/rec/svtrv2/svtrv2_tiny_efficient_rctc.yml +122 -0
  9. fastplateocr_py-0.1.0/dataset/det/data.yaml +6 -0
  10. fastplateocr_py-0.1.0/dataset/det/test/images/carlong_0002.png +0 -0
  11. fastplateocr_py-0.1.0/dataset/det/test/images/carlong_0008.png +0 -0
  12. fastplateocr_py-0.1.0/dataset/det/test/images/carlong_0078.png +0 -0
  13. fastplateocr_py-0.1.0/dataset/det/test/images/carlong_0120.png +0 -0
  14. fastplateocr_py-0.1.0/dataset/det/test/images/carlong_0178.png +0 -0
  15. fastplateocr_py-0.1.0/dataset/det/test/labels/carlong_0002.txt +1 -0
  16. fastplateocr_py-0.1.0/dataset/det/test/labels/carlong_0008.txt +1 -0
  17. fastplateocr_py-0.1.0/dataset/det/test/labels/carlong_0078.txt +1 -0
  18. fastplateocr_py-0.1.0/dataset/det/test/labels/carlong_0120.txt +1 -0
  19. fastplateocr_py-0.1.0/dataset/det/test/labels/carlong_0178.txt +1 -0
  20. fastplateocr_py-0.1.0/dataset/det/train/images/carlong_0183.png +0 -0
  21. fastplateocr_py-0.1.0/dataset/det/train/images/carlong_0184.png +0 -0
  22. fastplateocr_py-0.1.0/dataset/det/train/images/carlong_0189.png +0 -0
  23. fastplateocr_py-0.1.0/dataset/det/train/images/carlong_0199.png +0 -0
  24. fastplateocr_py-0.1.0/dataset/det/train/images/carlong_0223.png +0 -0
  25. fastplateocr_py-0.1.0/dataset/det/train/images/carlong_0234.png +0 -0
  26. fastplateocr_py-0.1.0/dataset/det/train/images/carlong_0236.png +0 -0
  27. fastplateocr_py-0.1.0/dataset/det/train/images/carlong_0263.png +0 -0
  28. fastplateocr_py-0.1.0/dataset/det/train/images/carlong_0265.png +0 -0
  29. fastplateocr_py-0.1.0/dataset/det/train/labels/carlong_0183.txt +1 -0
  30. fastplateocr_py-0.1.0/dataset/det/train/labels/carlong_0184.txt +1 -0
  31. fastplateocr_py-0.1.0/dataset/det/train/labels/carlong_0189.txt +1 -0
  32. fastplateocr_py-0.1.0/dataset/det/train/labels/carlong_0199.txt +1 -0
  33. fastplateocr_py-0.1.0/dataset/det/train/labels/carlong_0223.txt +1 -0
  34. fastplateocr_py-0.1.0/dataset/det/train/labels/carlong_0234.txt +1 -0
  35. fastplateocr_py-0.1.0/dataset/det/train/labels/carlong_0236.txt +1 -0
  36. fastplateocr_py-0.1.0/dataset/det/train/labels/carlong_0263.txt +1 -0
  37. fastplateocr_py-0.1.0/dataset/det/train/labels/carlong_0265.txt +1 -0
  38. fastplateocr_py-0.1.0/dataset/det/val/images/carlong_0130.png +0 -0
  39. fastplateocr_py-0.1.0/dataset/det/val/images/carlong_0133.png +0 -0
  40. fastplateocr_py-0.1.0/dataset/det/val/images/carlong_0134.png +0 -0
  41. fastplateocr_py-0.1.0/dataset/det/val/images/carlong_0174.png +0 -0
  42. fastplateocr_py-0.1.0/dataset/det/val/labels/carlong_0130.txt +1 -0
  43. fastplateocr_py-0.1.0/dataset/det/val/labels/carlong_0133.txt +1 -0
  44. fastplateocr_py-0.1.0/dataset/det/val/labels/carlong_0134.txt +1 -0
  45. fastplateocr_py-0.1.0/dataset/det/val/labels/carlong_0174.txt +1 -0
  46. fastplateocr_py-0.1.0/dataset/rec/lmdb_data/.gitkeep +0 -0
  47. fastplateocr_py-0.1.0/dataset/rec/test/a10.jpg +0 -0
  48. fastplateocr_py-0.1.0/dataset/rec/test/a9_crop0.jpg +0 -0
  49. fastplateocr_py-0.1.0/dataset/rec/test/a9_crop1.jpg +0 -0
  50. fastplateocr_py-0.1.0/dataset/rec/test/a9_crop2.jpg +0 -0
  51. fastplateocr_py-0.1.0/dataset/rec/test/a9_crop3.jpg +0 -0
  52. fastplateocr_py-0.1.0/dataset/rec/test_labels.txt +5 -0
  53. fastplateocr_py-0.1.0/dataset/rec/train/a1.jpg +0 -0
  54. fastplateocr_py-0.1.0/dataset/rec/train/a2.jpg +0 -0
  55. fastplateocr_py-0.1.0/dataset/rec/train/a3.jpg +0 -0
  56. fastplateocr_py-0.1.0/dataset/rec/train/a4.jpg +0 -0
  57. fastplateocr_py-0.1.0/dataset/rec/train/a66_crop0.jpg +0 -0
  58. fastplateocr_py-0.1.0/dataset/rec/train_labels.txt +5 -0
  59. fastplateocr_py-0.1.0/dataset/rec/val/a6.jpg +0 -0
  60. fastplateocr_py-0.1.0/dataset/rec/val/a7.jpg +0 -0
  61. fastplateocr_py-0.1.0/dataset/rec/val_labels.txt +2 -0
  62. fastplateocr_py-0.1.0/examples/demo.ipynb +122 -0
  63. fastplateocr_py-0.1.0/fastplateocr/__init__.py +5 -0
  64. fastplateocr_py-0.1.0/fastplateocr/det/__init__.py +1 -0
  65. fastplateocr_py-0.1.0/fastplateocr/det/c3k2/__init__.py +0 -0
  66. fastplateocr_py-0.1.0/fastplateocr/det/c3k2/bottleneck/__init__.py +0 -0
  67. fastplateocr_py-0.1.0/fastplateocr/det/c3k2/bottleneck/rep_mixer.py +81 -0
  68. fastplateocr_py-0.1.0/fastplateocr/license_plate_dict.txt +37 -0
  69. fastplateocr_py-0.1.0/fastplateocr/pipeline.py +185 -0
  70. fastplateocr_py-0.1.0/fastplateocr/rec/losses/__init__.py +71 -0
  71. fastplateocr_py-0.1.0/fastplateocr/rec/losses/ctc_loss.py +33 -0
  72. fastplateocr_py-0.1.0/fastplateocr/rec/metrics/__init__.py +33 -0
  73. fastplateocr_py-0.1.0/fastplateocr/rec/metrics/rec_metric.py +286 -0
  74. fastplateocr_py-0.1.0/fastplateocr/rec/modeling/__init__.py +11 -0
  75. fastplateocr_py-0.1.0/fastplateocr/rec/modeling/base_recognizer.py +58 -0
  76. fastplateocr_py-0.1.0/fastplateocr/rec/modeling/common.py +238 -0
  77. fastplateocr_py-0.1.0/fastplateocr/rec/modeling/decoders/__init__.py +21 -0
  78. fastplateocr_py-0.1.0/fastplateocr/rec/modeling/decoders/efficient_rctc_decoder.py +60 -0
  79. fastplateocr_py-0.1.0/fastplateocr/rec/modeling/encoders/__init__.py +22 -0
  80. fastplateocr_py-0.1.0/fastplateocr/rec/modeling/encoders/svtrv2.py +470 -0
  81. fastplateocr_py-0.1.0/fastplateocr/rec/modeling/encoders/svtrv2_lnconv.py +503 -0
  82. fastplateocr_py-0.1.0/fastplateocr/rec/modeling/encoders/svtrv2_lnconv_two33.py +636 -0
  83. fastplateocr_py-0.1.0/fastplateocr/rec/optimizer/__init__.py +74 -0
  84. fastplateocr_py-0.1.0/fastplateocr/rec/optimizer/lr.py +276 -0
  85. fastplateocr_py-0.1.0/fastplateocr/rec/postprocess/__init__.py +26 -0
  86. fastplateocr_py-0.1.0/fastplateocr/rec/postprocess/ctc_postprocess.py +118 -0
  87. fastplateocr_py-0.1.0/fastplateocr/rec/preprocess/__init__.py +78 -0
  88. fastplateocr_py-0.1.0/fastplateocr/rec/preprocess/auto_augment.py +494 -0
  89. fastplateocr_py-0.1.0/fastplateocr/rec/preprocess/ctc_label_encode.py +124 -0
  90. fastplateocr_py-0.1.0/fastplateocr/rec/preprocess/parseq_aug.py +150 -0
  91. fastplateocr_py-0.1.0/fastplateocr/rec/preprocess/rec_aug.py +13 -0
  92. fastplateocr_py-0.1.0/fastplateocr.py +101 -0
  93. fastplateocr_py-0.1.0/fastplateocr_py.egg-info/PKG-INFO +197 -0
  94. fastplateocr_py-0.1.0/fastplateocr_py.egg-info/SOURCES.txt +129 -0
  95. fastplateocr_py-0.1.0/fastplateocr_py.egg-info/dependency_links.txt +1 -0
  96. fastplateocr_py-0.1.0/fastplateocr_py.egg-info/not-zip-safe +1 -0
  97. fastplateocr_py-0.1.0/fastplateocr_py.egg-info/requires.txt +7 -0
  98. fastplateocr_py-0.1.0/fastplateocr_py.egg-info/top_level.txt +1 -0
  99. fastplateocr_py-0.1.0/output/det/svtrv2_tiny_efficient_rctc/.gitkeep +0 -0
  100. fastplateocr_py-0.1.0/output/det/yolo26n_rep_mixer/.gitkeep +0 -0
  101. fastplateocr_py-0.1.0/output/rec/svtrv2_tiny_efficient_rctc/.gitkeep +0 -0
  102. fastplateocr_py-0.1.0/output/rec/yolo26n_rep_mixer/.gitkeep +0 -0
  103. fastplateocr_py-0.1.0/pretrained_models/det/yolo26n_rep_mixer/.gitkeep +0 -0
  104. fastplateocr_py-0.1.0/pretrained_models/rec/svtrv2_tiny_efficient_rctc/.gitkeep +0 -0
  105. fastplateocr_py-0.1.0/pyproject.toml +55 -0
  106. fastplateocr_py-0.1.0/requirements.txt +9 -0
  107. fastplateocr_py-0.1.0/setup.cfg +4 -0
  108. fastplateocr_py-0.1.0/setup.py +85 -0
  109. fastplateocr_py-0.1.0/tools/__init__.py +0 -0
  110. fastplateocr_py-0.1.0/tools/create_lmdb_dataset.py +124 -0
  111. fastplateocr_py-0.1.0/tools/data/__init__.py +110 -0
  112. fastplateocr_py-0.1.0/tools/data/collate_fn.py +100 -0
  113. fastplateocr_py-0.1.0/tools/data/lmdb_dataset.py +142 -0
  114. fastplateocr_py-0.1.0/tools/data/ratio_dataset_tvresize.py +215 -0
  115. fastplateocr_py-0.1.0/tools/data/ratio_sampler.py +191 -0
  116. fastplateocr_py-0.1.0/tools/engine/config.py +158 -0
  117. fastplateocr_py-0.1.0/tools/engine/trainer.py +592 -0
  118. fastplateocr_py-0.1.0/tools/eval_det.py +70 -0
  119. fastplateocr_py-0.1.0/tools/eval_rec.py +44 -0
  120. fastplateocr_py-0.1.0/tools/infer_det.py +160 -0
  121. fastplateocr_py-0.1.0/tools/infer_rec.py +190 -0
  122. fastplateocr_py-0.1.0/tools/train_det.py +45 -0
  123. fastplateocr_py-0.1.0/tools/train_rec.py +42 -0
  124. fastplateocr_py-0.1.0/tools/utility.py +45 -0
  125. fastplateocr_py-0.1.0/tools/utils/__init__.py +0 -0
  126. fastplateocr_py-0.1.0/tools/utils/ckpt.py +99 -0
  127. fastplateocr_py-0.1.0/tools/utils/gen_label.py +68 -0
  128. fastplateocr_py-0.1.0/tools/utils/license_plate_dict.txt +37 -0
  129. fastplateocr_py-0.1.0/tools/utils/logging.py +54 -0
  130. fastplateocr_py-0.1.0/tools/utils/stats.py +58 -0
  131. fastplateocr_py-0.1.0/tools/utils/utility.py +165 -0
@@ -0,0 +1,42 @@
1
+ # Python and Environment
2
+ __pycache__/
3
+ .ipynb_checkpoints/
4
+ *.py[cod]
5
+ *$py.class
6
+ *.so
7
+ env/
8
+ venv/
9
+ .env
10
+
11
+ # Build and Distribution
12
+ build/
13
+ dist/
14
+ *.egg-info/
15
+
16
+ # IDE and OS
17
+ .vscode/
18
+ .idea/
19
+ *.DS_Store
20
+ *.vs
21
+ *.user
22
+ *~
23
+
24
+ # Logs and Outputs
25
+ *.log
26
+ output/
27
+ inference/
28
+ inference_results/
29
+ e2e_results/
30
+ rec_results/
31
+ det_results/
32
+ test_output/
33
+ gradio_outputs/
34
+
35
+ # Data and Models
36
+ dataset/
37
+ train_data/
38
+ train_data_lmdb/
39
+ pretrained_models/
40
+ *.pt
41
+ *.pth
42
+ *.safetensors
@@ -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.
@@ -0,0 +1,8 @@
1
+ include README.md
2
+ include LICENSE
3
+
4
+ # Include all Python files
5
+ recursive-include fastplateocr *.py
6
+
7
+ # Include dictionary files
8
+ recursive-include fastplateocr *.txt
@@ -0,0 +1,197 @@
1
+ Metadata-Version: 2.1
2
+ Name: fastplateocr-py
3
+ Version: 0.1.0
4
+ Summary: Accurate and Efficient General OCR System for License Plates
5
+ Home-page: https://github.com/vn-anhnth/FastPlateOCR
6
+ Author: vn-anhnth
7
+ Author-email: vn-anhnth <anhlone3@gmail.com>
8
+ License: Apache License 2.0
9
+ Project-URL: Homepage, https://github.com/vn-anhnth/FastPlateOCR
10
+ Project-URL: Bug Reports, https://github.com/vn-anhnth/FastPlateOCR/issues
11
+ Keywords: ocr,license plate recognition,yolo26,svtr,deep learning,computer vision
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: numpy
24
+ Requires-Dist: opencv-python
25
+ Requires-Dist: pyyaml
26
+ Requires-Dist: huggingface-hub
27
+ Requires-Dist: torch>=1.7.0
28
+ Requires-Dist: torchvision
29
+ Requires-Dist: ultralytics
30
+
31
+ # FastPlateOCR
32
+
33
+ 🚀 **FastPlateOCR** is an accurate, extremely fast, and flexible End-to-End License Plate Recognition library.
34
+
35
+ This project is deeply inspired by and based on the excellent [OpenOCR](https://github.com/Top-Fighter/OpenOCR) framework. We have specialized and optimized the architecture specifically for reading License Plates in challenging real-world conditions.
36
+
37
+ By integrating the lightweight object detection prowess of **YOLO26 (with RepMixer Bottlenecks)** and the lightning-fast text recognition of **SVTRv2**, FastPlateOCR delivers production-ready performance!
38
+
39
+ ---
40
+
41
+ ## 🛠 Installation
42
+
43
+ ```bash
44
+ pip install fastplateocr-py
45
+ ```
46
+
47
+ *(Note: To use the auto-download feature for pre-trained weights, please ensure `huggingface_hub` is installed).*
48
+
49
+ ## ⚡ Quick Start
50
+
51
+ FastPlateOCR automatically downloads the best pre-trained models from our HuggingFace repository the first time you run it. You don't need to manually configure any paths!
52
+
53
+ ### 1. End-to-End Recognition (Detect & Read)
54
+
55
+ ```python
56
+ import cv2
57
+ from fastplateocr import FastPlateOCR
58
+
59
+ # Initialize (auto-downloads weights if not found)
60
+ model = FastPlateOCR()
61
+
62
+ # Read the plate
63
+ results = model.read('car_image.jpg')
64
+
65
+ for res in results:
66
+ print(f"Plate Text: {res['text']} | Confidence: {res['score']:.4f}")
67
+ print(f"Bounding Box: {res['box']}")
68
+ ```
69
+
70
+ ### 2. Flexible API: Detect Only
71
+ If you only need to locate the license plates without reading the text:
72
+ ```python
73
+ # Disable the recognition model to save memory
74
+ model = FastPlateOCR(use_rec=False)
75
+ boxes = model.detect('car_image.jpg')
76
+ print("Detected boxes:", boxes)
77
+ ```
78
+
79
+ ### 3. Flexible API: Recognize Only
80
+ If you already have a cropped image of a license plate and just want to read the characters:
81
+ ```python
82
+ # Disable the detection model
83
+ model = FastPlateOCR(use_det=False)
84
+
85
+ crop_img = cv2.imread('cropped_plate.jpg')
86
+ text, score = model.recognize(crop_img)
87
+ print(f"Text: {text} (Score: {score})")
88
+ ```
89
+
90
+ ### 4. Using Custom Local Weights
91
+ If you have fine-tuned your own models or downloaded the weights locally, you can easily load them:
92
+ ```python
93
+ model = FastPlateOCR(
94
+ det_model_path="/path/to/your/yolo.pt",
95
+ rec_model_path="/path/to/your/svtr.pth"
96
+ )
97
+ ```
98
+
99
+ ## 🏋️ Training & Evaluation
100
+
101
+ FastPlateOCR provides a complete suite of scripts in the `tools/` directory for dataset preparation, training, evaluation, and inference.
102
+
103
+ ### 0. Model Weights Preparation
104
+ Before training or evaluation, download the official pre-trained models from our [HuggingFace Repository](https://huggingface.co/anhone3/FastPlateOCR) and place them in the following structure:
105
+ ```
106
+ FastPlateOCR/
107
+ ├── pretrained_models/
108
+ │ ├── yolo26n_rep_mixer/
109
+ │ │ └── best.pt
110
+ │ └── svtrv2_tiny_efficient_rctc/
111
+ │ └── best.pth
112
+ ```
113
+ You can download them manually or use `wget`:
114
+ ```bash
115
+ wget -O pretrained_models/det/yolo26n_rep_mixer/best.pt https://huggingface.co/anhone3/FastPlateOCR/resolve/main/yolo26n_rep_mixer/best.pt
116
+ wget -O pretrained_models/rec/svtrv2_tiny_efficient_rctc/best.pth https://huggingface.co/anhone3/FastPlateOCR/resolve/main/svtrv2_tiny_efficient_rctc/best.pth
117
+ ```
118
+
119
+ ### 1. Data Preparation (Create LMDB)
120
+ Because our LMDB script uses hardcoded paths for simplicity, please open `tools/create_lmdb_dataset.py` and modify the `data_dir` variable in the `__main__` block to match your dataset path before running:
121
+ ```python
122
+ if __name__ == '__main__':
123
+ data_dir = './dataset/rec' # Set your dataset directory
124
+
125
+ label_file_list = [
126
+ os.path.join(data_dir, 'train_labels.txt'),
127
+ os.path.join(data_dir, 'val_labels.txt'),
128
+ os.path.join(data_dir, 'test_labels.txt')
129
+ ]
130
+ ```
131
+ After modifying the paths, generate the LMDB:
132
+ ```bash
133
+ python tools/create_lmdb_dataset.py
134
+ ```
135
+
136
+ ### 2. Training (Det & Rec)
137
+ Before training, you must configure the dataset paths, batch sizes, and learning rates in the respective `.yml` files.
138
+
139
+ **For Detection (`configs/det/yolo26/yolo26n_rep_mixer.yml`):**
140
+ ```yaml
141
+ Train:
142
+ data: './dataset/det/data.yaml' # Point this to your YOLO data.yaml
143
+ epochs: 50
144
+ batch: 256
145
+ ```
146
+
147
+ **For Recognition (`configs/rec/svtrv2/svtrv2_tiny_efficient_rctc.yml`):**
148
+ ```yaml
149
+ Train:
150
+ dataset:
151
+ name: RatioDataSetTVResize
152
+ data_dir_list: ['./dataset/rec/lmdb_data/train']
153
+
154
+ Eval:
155
+ dataset:
156
+ name: RatioDataSetTVResize
157
+ data_dir_list: ['./dataset/rec/lmdb_data/val']
158
+ ```
159
+
160
+ Once configured, start training:
161
+ ```bash
162
+ # Train Detection Model (YOLO26)
163
+ python tools/train_det.py -c configs/det/yolo26/yolo26n_rep_mixer.yml
164
+
165
+ # Train Recognition Model (SVTRv2)
166
+ python tools/train_rec.py -c configs/rec/svtrv2/svtrv2_tiny_efficient_rctc.yml
167
+ ```
168
+
169
+ ### 3. Evaluation (Validation)
170
+ Evaluate your trained checkpoints on the validation set using the config files:
171
+ ```bash
172
+ # Evaluate Detection
173
+ python tools/eval_det.py -c configs/det/yolo26/yolo26n_rep_mixer.yml
174
+
175
+ # Evaluate Recognition
176
+ python tools/eval_rec.py -c configs/rec/svtrv2/svtrv2_tiny_efficient_rctc.yml
177
+ ```
178
+
179
+ ### 4. Batch Inference
180
+ Test your checkpoints directly on directories of images (supports `--save_log` to save predictions):
181
+ ```bash
182
+ # Infer Detection
183
+ python tools/infer_det.py -m pretrained_models/det/yolo26n_rep_mixer/best.pt -d dataset/det/test/images --save_log
184
+
185
+ # Infer Recognition
186
+ python tools/infer_rec.py -m pretrained_models/rec/svtrv2_tiny_efficient_rctc/best.pth -d dataset/rec/test --save_log
187
+ ```
188
+
189
+ ## 🤝 Acknowledgements
190
+
191
+ - **OpenOCR**: FastPlateOCR is built upon the robust foundation of [OpenOCR](https://github.com/Topdu/OpenOCR).
192
+ - **YOLO26 & SVTRv2**: This work heavily leverages the architectural innovations from **YOLO26** for high-speed object detection and **SVTRv2** for accurate text recognition.
193
+ - Read the [YOLO26 Paper](https://arxiv.org/abs/2606.03748)
194
+ - Read the [SVTRv2 Paper](https://arxiv.org/html/2411.15858v1)
195
+
196
+ ## 📧 Contact
197
+ For any questions or issues, please open an issue or contact: `anhlone3@gmail.com`.
@@ -0,0 +1,167 @@
1
+ # FastPlateOCR
2
+
3
+ 🚀 **FastPlateOCR** is an accurate, extremely fast, and flexible End-to-End License Plate Recognition library.
4
+
5
+ This project is deeply inspired by and based on the excellent [OpenOCR](https://github.com/Top-Fighter/OpenOCR) framework. We have specialized and optimized the architecture specifically for reading License Plates in challenging real-world conditions.
6
+
7
+ By integrating the lightweight object detection prowess of **YOLO26 (with RepMixer Bottlenecks)** and the lightning-fast text recognition of **SVTRv2**, FastPlateOCR delivers production-ready performance!
8
+
9
+ ---
10
+
11
+ ## 🛠 Installation
12
+
13
+ ```bash
14
+ pip install fastplateocr-py
15
+ ```
16
+
17
+ *(Note: To use the auto-download feature for pre-trained weights, please ensure `huggingface_hub` is installed).*
18
+
19
+ ## ⚡ Quick Start
20
+
21
+ FastPlateOCR automatically downloads the best pre-trained models from our HuggingFace repository the first time you run it. You don't need to manually configure any paths!
22
+
23
+ ### 1. End-to-End Recognition (Detect & Read)
24
+
25
+ ```python
26
+ import cv2
27
+ from fastplateocr import FastPlateOCR
28
+
29
+ # Initialize (auto-downloads weights if not found)
30
+ model = FastPlateOCR()
31
+
32
+ # Read the plate
33
+ results = model.read('car_image.jpg')
34
+
35
+ for res in results:
36
+ print(f"Plate Text: {res['text']} | Confidence: {res['score']:.4f}")
37
+ print(f"Bounding Box: {res['box']}")
38
+ ```
39
+
40
+ ### 2. Flexible API: Detect Only
41
+ If you only need to locate the license plates without reading the text:
42
+ ```python
43
+ # Disable the recognition model to save memory
44
+ model = FastPlateOCR(use_rec=False)
45
+ boxes = model.detect('car_image.jpg')
46
+ print("Detected boxes:", boxes)
47
+ ```
48
+
49
+ ### 3. Flexible API: Recognize Only
50
+ If you already have a cropped image of a license plate and just want to read the characters:
51
+ ```python
52
+ # Disable the detection model
53
+ model = FastPlateOCR(use_det=False)
54
+
55
+ crop_img = cv2.imread('cropped_plate.jpg')
56
+ text, score = model.recognize(crop_img)
57
+ print(f"Text: {text} (Score: {score})")
58
+ ```
59
+
60
+ ### 4. Using Custom Local Weights
61
+ If you have fine-tuned your own models or downloaded the weights locally, you can easily load them:
62
+ ```python
63
+ model = FastPlateOCR(
64
+ det_model_path="/path/to/your/yolo.pt",
65
+ rec_model_path="/path/to/your/svtr.pth"
66
+ )
67
+ ```
68
+
69
+ ## 🏋️ Training & Evaluation
70
+
71
+ FastPlateOCR provides a complete suite of scripts in the `tools/` directory for dataset preparation, training, evaluation, and inference.
72
+
73
+ ### 0. Model Weights Preparation
74
+ Before training or evaluation, download the official pre-trained models from our [HuggingFace Repository](https://huggingface.co/anhone3/FastPlateOCR) and place them in the following structure:
75
+ ```
76
+ FastPlateOCR/
77
+ ├── pretrained_models/
78
+ │ ├── yolo26n_rep_mixer/
79
+ │ │ └── best.pt
80
+ │ └── svtrv2_tiny_efficient_rctc/
81
+ │ └── best.pth
82
+ ```
83
+ You can download them manually or use `wget`:
84
+ ```bash
85
+ wget -O pretrained_models/det/yolo26n_rep_mixer/best.pt https://huggingface.co/anhone3/FastPlateOCR/resolve/main/yolo26n_rep_mixer/best.pt
86
+ wget -O pretrained_models/rec/svtrv2_tiny_efficient_rctc/best.pth https://huggingface.co/anhone3/FastPlateOCR/resolve/main/svtrv2_tiny_efficient_rctc/best.pth
87
+ ```
88
+
89
+ ### 1. Data Preparation (Create LMDB)
90
+ Because our LMDB script uses hardcoded paths for simplicity, please open `tools/create_lmdb_dataset.py` and modify the `data_dir` variable in the `__main__` block to match your dataset path before running:
91
+ ```python
92
+ if __name__ == '__main__':
93
+ data_dir = './dataset/rec' # Set your dataset directory
94
+
95
+ label_file_list = [
96
+ os.path.join(data_dir, 'train_labels.txt'),
97
+ os.path.join(data_dir, 'val_labels.txt'),
98
+ os.path.join(data_dir, 'test_labels.txt')
99
+ ]
100
+ ```
101
+ After modifying the paths, generate the LMDB:
102
+ ```bash
103
+ python tools/create_lmdb_dataset.py
104
+ ```
105
+
106
+ ### 2. Training (Det & Rec)
107
+ Before training, you must configure the dataset paths, batch sizes, and learning rates in the respective `.yml` files.
108
+
109
+ **For Detection (`configs/det/yolo26/yolo26n_rep_mixer.yml`):**
110
+ ```yaml
111
+ Train:
112
+ data: './dataset/det/data.yaml' # Point this to your YOLO data.yaml
113
+ epochs: 50
114
+ batch: 256
115
+ ```
116
+
117
+ **For Recognition (`configs/rec/svtrv2/svtrv2_tiny_efficient_rctc.yml`):**
118
+ ```yaml
119
+ Train:
120
+ dataset:
121
+ name: RatioDataSetTVResize
122
+ data_dir_list: ['./dataset/rec/lmdb_data/train']
123
+
124
+ Eval:
125
+ dataset:
126
+ name: RatioDataSetTVResize
127
+ data_dir_list: ['./dataset/rec/lmdb_data/val']
128
+ ```
129
+
130
+ Once configured, start training:
131
+ ```bash
132
+ # Train Detection Model (YOLO26)
133
+ python tools/train_det.py -c configs/det/yolo26/yolo26n_rep_mixer.yml
134
+
135
+ # Train Recognition Model (SVTRv2)
136
+ python tools/train_rec.py -c configs/rec/svtrv2/svtrv2_tiny_efficient_rctc.yml
137
+ ```
138
+
139
+ ### 3. Evaluation (Validation)
140
+ Evaluate your trained checkpoints on the validation set using the config files:
141
+ ```bash
142
+ # Evaluate Detection
143
+ python tools/eval_det.py -c configs/det/yolo26/yolo26n_rep_mixer.yml
144
+
145
+ # Evaluate Recognition
146
+ python tools/eval_rec.py -c configs/rec/svtrv2/svtrv2_tiny_efficient_rctc.yml
147
+ ```
148
+
149
+ ### 4. Batch Inference
150
+ Test your checkpoints directly on directories of images (supports `--save_log` to save predictions):
151
+ ```bash
152
+ # Infer Detection
153
+ python tools/infer_det.py -m pretrained_models/det/yolo26n_rep_mixer/best.pt -d dataset/det/test/images --save_log
154
+
155
+ # Infer Recognition
156
+ python tools/infer_rec.py -m pretrained_models/rec/svtrv2_tiny_efficient_rctc/best.pth -d dataset/rec/test --save_log
157
+ ```
158
+
159
+ ## 🤝 Acknowledgements
160
+
161
+ - **OpenOCR**: FastPlateOCR is built upon the robust foundation of [OpenOCR](https://github.com/Topdu/OpenOCR).
162
+ - **YOLO26 & SVTRv2**: This work heavily leverages the architectural innovations from **YOLO26** for high-speed object detection and **SVTRv2** for accurate text recognition.
163
+ - Read the [YOLO26 Paper](https://arxiv.org/abs/2606.03748)
164
+ - Read the [SVTRv2 Paper](https://arxiv.org/html/2411.15858v1)
165
+
166
+ ## 📧 Contact
167
+ For any questions or issues, please open an issue or contact: `anhlone3@gmail.com`.