openocr-python 0.1.0.dev0__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 (391) hide show
  1. openocr_python-0.1.0.dev0/LICENSE +201 -0
  2. openocr_python-0.1.0.dev0/MANIFEST.in +20 -0
  3. openocr_python-0.1.0.dev0/PKG-INFO +324 -0
  4. openocr_python-0.1.0.dev0/QUICKSTART.md +261 -0
  5. openocr_python-0.1.0.dev0/openocr/__init__.py +45 -0
  6. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/evaluation.yaml +41 -0
  7. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/ltb.yaml +9 -0
  8. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/mjsynth.yaml +11 -0
  9. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/openvino.yaml +25 -0
  10. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/ost.yaml +17 -0
  11. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/synthtext.yaml +7 -0
  12. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/test.yaml +77 -0
  13. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/textocr.yaml +13 -0
  14. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/textocr_horizontal.yaml +13 -0
  15. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/union14m_b.yaml +47 -0
  16. openocr_python-0.1.0.dev0/openocr/configs/dataset/rec/union14m_l_filtered.yaml +35 -0
  17. openocr_python-0.1.0.dev0/openocr/configs/det/dbnet/repvit_db.yml +171 -0
  18. openocr_python-0.1.0.dev0/openocr/configs/rec/abinet/resnet45_trans_abinet_lang.yml +94 -0
  19. openocr_python-0.1.0.dev0/openocr/configs/rec/abinet/resnet45_trans_abinet_wo_lang.yml +93 -0
  20. openocr_python-0.1.0.dev0/openocr/configs/rec/abinet/svtrv2_abinet_lang.yml +130 -0
  21. openocr_python-0.1.0.dev0/openocr/configs/rec/abinet/svtrv2_abinet_wo_lang.yml +128 -0
  22. openocr_python-0.1.0.dev0/openocr/configs/rec/aster/resnet31_lstm_aster_tps_on.yml +93 -0
  23. openocr_python-0.1.0.dev0/openocr/configs/rec/aster/svtrv2_aster.yml +127 -0
  24. openocr_python-0.1.0.dev0/openocr/configs/rec/aster/svtrv2_aster_tps_on.yml +102 -0
  25. openocr_python-0.1.0.dev0/openocr/configs/rec/autostr/autostr_lstm_aster_tps_on.yml +95 -0
  26. openocr_python-0.1.0.dev0/openocr/configs/rec/busnet/svtrv2_busnet.yml +135 -0
  27. openocr_python-0.1.0.dev0/openocr/configs/rec/busnet/svtrv2_busnet_pretraining.yml +134 -0
  28. openocr_python-0.1.0.dev0/openocr/configs/rec/busnet/vit_busnet.yml +104 -0
  29. openocr_python-0.1.0.dev0/openocr/configs/rec/busnet/vit_busnet_pretraining.yml +104 -0
  30. openocr_python-0.1.0.dev0/openocr/configs/rec/cam/convnextv2_cam_tps_on.yml +118 -0
  31. openocr_python-0.1.0.dev0/openocr/configs/rec/cam/convnextv2_tiny_cam_tps_on.yml +118 -0
  32. openocr_python-0.1.0.dev0/openocr/configs/rec/cam/svtrv2_cam_tps_on.yml +123 -0
  33. openocr_python-0.1.0.dev0/openocr/configs/rec/cdistnet/resnet45_trans_cdistnet.yml +93 -0
  34. openocr_python-0.1.0.dev0/openocr/configs/rec/cdistnet/svtrv2_cdistnet.yml +139 -0
  35. openocr_python-0.1.0.dev0/openocr/configs/rec/cmer/cmer.yml +127 -0
  36. openocr_python-0.1.0.dev0/openocr/configs/rec/cppd/svtr_base_cppd.yml +123 -0
  37. openocr_python-0.1.0.dev0/openocr/configs/rec/cppd/svtr_base_cppd_ch.yml +126 -0
  38. openocr_python-0.1.0.dev0/openocr/configs/rec/cppd/svtr_base_cppd_h8.yml +123 -0
  39. openocr_python-0.1.0.dev0/openocr/configs/rec/cppd/svtr_base_cppd_syn.yml +124 -0
  40. openocr_python-0.1.0.dev0/openocr/configs/rec/cppd/svtrv2_cppd.yml +150 -0
  41. openocr_python-0.1.0.dev0/openocr/configs/rec/dan/resnet45_fpn_dan.yml +98 -0
  42. openocr_python-0.1.0.dev0/openocr/configs/rec/dan/svtrv2_dan.yml +130 -0
  43. openocr_python-0.1.0.dev0/openocr/configs/rec/dptr/dptr_parseq_pretrain.yml +88 -0
  44. openocr_python-0.1.0.dev0/openocr/configs/rec/focalsvtr/focalsvtr_ctc.yml +137 -0
  45. openocr_python-0.1.0.dev0/openocr/configs/rec/gtc/svtrv2_lnconv_nrtr_gtc.yml +168 -0
  46. openocr_python-0.1.0.dev0/openocr/configs/rec/gtc/svtrv2_lnconv_smtr_gtc_long_infer.yml +151 -0
  47. openocr_python-0.1.0.dev0/openocr/configs/rec/gtc/svtrv2_lnconv_smtr_gtc_smtr_long.yml +150 -0
  48. openocr_python-0.1.0.dev0/openocr/configs/rec/gtc/svtrv2_lnconv_smtr_gtc_stream.yml +152 -0
  49. openocr_python-0.1.0.dev0/openocr/configs/rec/igtr/svtr_base_ds_igtr.yml +157 -0
  50. openocr_python-0.1.0.dev0/openocr/configs/rec/lister/focalsvtr_lister_wo_fem_maxratio12.yml +133 -0
  51. openocr_python-0.1.0.dev0/openocr/configs/rec/lister/svtrv2_lister_wo_fem_maxratio12.yml +138 -0
  52. openocr_python-0.1.0.dev0/openocr/configs/rec/lpv/svtr_base_lpv.yml +124 -0
  53. openocr_python-0.1.0.dev0/openocr/configs/rec/lpv/svtr_base_lpv_wo_glrm.yml +123 -0
  54. openocr_python-0.1.0.dev0/openocr/configs/rec/lpv/svtrv2_lpv.yml +147 -0
  55. openocr_python-0.1.0.dev0/openocr/configs/rec/lpv/svtrv2_lpv_wo_glrm.yml +146 -0
  56. openocr_python-0.1.0.dev0/openocr/configs/rec/maerec/vit_nrtr.yml +116 -0
  57. openocr_python-0.1.0.dev0/openocr/configs/rec/matrn/resnet45_trans_matrn.yml +95 -0
  58. openocr_python-0.1.0.dev0/openocr/configs/rec/matrn/svtrv2_matrn.yml +130 -0
  59. openocr_python-0.1.0.dev0/openocr/configs/rec/mdiff4str/svtrv2_mdiffdecoder_base.yml +152 -0
  60. openocr_python-0.1.0.dev0/openocr/configs/rec/mdiff4str/svtrv2_mdiffdecoder_small.yml +152 -0
  61. openocr_python-0.1.0.dev0/openocr/configs/rec/mgpstr/svtrv2_mgpstr_only_char.yml +140 -0
  62. openocr_python-0.1.0.dev0/openocr/configs/rec/mgpstr/vit_base_mgpstr_only_char.yml +111 -0
  63. openocr_python-0.1.0.dev0/openocr/configs/rec/mgpstr/vit_large_mgpstr_only_char.yml +110 -0
  64. openocr_python-0.1.0.dev0/openocr/configs/rec/mgpstr/vit_mgpstr.yml +110 -0
  65. openocr_python-0.1.0.dev0/openocr/configs/rec/mgpstr/vit_mgpstr_only_char.yml +110 -0
  66. openocr_python-0.1.0.dev0/openocr/configs/rec/moran/resnet31_lstm_moran.yml +92 -0
  67. openocr_python-0.1.0.dev0/openocr/configs/rec/nrtr/focalsvtr_nrtr_maxraio12.yml +145 -0
  68. openocr_python-0.1.0.dev0/openocr/configs/rec/nrtr/nrtr.yml +107 -0
  69. openocr_python-0.1.0.dev0/openocr/configs/rec/nrtr/svtr_base_nrtr.yml +118 -0
  70. openocr_python-0.1.0.dev0/openocr/configs/rec/nrtr/svtr_base_nrtr_syn.yml +119 -0
  71. openocr_python-0.1.0.dev0/openocr/configs/rec/nrtr/svtrv2_nrtr.yml +146 -0
  72. openocr_python-0.1.0.dev0/openocr/configs/rec/ote/svtr_base_h8_ote.yml +117 -0
  73. openocr_python-0.1.0.dev0/openocr/configs/rec/ote/svtr_base_ote.yml +116 -0
  74. openocr_python-0.1.0.dev0/openocr/configs/rec/parseq/focalsvtr_parseq_maxratio12.yml +140 -0
  75. openocr_python-0.1.0.dev0/openocr/configs/rec/parseq/svrtv2_parseq.yml +136 -0
  76. openocr_python-0.1.0.dev0/openocr/configs/rec/parseq/vit_parseq.yml +100 -0
  77. openocr_python-0.1.0.dev0/openocr/configs/rec/robustscanner/resnet31_robustscanner.yml +102 -0
  78. openocr_python-0.1.0.dev0/openocr/configs/rec/robustscanner/svtrv2_robustscanner.yml +134 -0
  79. openocr_python-0.1.0.dev0/openocr/configs/rec/sar/resnet31_lstm_sar.yml +94 -0
  80. openocr_python-0.1.0.dev0/openocr/configs/rec/sar/svtrv2_sar.yml +128 -0
  81. openocr_python-0.1.0.dev0/openocr/configs/rec/seed/resnet31_lstm_seed_tps_on.yml +96 -0
  82. openocr_python-0.1.0.dev0/openocr/configs/rec/smtr/focalsvtr_smtr.yml +150 -0
  83. openocr_python-0.1.0.dev0/openocr/configs/rec/smtr/focalsvtr_smtr_long.yml +133 -0
  84. openocr_python-0.1.0.dev0/openocr/configs/rec/smtr/svtrv2_smtr.yml +150 -0
  85. openocr_python-0.1.0.dev0/openocr/configs/rec/smtr/svtrv2_smtr_bi.yml +136 -0
  86. openocr_python-0.1.0.dev0/openocr/configs/rec/srn/resnet50_fpn_srn.yml +97 -0
  87. openocr_python-0.1.0.dev0/openocr/configs/rec/srn/svtrv2_srn.yml +131 -0
  88. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/convnextv2_ctc.yml +105 -0
  89. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/convnextv2_h8_ctc.yml +105 -0
  90. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/convnextv2_h8_rctc.yml +106 -0
  91. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/convnextv2_rctc.yml +106 -0
  92. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/convnextv2_tiny_h8_ctc.yml +105 -0
  93. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/convnextv2_tiny_h8_rctc.yml +106 -0
  94. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/crnn_ctc.yml +99 -0
  95. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/crnn_ctc_long.yml +116 -0
  96. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/focalnet_base_ctc.yml +108 -0
  97. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/focalnet_base_rctc.yml +109 -0
  98. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/focalsvtr_ctc.yml +106 -0
  99. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/focalsvtr_rctc.yml +107 -0
  100. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/resnet45_trans_ctc.yml +103 -0
  101. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/resnet45_trans_rctc.yml +104 -0
  102. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/svtr_base_ctc.yml +110 -0
  103. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/svtr_base_rctc.yml +111 -0
  104. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/svtrnet_ctc_syn.yml +111 -0
  105. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/vit_ctc.yml +103 -0
  106. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrs/vit_rctc.yml +103 -0
  107. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrv2/repsvtr_ch.yml +113 -0
  108. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrv2/svtrv2_ch.yml +125 -0
  109. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrv2/svtrv2_ctc.yml +136 -0
  110. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrv2/svtrv2_rctc.yml +135 -0
  111. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrv2/svtrv2_small_rctc.yml +135 -0
  112. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrv2/svtrv2_smtr_gtc_rctc.yml +162 -0
  113. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrv2/svtrv2_smtr_gtc_rctc_ch.yml +153 -0
  114. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrv2/svtrv2_smtr_gtc_rctc_infer.yml +151 -0
  115. openocr_python-0.1.0.dev0/openocr/configs/rec/svtrv2/svtrv2_tiny_rctc.yml +135 -0
  116. openocr_python-0.1.0.dev0/openocr/configs/rec/unirec/focalsvtr_ardecoder_unirec.yml +114 -0
  117. openocr_python-0.1.0.dev0/openocr/configs/rec/unirec/opendoc_pipeline.yml +105 -0
  118. openocr_python-0.1.0.dev0/openocr/configs/rec/visionlan/resnet45_trans_visionlan_LA.yml +103 -0
  119. openocr_python-0.1.0.dev0/openocr/configs/rec/visionlan/resnet45_trans_visionlan_LF_1.yml +102 -0
  120. openocr_python-0.1.0.dev0/openocr/configs/rec/visionlan/resnet45_trans_visionlan_LF_2.yml +103 -0
  121. openocr_python-0.1.0.dev0/openocr/configs/rec/visionlan/svtrv2_visionlan_LA.yml +112 -0
  122. openocr_python-0.1.0.dev0/openocr/configs/rec/visionlan/svtrv2_visionlan_LF_1.yml +111 -0
  123. openocr_python-0.1.0.dev0/openocr/configs/rec/visionlan/svtrv2_visionlan_LF_2.yml +112 -0
  124. openocr_python-0.1.0.dev0/openocr/demo_gradio.py +227 -0
  125. openocr_python-0.1.0.dev0/openocr/demo_opendoc.py +572 -0
  126. openocr_python-0.1.0.dev0/openocr/demo_unirec.py +392 -0
  127. openocr_python-0.1.0.dev0/openocr/opendet/losses/__init__.py +20 -0
  128. openocr_python-0.1.0.dev0/openocr/opendet/losses/db_loss.py +87 -0
  129. openocr_python-0.1.0.dev0/openocr/opendet/losses/det_basic_loss.py +159 -0
  130. openocr_python-0.1.0.dev0/openocr/opendet/metrics/__init__.py +16 -0
  131. openocr_python-0.1.0.dev0/openocr/opendet/metrics/det_metric.py +156 -0
  132. openocr_python-0.1.0.dev0/openocr/opendet/metrics/eval_det_iou.py +211 -0
  133. openocr_python-0.1.0.dev0/openocr/opendet/modeling/__init__.py +11 -0
  134. openocr_python-0.1.0.dev0/openocr/opendet/modeling/backbones/__init__.py +14 -0
  135. openocr_python-0.1.0.dev0/openocr/opendet/modeling/backbones/repvit.py +340 -0
  136. openocr_python-0.1.0.dev0/openocr/opendet/modeling/base_detector.py +69 -0
  137. openocr_python-0.1.0.dev0/openocr/opendet/modeling/heads/__init__.py +14 -0
  138. openocr_python-0.1.0.dev0/openocr/opendet/modeling/heads/db_head.py +73 -0
  139. openocr_python-0.1.0.dev0/openocr/opendet/modeling/necks/__init__.py +14 -0
  140. openocr_python-0.1.0.dev0/openocr/opendet/modeling/necks/db_fpn.py +609 -0
  141. openocr_python-0.1.0.dev0/openocr/opendet/postprocess/__init__.py +18 -0
  142. openocr_python-0.1.0.dev0/openocr/opendet/postprocess/db_postprocess.py +277 -0
  143. openocr_python-0.1.0.dev0/openocr/opendet/preprocess/__init__.py +170 -0
  144. openocr_python-0.1.0.dev0/openocr/opendet/preprocess/crop_paste.py +178 -0
  145. openocr_python-0.1.0.dev0/openocr/opendet/preprocess/crop_resize.py +273 -0
  146. openocr_python-0.1.0.dev0/openocr/opendet/preprocess/db_label_encode.py +313 -0
  147. openocr_python-0.1.0.dev0/openocr/opendet/preprocess/db_resize_for_test.py +137 -0
  148. openocr_python-0.1.0.dev0/openocr/opendet/preprocess/iaa_augment.py +230 -0
  149. openocr_python-0.1.0.dev0/openocr/openocr.py +685 -0
  150. openocr_python-0.1.0.dev0/openocr/openrec/losses/__init__.py +71 -0
  151. openocr_python-0.1.0.dev0/openocr/openrec/losses/abinet_loss.py +42 -0
  152. openocr_python-0.1.0.dev0/openocr/openrec/losses/ar_loss.py +23 -0
  153. openocr_python-0.1.0.dev0/openocr/openrec/losses/cam_loss.py +48 -0
  154. openocr_python-0.1.0.dev0/openocr/openrec/losses/cdistnet_loss.py +34 -0
  155. openocr_python-0.1.0.dev0/openocr/openrec/losses/ce_loss.py +68 -0
  156. openocr_python-0.1.0.dev0/openocr/openrec/losses/cmer_loss.py +12 -0
  157. openocr_python-0.1.0.dev0/openocr/openrec/losses/cppd_loss.py +77 -0
  158. openocr_python-0.1.0.dev0/openocr/openrec/losses/ctc_loss.py +33 -0
  159. openocr_python-0.1.0.dev0/openocr/openrec/losses/igtr_loss.py +12 -0
  160. openocr_python-0.1.0.dev0/openocr/openrec/losses/lister_loss.py +14 -0
  161. openocr_python-0.1.0.dev0/openocr/openrec/losses/lpv_loss.py +30 -0
  162. openocr_python-0.1.0.dev0/openocr/openrec/losses/mdiff_loss.py +11 -0
  163. openocr_python-0.1.0.dev0/openocr/openrec/losses/mgp_loss.py +34 -0
  164. openocr_python-0.1.0.dev0/openocr/openrec/losses/parseq_loss.py +12 -0
  165. openocr_python-0.1.0.dev0/openocr/openrec/losses/robustscanner_loss.py +20 -0
  166. openocr_python-0.1.0.dev0/openocr/openrec/losses/seed_loss.py +46 -0
  167. openocr_python-0.1.0.dev0/openocr/openrec/losses/smtr_loss.py +12 -0
  168. openocr_python-0.1.0.dev0/openocr/openrec/losses/srn_loss.py +40 -0
  169. openocr_python-0.1.0.dev0/openocr/openrec/losses/unirec_loss.py +12 -0
  170. openocr_python-0.1.0.dev0/openocr/openrec/losses/visionlan_loss.py +58 -0
  171. openocr_python-0.1.0.dev0/openocr/openrec/metrics/__init__.py +22 -0
  172. openocr_python-0.1.0.dev0/openocr/openrec/metrics/rec_metric.py +270 -0
  173. openocr_python-0.1.0.dev0/openocr/openrec/metrics/rec_metric_cmer.py +328 -0
  174. openocr_python-0.1.0.dev0/openocr/openrec/metrics/rec_metric_gtc.py +58 -0
  175. openocr_python-0.1.0.dev0/openocr/openrec/metrics/rec_metric_long.py +142 -0
  176. openocr_python-0.1.0.dev0/openocr/openrec/metrics/rec_metric_mgp.py +93 -0
  177. openocr_python-0.1.0.dev0/openocr/openrec/modeling/__init__.py +11 -0
  178. openocr_python-0.1.0.dev0/openocr/openrec/modeling/base_recognizer.py +69 -0
  179. openocr_python-0.1.0.dev0/openocr/openrec/modeling/cmer_modeling/modeling_cmer.py +643 -0
  180. openocr_python-0.1.0.dev0/openocr/openrec/modeling/common.py +238 -0
  181. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/__init__.py +114 -0
  182. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/abinet_decoder.py +283 -0
  183. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/aster_decoder.py +170 -0
  184. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/bus_decoder.py +133 -0
  185. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/cam_decoder.py +43 -0
  186. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/cdistnet_decoder.py +334 -0
  187. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/cppd_decoder.py +393 -0
  188. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/ctc_decoder.py +203 -0
  189. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/dan_decoder.py +203 -0
  190. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/dptr_parseq_clip_b_decoder.py +1563 -0
  191. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/igtr_decoder.py +905 -0
  192. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/lister_decoder.py +535 -0
  193. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/lpv_decoder.py +119 -0
  194. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/matrn_decoder.py +236 -0
  195. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/mdiff_decoder.py +587 -0
  196. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/mgp_decoder.py +99 -0
  197. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/nrtr_decoder.py +439 -0
  198. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/ote_decoder.py +205 -0
  199. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/parseq_decoder.py +504 -0
  200. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/rctc_decoder.py +70 -0
  201. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/robustscanner_decoder.py +749 -0
  202. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/sar_decoder.py +236 -0
  203. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/smtr_decoder.py +672 -0
  204. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/smtr_decoder_nattn.py +521 -0
  205. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/srn_decoder.py +283 -0
  206. openocr_python-0.1.0.dev0/openocr/openrec/modeling/decoders/visionlan_decoder.py +321 -0
  207. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/__init__.py +41 -0
  208. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/autostr_encoder.py +327 -0
  209. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/cam_encoder.py +760 -0
  210. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/convnextv2.py +213 -0
  211. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/focalsvtr.py +631 -0
  212. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/nrtr_encoder.py +28 -0
  213. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/rec_hgnet.py +346 -0
  214. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/rec_lcnetv3.py +488 -0
  215. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/rec_mobilenet_v3.py +132 -0
  216. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/rec_mv1_enhance.py +254 -0
  217. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/rec_nrtr_mtb.py +37 -0
  218. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/rec_resnet_31.py +213 -0
  219. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/rec_resnet_45.py +183 -0
  220. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/rec_resnet_fpn.py +216 -0
  221. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/rec_resnet_vd.py +252 -0
  222. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/repvit.py +338 -0
  223. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/resnet31_rnn.py +123 -0
  224. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/svtrnet.py +574 -0
  225. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/svtrnet2dpos.py +616 -0
  226. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/svtrv2.py +470 -0
  227. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/svtrv2_lnconv.py +503 -0
  228. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/svtrv2_lnconv_two33.py +517 -0
  229. openocr_python-0.1.0.dev0/openocr/openrec/modeling/encoders/vit.py +120 -0
  230. openocr_python-0.1.0.dev0/openocr/openrec/modeling/transforms/__init__.py +15 -0
  231. openocr_python-0.1.0.dev0/openocr/openrec/modeling/transforms/aster_tps.py +262 -0
  232. openocr_python-0.1.0.dev0/openocr/openrec/modeling/transforms/moran.py +136 -0
  233. openocr_python-0.1.0.dev0/openocr/openrec/modeling/transforms/tps.py +246 -0
  234. openocr_python-0.1.0.dev0/openocr/openrec/modeling/unirec_modeling/configuration_unirec.py +166 -0
  235. openocr_python-0.1.0.dev0/openocr/openrec/modeling/unirec_modeling/modeling_unirec.py +433 -0
  236. openocr_python-0.1.0.dev0/openocr/openrec/optimizer/__init__.py +74 -0
  237. openocr_python-0.1.0.dev0/openocr/openrec/optimizer/lr.py +276 -0
  238. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/__init__.py +88 -0
  239. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/abinet_postprocess.py +37 -0
  240. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/ar_postprocess.py +63 -0
  241. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/ce_postprocess.py +43 -0
  242. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/char_postprocess.py +108 -0
  243. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/cmer_postprocess.py +86 -0
  244. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/cppd_postprocess.py +42 -0
  245. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/ctc_postprocess.py +118 -0
  246. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/igtr_postprocess.py +100 -0
  247. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/lister_postprocess.py +59 -0
  248. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/mgp_postprocess.py +143 -0
  249. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/nrtr_postprocess.py +75 -0
  250. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/smtr_postprocess.py +73 -0
  251. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/srn_postprocess.py +80 -0
  252. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/unirec_postprocess.py +58 -0
  253. openocr_python-0.1.0.dev0/openocr/openrec/postprocess/visionlan_postprocess.py +81 -0
  254. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/__init__.py +179 -0
  255. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/abinet_aug.py +473 -0
  256. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/abinet_label_encode.py +36 -0
  257. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/ar_label_encode.py +36 -0
  258. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/auto_augment.py +1012 -0
  259. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/cam_label_encode.py +141 -0
  260. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/ce_label_encode.py +116 -0
  261. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/char_label_encode.py +36 -0
  262. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/cmer_label_encode.py +1025 -0
  263. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/cppd_label_encode.py +173 -0
  264. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/ctc_label_encode.py +124 -0
  265. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/dptr_label_encode.py +177 -0
  266. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/ep_label_encode.py +38 -0
  267. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/igtr_label_encode.py +373 -0
  268. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/mdiff_label_encode.py +312 -0
  269. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/mgp_label_encode.py +95 -0
  270. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/parseq_aug.py +150 -0
  271. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/rec_aug.py +338 -0
  272. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/resize.py +599 -0
  273. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/smtr_label_encode.py +125 -0
  274. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/srn_label_encode.py +37 -0
  275. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/unirec_label_encode.py +62 -0
  276. openocr_python-0.1.0.dev0/openocr/openrec/preprocess/visionlan_label_encode.py +67 -0
  277. openocr_python-0.1.0.dev0/openocr/tools/create_lmdb_dataset.py +119 -0
  278. openocr_python-0.1.0.dev0/openocr/tools/data/__init__.py +136 -0
  279. openocr_python-0.1.0.dev0/openocr/tools/data/cmer_web_dataset.py +310 -0
  280. openocr_python-0.1.0.dev0/openocr/tools/data/collate_fn.py +100 -0
  281. openocr_python-0.1.0.dev0/openocr/tools/data/lmdb_dataset.py +142 -0
  282. openocr_python-0.1.0.dev0/openocr/tools/data/lmdb_dataset_test.py +167 -0
  283. openocr_python-0.1.0.dev0/openocr/tools/data/multi_scale_sampler.py +177 -0
  284. openocr_python-0.1.0.dev0/openocr/tools/data/native_size_dataset.py +753 -0
  285. openocr_python-0.1.0.dev0/openocr/tools/data/native_size_sampler.py +158 -0
  286. openocr_python-0.1.0.dev0/openocr/tools/data/ratio_dataset.py +217 -0
  287. openocr_python-0.1.0.dev0/openocr/tools/data/ratio_dataset_test.py +273 -0
  288. openocr_python-0.1.0.dev0/openocr/tools/data/ratio_dataset_tvresize.py +215 -0
  289. openocr_python-0.1.0.dev0/openocr/tools/data/ratio_dataset_tvresize_test.py +276 -0
  290. openocr_python-0.1.0.dev0/openocr/tools/data/ratio_sampler.py +191 -0
  291. openocr_python-0.1.0.dev0/openocr/tools/data/simple_dataset.py +266 -0
  292. openocr_python-0.1.0.dev0/openocr/tools/data/strlmdb_dataset.py +144 -0
  293. openocr_python-0.1.0.dev0/openocr/tools/data/text_lmdb_dataset.py +131 -0
  294. openocr_python-0.1.0.dev0/openocr/tools/download/download_dataset.py +38 -0
  295. openocr_python-0.1.0.dev0/openocr/tools/download/utils.py +28 -0
  296. openocr_python-0.1.0.dev0/openocr/tools/download_example_images.py +236 -0
  297. openocr_python-0.1.0.dev0/openocr/tools/engine/config.py +158 -0
  298. openocr_python-0.1.0.dev0/openocr/tools/engine/trainer.py +587 -0
  299. openocr_python-0.1.0.dev0/openocr/tools/eval_det.py +42 -0
  300. openocr_python-0.1.0.dev0/openocr/tools/eval_rec.py +42 -0
  301. openocr_python-0.1.0.dev0/openocr/tools/eval_rec_all_ch.py +185 -0
  302. openocr_python-0.1.0.dev0/openocr/tools/eval_rec_all_en.py +207 -0
  303. openocr_python-0.1.0.dev0/openocr/tools/eval_rec_all_long.py +120 -0
  304. openocr_python-0.1.0.dev0/openocr/tools/eval_rec_all_long_simple.py +123 -0
  305. openocr_python-0.1.0.dev0/openocr/tools/export_rec.py +118 -0
  306. openocr_python-0.1.0.dev0/openocr/tools/infer/onnx_engine.py +65 -0
  307. openocr_python-0.1.0.dev0/openocr/tools/infer/predict_rec.py +140 -0
  308. openocr_python-0.1.0.dev0/openocr/tools/infer/utility.py +236 -0
  309. openocr_python-0.1.0.dev0/openocr/tools/infer_det.py +341 -0
  310. openocr_python-0.1.0.dev0/openocr/tools/infer_doc.py +898 -0
  311. openocr_python-0.1.0.dev0/openocr/tools/infer_doc_onnx.py +1172 -0
  312. openocr_python-0.1.0.dev0/openocr/tools/infer_e2e.py +462 -0
  313. openocr_python-0.1.0.dev0/openocr/tools/infer_e2e_parallel.py +184 -0
  314. openocr_python-0.1.0.dev0/openocr/tools/infer_rec.py +464 -0
  315. openocr_python-0.1.0.dev0/openocr/tools/infer_unirec_onnx.py +730 -0
  316. openocr_python-0.1.0.dev0/openocr/tools/to_markdown.py +468 -0
  317. openocr_python-0.1.0.dev0/openocr/tools/toonnx.py +77 -0
  318. openocr_python-0.1.0.dev0/openocr/tools/train_det.py +40 -0
  319. openocr_python-0.1.0.dev0/openocr/tools/train_rec.py +40 -0
  320. openocr_python-0.1.0.dev0/openocr/tools/utility.py +45 -0
  321. openocr_python-0.1.0.dev0/openocr/tools/utils/EN_symbol_dict.txt +94 -0
  322. openocr_python-0.1.0.dev0/openocr/tools/utils/__init__.py +0 -0
  323. openocr_python-0.1.0.dev0/openocr/tools/utils/ckpt.py +99 -0
  324. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/ar_dict.txt +117 -0
  325. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/arabic_dict.txt +161 -0
  326. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/be_dict.txt +145 -0
  327. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/bg_dict.txt +140 -0
  328. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/chinese_cht_dict.txt +8421 -0
  329. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/cyrillic_dict.txt +163 -0
  330. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/devanagari_dict.txt +167 -0
  331. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/en_dict.txt +63 -0
  332. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/fa_dict.txt +136 -0
  333. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/french_dict.txt +136 -0
  334. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/german_dict.txt +143 -0
  335. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/hi_dict.txt +162 -0
  336. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/it_dict.txt +118 -0
  337. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/japan_dict.txt +4399 -0
  338. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/ka_dict.txt +153 -0
  339. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/kie_dict/xfund_class_list.txt +4 -0
  340. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/korean_dict.txt +3688 -0
  341. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/latex_symbol_dict.txt +111 -0
  342. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/latin_dict.txt +185 -0
  343. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/layout_dict/layout_cdla_dict.txt +10 -0
  344. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/layout_dict/layout_publaynet_dict.txt +5 -0
  345. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/layout_dict/layout_table_dict.txt +1 -0
  346. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/mr_dict.txt +153 -0
  347. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/ne_dict.txt +153 -0
  348. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/oc_dict.txt +96 -0
  349. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/pu_dict.txt +130 -0
  350. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/rs_dict.txt +91 -0
  351. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/rsc_dict.txt +134 -0
  352. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/ru_dict.txt +125 -0
  353. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/spin_dict.txt +68 -0
  354. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/ta_dict.txt +128 -0
  355. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/table_dict.txt +277 -0
  356. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/table_master_structure_dict.txt +39 -0
  357. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/table_structure_dict.txt +28 -0
  358. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/table_structure_dict_ch.txt +48 -0
  359. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/te_dict.txt +151 -0
  360. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/ug_dict.txt +114 -0
  361. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/uk_dict.txt +142 -0
  362. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/ur_dict.txt +137 -0
  363. openocr_python-0.1.0.dev0/openocr/tools/utils/dict/xi_dict.txt +110 -0
  364. openocr_python-0.1.0.dev0/openocr/tools/utils/dict90.txt +90 -0
  365. openocr_python-0.1.0.dev0/openocr/tools/utils/e2e_metric/Deteval.py +802 -0
  366. openocr_python-0.1.0.dev0/openocr/tools/utils/e2e_metric/polygon_fast.py +70 -0
  367. openocr_python-0.1.0.dev0/openocr/tools/utils/e2e_utils/extract_batchsize.py +86 -0
  368. openocr_python-0.1.0.dev0/openocr/tools/utils/e2e_utils/extract_textpoint_fast.py +479 -0
  369. openocr_python-0.1.0.dev0/openocr/tools/utils/e2e_utils/extract_textpoint_slow.py +582 -0
  370. openocr_python-0.1.0.dev0/openocr/tools/utils/e2e_utils/pgnet_pp_utils.py +159 -0
  371. openocr_python-0.1.0.dev0/openocr/tools/utils/e2e_utils/visual.py +152 -0
  372. openocr_python-0.1.0.dev0/openocr/tools/utils/en_dict.txt +95 -0
  373. openocr_python-0.1.0.dev0/openocr/tools/utils/gen_label.py +68 -0
  374. openocr_python-0.1.0.dev0/openocr/tools/utils/ic15_dict.txt +36 -0
  375. openocr_python-0.1.0.dev0/openocr/tools/utils/logging.py +54 -0
  376. openocr_python-0.1.0.dev0/openocr/tools/utils/opendoc_onnx_utils/utils.py +1052 -0
  377. openocr_python-0.1.0.dev0/openocr/tools/utils/poly_nms.py +132 -0
  378. openocr_python-0.1.0.dev0/openocr/tools/utils/ppocr_keys_v1.txt +6623 -0
  379. openocr_python-0.1.0.dev0/openocr/tools/utils/stats.py +58 -0
  380. openocr_python-0.1.0.dev0/openocr/tools/utils/utility.py +165 -0
  381. openocr_python-0.1.0.dev0/openocr/tools/utils/visual.py +117 -0
  382. openocr_python-0.1.0.dev0/openocr_python.egg-info/PKG-INFO +324 -0
  383. openocr_python-0.1.0.dev0/openocr_python.egg-info/SOURCES.txt +389 -0
  384. openocr_python-0.1.0.dev0/openocr_python.egg-info/dependency_links.txt +1 -0
  385. openocr_python-0.1.0.dev0/openocr_python.egg-info/entry_points.txt +2 -0
  386. openocr_python-0.1.0.dev0/openocr_python.egg-info/not-zip-safe +1 -0
  387. openocr_python-0.1.0.dev0/openocr_python.egg-info/requires.txt +36 -0
  388. openocr_python-0.1.0.dev0/openocr_python.egg-info/top_level.txt +1 -0
  389. openocr_python-0.1.0.dev0/pyproject.toml +108 -0
  390. openocr_python-0.1.0.dev0/setup.cfg +4 -0
  391. openocr_python-0.1.0.dev0/setup.py +121 -0
@@ -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,20 @@
1
+ prune opendet
2
+ prune openrec
3
+ prune tools
4
+
5
+
6
+ include openocr/README.md
7
+ include openocr/README_ch.md
8
+ include openocr/__init__.py
9
+ include openocr/demo_gradio.py
10
+ include openocr/demo_opendoc.py
11
+ include openocr/demo_unirec.py
12
+ include openocr/openocr.py
13
+ include LICENSE
14
+
15
+ # Include all config files
16
+ recursive-include openocr/configs *.yml *.yaml
17
+ recursive-include openocr/opendet *.py
18
+ recursive-include openocr/openrec *.py
19
+ recursive-include openocr/tools *.py
20
+ recursive-include openocr/tools *.txt
@@ -0,0 +1,324 @@
1
+ Metadata-Version: 2.4
2
+ Name: openocr-python
3
+ Version: 0.1.0.dev0
4
+ Summary: Accurate and Efficient General OCR System
5
+ Home-page: https://github.com/Topdu/OpenOCR
6
+ Author: OCR Team, FVL Lab
7
+ Author-email: "OCR Team, FVL Lab" <784990967@qq.com>
8
+ Maintainer-email: "OCR Team, FVL Lab" <784990967@qq.com>
9
+ License: Apache License 2.0
10
+ Project-URL: Homepage, https://github.com/Topdu/OpenOCR
11
+ Project-URL: Documentation, https://github.com/Topdu/OpenOCR/tree/main/docs
12
+ Project-URL: Repository, https://github.com/Topdu/OpenOCR
13
+ Project-URL: Bug Reports, https://github.com/Topdu/OpenOCR/issues
14
+ Keywords: ocr,optical character recognition,text detection,text recognition,document parsing,deep learning,computer vision
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Science/Research
18
+ Classifier: License :: OSI Approved :: Apache Software License
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
26
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
+ Requires-Python: >=3.8
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: numpy==1.26.4
31
+ Requires-Dist: opencv-python<=4.12.0
32
+ Requires-Dist: Pillow>=8.0.0
33
+ Requires-Dist: pyyaml>=5.4.0
34
+ Requires-Dist: tqdm>=4.60.0
35
+ Requires-Dist: rapidfuzz>=2.0.0
36
+ Requires-Dist: pyclipper>=1.3.0
37
+ Requires-Dist: pydantic
38
+ Requires-Dist: shapely
39
+ Provides-Extra: onnx
40
+ Requires-Dist: onnxruntime>=1.12.0; extra == "onnx"
41
+ Provides-Extra: onnx-gpu
42
+ Requires-Dist: onnxruntime-gpu>=1.12.0; extra == "onnx-gpu"
43
+ Provides-Extra: pytorch
44
+ Requires-Dist: torch>=1.10.0; extra == "pytorch"
45
+ Requires-Dist: torchvision>=0.11.0; extra == "pytorch"
46
+ Provides-Extra: gradio
47
+ Requires-Dist: gradio==4.20.0; extra == "gradio"
48
+ Provides-Extra: huggingface
49
+ Requires-Dist: huggingface-hub>=0.16.0; extra == "huggingface"
50
+ Provides-Extra: modelscope
51
+ Requires-Dist: modelscope>=1.9.0; extra == "modelscope"
52
+ Provides-Extra: all
53
+ Requires-Dist: onnxruntime>=1.12.0; extra == "all"
54
+ Requires-Dist: torch>=1.10.0; extra == "all"
55
+ Requires-Dist: torchvision>=0.11.0; extra == "all"
56
+ Requires-Dist: gradio==4.20.0; extra == "all"
57
+ Requires-Dist: huggingface-hub>=0.16.0; extra == "all"
58
+ Requires-Dist: modelscope>=1.9.0; extra == "all"
59
+ Dynamic: author
60
+ Dynamic: home-page
61
+ Dynamic: license-file
62
+ Dynamic: requires-python
63
+
64
+ # OpenOCR: An Open-Source Toolkit for General-OCR Research and Applications
65
+
66
+ ## For More Information
67
+
68
+ Visit: https://github.com/Topdu/OpenOCR
69
+
70
+ ## Recent Updates
71
+
72
+ - **0.1.0**: Use a unified interface for OCR, Document Parsing, and Unirec
73
+ - **0.0.10**: Remove OpenCV version restrictions.
74
+ - **0.0.9**: Fixing torch inference bug.
75
+ - **0.0.8**: Automatic Downloading ONNX model.
76
+ - **0.0.7**: Releasing the feature of [ONNX model export for wider compatibility](#export-onnx-model).
77
+
78
+ # Quick Start Guide
79
+
80
+ ## Installation
81
+
82
+ ```bash
83
+ # Install from PyPI (recommended)
84
+ pip install openocr-python huggingface-hub==0.36.0 modelscope onnxruntime
85
+
86
+ # Or install from source
87
+ git clone https://github.com/Topdu/OpenOCR.git
88
+ cd OpenOCR
89
+ python build_package.py
90
+ pip install ./build/dist/openocr_python-*.whl huggingface-hub==0.36.0 modelscope onnxruntime
91
+ ```
92
+
93
+ ## Command Line Usage
94
+
95
+ ### 1. Text Detection + Recognition (OCR)
96
+
97
+ End-to-end OCR for Chinese/English text detection and recognition:
98
+
99
+ ```bash
100
+ # Basic usage
101
+ openocr --task ocr --input_path path/to/img
102
+
103
+ # With visualization
104
+ openocr --task ocr --input_path path/to/img --is_vis
105
+
106
+ # Process directory with custom output
107
+ openocr --task ocr --input_path ./images --output_path ./results --is_vis
108
+
109
+ # Use server mode (higher accuracy)
110
+ pip install torch torchvision
111
+ openocr --task ocr --input_path path/to/img --mode server --backend torch
112
+ ```
113
+
114
+ ### 2. Text Detection Only
115
+
116
+ Detect text regions without recognition:
117
+
118
+ ```bash
119
+ # Basic detection
120
+ openocr --task det --input_path path/to/img
121
+
122
+ # With visualization
123
+ openocr --task det --input_path path/to/img --is_vis
124
+
125
+ # Use polygon detection (more accurate for curved text)
126
+ openocr --task det --input_path path/to/img --det_box_type poly
127
+ ```
128
+
129
+ ### 3. Text Recognition Only
130
+
131
+ Recognize text from cropped word/line images:
132
+
133
+ ```bash
134
+ # Basic recognition
135
+ openocr --task rec --input_path path/to/img
136
+
137
+ # Use server mode (higher accuracy)
138
+ pip install torch torchvision
139
+ openocr --task rec --input_path path/to/img --mode server --backend torch
140
+
141
+ # Batch processing
142
+ openocr --task rec --input_path ./word_images --rec_batch_num 16
143
+ ```
144
+
145
+ ### 4. Universal Recognition (UniRec)
146
+
147
+ Recognize text, formulas, and tables using Vision-Language Model:
148
+
149
+ ```bash
150
+ # Basic usage
151
+ openocr --task unirec --input_path path/to/img
152
+
153
+ # Process directory
154
+ openocr --task unirec --input_path ./images --output_path ./results
155
+ ```
156
+
157
+ ### 5. Document Parsing (OpenDoc)
158
+
159
+ Parse documents with layout analysis, table/formula/table recognition:
160
+
161
+ ```bash
162
+ # Full document parsing with all outputs
163
+ openocr --task doc --input_path path/to/img --use_layout_detection --save_vis --save_json --save_markdown
164
+
165
+ # Parse PDF document
166
+ openocr --task doc --input_path document.pdf --use_layout_detection --save_vis --save_json --save_markdown
167
+
168
+ # Custom layout threshold
169
+ openocr --task doc --input_path path/to/img --use_layout_detection --save_vis --save_json --save_markdown --layout_threshold 0.5
170
+ ```
171
+
172
+ ## Launch Interactive Demos
173
+
174
+ ```bash
175
+ # Install gradio
176
+ pip install gradio==4.20.0
177
+ ```
178
+
179
+ ### OCR Demo
180
+
181
+ Launch Gradio web interface for OCR tasks:
182
+
183
+ ```bash
184
+ pip install onnxruntime
185
+ # Local access only
186
+ openocr --task launch_openocr_demo --server_port 7860
187
+
188
+ # Public share link
189
+ openocr --task launch_openocr_demo --server_port 7860 --share
190
+ ```
191
+
192
+ ### UniRec Demo
193
+
194
+ Launch Gradio web interface for universal recognition:
195
+
196
+ ```bash
197
+ pip install onnxruntime
198
+ openocr --task launch_unirec_demo --server_port 7861 --share
199
+ ```
200
+
201
+ ### OpenDoc Demo
202
+
203
+ Launch Gradio web interface for document parsing:
204
+
205
+ ```bash
206
+ pip install onnxruntime
207
+ openocr --task launch_opendoc_demo --server_port 7862 --share
208
+ ```
209
+
210
+ ## Python API Usage
211
+
212
+ ### OCR Task
213
+
214
+ ```python
215
+ import json
216
+ from openocr import OpenOCR
217
+
218
+ # Initialize OCR engine
219
+ ocr = OpenOCR(task='ocr', mode='mobile')
220
+
221
+ # Process single image
222
+ results, time_dicts = ocr(
223
+ image_path='path/to/image.jpg',
224
+ save_dir='./output',
225
+ is_visualize=True
226
+ )
227
+
228
+ # Access results
229
+ for result in results:
230
+ image_name, ocr_result = result.split('\t')
231
+ ocr_result = json.loads(ocr_result)
232
+ print(f"✅ OCR: {image_name} results: {ocr_result}")
233
+ ```
234
+
235
+ ### Detection Task
236
+
237
+ ```python
238
+ from openocr import OpenOCR
239
+
240
+ # Initialize detector
241
+ detector = OpenOCR(task='det')
242
+
243
+ # Detect text regions
244
+ results = detector(image_path='path/to/image.jpg')
245
+
246
+ # Access detection boxes
247
+ boxes = results[0]['boxes']
248
+ print(f"Found {len(boxes)} text regions")
249
+ ```
250
+
251
+ ### Recognition Task
252
+
253
+ ```python
254
+ from openocr import OpenOCR
255
+
256
+ # Initialize recognizer
257
+ recognizer = OpenOCR(task='rec', mode='server', backend='torch') # pip install torch torchvision
258
+
259
+ # Recognize text
260
+ results = recognizer(image_path='path/to/word.jpg')
261
+
262
+ # Access recognition result
263
+ text = results[0]['text']
264
+ score = results[0]['score']
265
+ print(f"Text: {text}, Confidence: {score}")
266
+ ```
267
+
268
+ ### UniRec Task
269
+
270
+ ```python
271
+ from openocr import OpenOCR
272
+
273
+ # Initialize UniRec
274
+ unirec = OpenOCR(task='unirec')
275
+
276
+ # Recognize text/formula/table
277
+ result_text, generated_ids = unirec(
278
+ image_path='path/to/image.jpg',
279
+ max_length=2048
280
+ )
281
+ print(f"Result: {result_text}")
282
+ ```
283
+
284
+ ### Document Parsing Task
285
+
286
+ ```python
287
+ from openocr import OpenOCR
288
+
289
+ # Initialize OpenDoc
290
+ doc_parser = OpenOCR(
291
+ task='doc',
292
+ use_layout_detection=True,
293
+ )
294
+
295
+ # Parse document
296
+ result = doc_parser(image_path='path/to/document.jpg')
297
+
298
+ # Save results
299
+ doc_parser.save_to_markdown(result, './output')
300
+ doc_parser.save_to_json(result, './output')
301
+ doc_parser.save_visualization(result, './output')
302
+ ```
303
+
304
+ ## Common Parameters
305
+
306
+ - `--task`: Task type (ocr, det, rec, unirec, doc, launch\_\*\_demo)
307
+ - `--input_path`: Input image/PDF path or directory
308
+ - `--output_path`: Output directory (default: openocr_output/{task})
309
+ - `--use_gpu`: GPU usage (auto, true, false)
310
+ - `--mode`: Model mode (mobile, server) - server mode has higher accuracy
311
+ - `--is_vis`: Visualize results
312
+ - `--save_vis`: Save visualization (doc task)
313
+ - `--save_json`: Save JSON results (doc task)
314
+ - `--save_markdown`: Save Markdown results (doc task)
315
+
316
+ ## Output Structure
317
+
318
+ Results are saved to `openocr_output/{task}/` by default:
319
+
320
+ - **OCR task**: `ocr_results.txt` + visualization images (if --is_vis)
321
+ - **Detection task**: `det_results.txt` + visualization images (if --is_vis)
322
+ - **Recognition task**: `rec_results.txt`
323
+ - **UniRec task**: `unirec_results.txt`
324
+ - **Doc task**: JSON files, Markdown files, visualization images (based on flags)