openocry 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. openocr/__init__.py +45 -0
  2. openocr/configs/dataset/rec/evaluation.yaml +41 -0
  3. openocr/configs/dataset/rec/ltb.yaml +9 -0
  4. openocr/configs/dataset/rec/mjsynth.yaml +11 -0
  5. openocr/configs/dataset/rec/openvino.yaml +25 -0
  6. openocr/configs/dataset/rec/ost.yaml +17 -0
  7. openocr/configs/dataset/rec/synthtext.yaml +7 -0
  8. openocr/configs/dataset/rec/test.yaml +77 -0
  9. openocr/configs/dataset/rec/textocr.yaml +13 -0
  10. openocr/configs/dataset/rec/textocr_horizontal.yaml +13 -0
  11. openocr/configs/dataset/rec/union14m_b.yaml +47 -0
  12. openocr/configs/dataset/rec/union14m_l_filtered.yaml +35 -0
  13. openocr/configs/det/dbnet/repvit_db.yml +171 -0
  14. openocr/configs/rec/abinet/resnet45_trans_abinet_lang.yml +94 -0
  15. openocr/configs/rec/abinet/resnet45_trans_abinet_wo_lang.yml +93 -0
  16. openocr/configs/rec/abinet/svtrv2_abinet_lang.yml +130 -0
  17. openocr/configs/rec/abinet/svtrv2_abinet_wo_lang.yml +128 -0
  18. openocr/configs/rec/aster/resnet31_lstm_aster_tps_on.yml +93 -0
  19. openocr/configs/rec/aster/svtrv2_aster.yml +127 -0
  20. openocr/configs/rec/aster/svtrv2_aster_tps_on.yml +102 -0
  21. openocr/configs/rec/autostr/autostr_lstm_aster_tps_on.yml +95 -0
  22. openocr/configs/rec/busnet/svtrv2_busnet.yml +135 -0
  23. openocr/configs/rec/busnet/svtrv2_busnet_pretraining.yml +134 -0
  24. openocr/configs/rec/busnet/vit_busnet.yml +104 -0
  25. openocr/configs/rec/busnet/vit_busnet_pretraining.yml +104 -0
  26. openocr/configs/rec/cam/convnextv2_cam_tps_on.yml +118 -0
  27. openocr/configs/rec/cam/convnextv2_tiny_cam_tps_on.yml +118 -0
  28. openocr/configs/rec/cam/svtrv2_cam_tps_on.yml +123 -0
  29. openocr/configs/rec/cdistnet/resnet45_trans_cdistnet.yml +93 -0
  30. openocr/configs/rec/cdistnet/svtrv2_cdistnet.yml +139 -0
  31. openocr/configs/rec/cmer/cmer.yml +127 -0
  32. openocr/configs/rec/cppd/svtr_base_cppd.yml +123 -0
  33. openocr/configs/rec/cppd/svtr_base_cppd_ch.yml +126 -0
  34. openocr/configs/rec/cppd/svtr_base_cppd_h8.yml +123 -0
  35. openocr/configs/rec/cppd/svtr_base_cppd_syn.yml +124 -0
  36. openocr/configs/rec/cppd/svtrv2_cppd.yml +150 -0
  37. openocr/configs/rec/dan/resnet45_fpn_dan.yml +98 -0
  38. openocr/configs/rec/dan/svtrv2_dan.yml +130 -0
  39. openocr/configs/rec/dptr/dptr_parseq_pretrain.yml +88 -0
  40. openocr/configs/rec/focalsvtr/focalsvtr_ctc.yml +137 -0
  41. openocr/configs/rec/gtc/svtrv2_lnconv_nrtr_gtc.yml +168 -0
  42. openocr/configs/rec/gtc/svtrv2_lnconv_smtr_gtc_long_infer.yml +151 -0
  43. openocr/configs/rec/gtc/svtrv2_lnconv_smtr_gtc_smtr_long.yml +150 -0
  44. openocr/configs/rec/gtc/svtrv2_lnconv_smtr_gtc_stream.yml +152 -0
  45. openocr/configs/rec/igtr/svtr_base_ds_igtr.yml +157 -0
  46. openocr/configs/rec/lister/focalsvtr_lister_wo_fem_maxratio12.yml +133 -0
  47. openocr/configs/rec/lister/svtrv2_lister_wo_fem_maxratio12.yml +138 -0
  48. openocr/configs/rec/lpv/svtr_base_lpv.yml +124 -0
  49. openocr/configs/rec/lpv/svtr_base_lpv_wo_glrm.yml +123 -0
  50. openocr/configs/rec/lpv/svtrv2_lpv.yml +147 -0
  51. openocr/configs/rec/lpv/svtrv2_lpv_wo_glrm.yml +146 -0
  52. openocr/configs/rec/maerec/vit_nrtr.yml +116 -0
  53. openocr/configs/rec/matrn/resnet45_trans_matrn.yml +95 -0
  54. openocr/configs/rec/matrn/svtrv2_matrn.yml +130 -0
  55. openocr/configs/rec/mdiff4str/svtrv2_mdiffdecoder_base.yml +152 -0
  56. openocr/configs/rec/mdiff4str/svtrv2_mdiffdecoder_small.yml +152 -0
  57. openocr/configs/rec/mgpstr/svtrv2_mgpstr_only_char.yml +140 -0
  58. openocr/configs/rec/mgpstr/vit_base_mgpstr_only_char.yml +111 -0
  59. openocr/configs/rec/mgpstr/vit_large_mgpstr_only_char.yml +110 -0
  60. openocr/configs/rec/mgpstr/vit_mgpstr.yml +110 -0
  61. openocr/configs/rec/mgpstr/vit_mgpstr_only_char.yml +110 -0
  62. openocr/configs/rec/moran/resnet31_lstm_moran.yml +92 -0
  63. openocr/configs/rec/nrtr/focalsvtr_nrtr_maxraio12.yml +145 -0
  64. openocr/configs/rec/nrtr/nrtr.yml +107 -0
  65. openocr/configs/rec/nrtr/svtr_base_nrtr.yml +118 -0
  66. openocr/configs/rec/nrtr/svtr_base_nrtr_syn.yml +119 -0
  67. openocr/configs/rec/nrtr/svtrv2_nrtr.yml +146 -0
  68. openocr/configs/rec/ote/svtr_base_h8_ote.yml +117 -0
  69. openocr/configs/rec/ote/svtr_base_ote.yml +116 -0
  70. openocr/configs/rec/parseq/focalsvtr_parseq_maxratio12.yml +140 -0
  71. openocr/configs/rec/parseq/svrtv2_parseq.yml +136 -0
  72. openocr/configs/rec/parseq/vit_parseq.yml +100 -0
  73. openocr/configs/rec/robustscanner/resnet31_robustscanner.yml +102 -0
  74. openocr/configs/rec/robustscanner/svtrv2_robustscanner.yml +134 -0
  75. openocr/configs/rec/sar/resnet31_lstm_sar.yml +94 -0
  76. openocr/configs/rec/sar/svtrv2_sar.yml +128 -0
  77. openocr/configs/rec/seed/resnet31_lstm_seed_tps_on.yml +96 -0
  78. openocr/configs/rec/smtr/focalsvtr_smtr.yml +150 -0
  79. openocr/configs/rec/smtr/focalsvtr_smtr_long.yml +133 -0
  80. openocr/configs/rec/smtr/svtrv2_smtr.yml +150 -0
  81. openocr/configs/rec/smtr/svtrv2_smtr_bi.yml +136 -0
  82. openocr/configs/rec/srn/resnet50_fpn_srn.yml +97 -0
  83. openocr/configs/rec/srn/svtrv2_srn.yml +131 -0
  84. openocr/configs/rec/svtrs/convnextv2_ctc.yml +105 -0
  85. openocr/configs/rec/svtrs/convnextv2_h8_ctc.yml +105 -0
  86. openocr/configs/rec/svtrs/convnextv2_h8_rctc.yml +106 -0
  87. openocr/configs/rec/svtrs/convnextv2_rctc.yml +106 -0
  88. openocr/configs/rec/svtrs/convnextv2_tiny_h8_ctc.yml +105 -0
  89. openocr/configs/rec/svtrs/convnextv2_tiny_h8_rctc.yml +106 -0
  90. openocr/configs/rec/svtrs/crnn_ctc.yml +99 -0
  91. openocr/configs/rec/svtrs/crnn_ctc_long.yml +116 -0
  92. openocr/configs/rec/svtrs/focalnet_base_ctc.yml +108 -0
  93. openocr/configs/rec/svtrs/focalnet_base_rctc.yml +109 -0
  94. openocr/configs/rec/svtrs/focalsvtr_ctc.yml +106 -0
  95. openocr/configs/rec/svtrs/focalsvtr_rctc.yml +107 -0
  96. openocr/configs/rec/svtrs/resnet45_trans_ctc.yml +103 -0
  97. openocr/configs/rec/svtrs/resnet45_trans_rctc.yml +104 -0
  98. openocr/configs/rec/svtrs/svtr_base_ctc.yml +110 -0
  99. openocr/configs/rec/svtrs/svtr_base_rctc.yml +111 -0
  100. openocr/configs/rec/svtrs/svtrnet_ctc_syn.yml +111 -0
  101. openocr/configs/rec/svtrs/vit_ctc.yml +103 -0
  102. openocr/configs/rec/svtrs/vit_rctc.yml +103 -0
  103. openocr/configs/rec/svtrv2/repsvtr_ch.yml +113 -0
  104. openocr/configs/rec/svtrv2/svtrv2_ch.yml +125 -0
  105. openocr/configs/rec/svtrv2/svtrv2_ctc.yml +136 -0
  106. openocr/configs/rec/svtrv2/svtrv2_rctc.yml +135 -0
  107. openocr/configs/rec/svtrv2/svtrv2_small_rctc.yml +135 -0
  108. openocr/configs/rec/svtrv2/svtrv2_smtr_gtc_rctc.yml +162 -0
  109. openocr/configs/rec/svtrv2/svtrv2_smtr_gtc_rctc_ch.yml +153 -0
  110. openocr/configs/rec/svtrv2/svtrv2_smtr_gtc_rctc_infer.yml +151 -0
  111. openocr/configs/rec/svtrv2/svtrv2_tiny_rctc.yml +135 -0
  112. openocr/configs/rec/unirec/focalsvtr_ardecoder_unirec.yml +114 -0
  113. openocr/configs/rec/unirec/opendoc_pipeline.yml +105 -0
  114. openocr/configs/rec/visionlan/resnet45_trans_visionlan_LA.yml +103 -0
  115. openocr/configs/rec/visionlan/resnet45_trans_visionlan_LF_1.yml +102 -0
  116. openocr/configs/rec/visionlan/resnet45_trans_visionlan_LF_2.yml +103 -0
  117. openocr/configs/rec/visionlan/svtrv2_visionlan_LA.yml +112 -0
  118. openocr/configs/rec/visionlan/svtrv2_visionlan_LF_1.yml +111 -0
  119. openocr/configs/rec/visionlan/svtrv2_visionlan_LF_2.yml +112 -0
  120. openocr/demo_gradio.py +303 -0
  121. openocr/demo_opendoc.py +584 -0
  122. openocr/demo_unirec.py +430 -0
  123. openocr/opendet/losses/__init__.py +20 -0
  124. openocr/opendet/losses/db_loss.py +87 -0
  125. openocr/opendet/losses/det_basic_loss.py +159 -0
  126. openocr/opendet/metrics/__init__.py +16 -0
  127. openocr/opendet/metrics/det_metric.py +156 -0
  128. openocr/opendet/metrics/eval_det_iou.py +211 -0
  129. openocr/opendet/modeling/__init__.py +11 -0
  130. openocr/opendet/modeling/backbones/__init__.py +14 -0
  131. openocr/opendet/modeling/backbones/repvit.py +340 -0
  132. openocr/opendet/modeling/base_detector.py +69 -0
  133. openocr/opendet/modeling/heads/__init__.py +14 -0
  134. openocr/opendet/modeling/heads/db_head.py +73 -0
  135. openocr/opendet/modeling/necks/__init__.py +14 -0
  136. openocr/opendet/modeling/necks/db_fpn.py +609 -0
  137. openocr/opendet/postprocess/__init__.py +18 -0
  138. openocr/opendet/postprocess/db_postprocess.py +277 -0
  139. openocr/opendet/preprocess/__init__.py +170 -0
  140. openocr/opendet/preprocess/crop_paste.py +178 -0
  141. openocr/opendet/preprocess/crop_resize.py +273 -0
  142. openocr/opendet/preprocess/db_label_encode.py +313 -0
  143. openocr/opendet/preprocess/db_resize_for_test.py +137 -0
  144. openocr/opendet/preprocess/iaa_augment.py +230 -0
  145. openocr/openocr.py +726 -0
  146. openocr/openrec/losses/__init__.py +71 -0
  147. openocr/openrec/losses/abinet_loss.py +42 -0
  148. openocr/openrec/losses/ar_loss.py +23 -0
  149. openocr/openrec/losses/cam_loss.py +48 -0
  150. openocr/openrec/losses/cdistnet_loss.py +34 -0
  151. openocr/openrec/losses/ce_loss.py +68 -0
  152. openocr/openrec/losses/cmer_loss.py +12 -0
  153. openocr/openrec/losses/cppd_loss.py +77 -0
  154. openocr/openrec/losses/ctc_loss.py +33 -0
  155. openocr/openrec/losses/igtr_loss.py +12 -0
  156. openocr/openrec/losses/lister_loss.py +14 -0
  157. openocr/openrec/losses/lpv_loss.py +30 -0
  158. openocr/openrec/losses/mdiff_loss.py +11 -0
  159. openocr/openrec/losses/mgp_loss.py +34 -0
  160. openocr/openrec/losses/parseq_loss.py +12 -0
  161. openocr/openrec/losses/robustscanner_loss.py +20 -0
  162. openocr/openrec/losses/seed_loss.py +46 -0
  163. openocr/openrec/losses/smtr_loss.py +12 -0
  164. openocr/openrec/losses/srn_loss.py +40 -0
  165. openocr/openrec/losses/unirec_loss.py +12 -0
  166. openocr/openrec/losses/visionlan_loss.py +58 -0
  167. openocr/openrec/metrics/__init__.py +33 -0
  168. openocr/openrec/metrics/rec_metric.py +270 -0
  169. openocr/openrec/metrics/rec_metric_cmer.py +328 -0
  170. openocr/openrec/metrics/rec_metric_gtc.py +58 -0
  171. openocr/openrec/metrics/rec_metric_long.py +142 -0
  172. openocr/openrec/metrics/rec_metric_mgp.py +93 -0
  173. openocr/openrec/modeling/__init__.py +11 -0
  174. openocr/openrec/modeling/base_recognizer.py +69 -0
  175. openocr/openrec/modeling/cmer_modeling/modeling_cmer.py +643 -0
  176. openocr/openrec/modeling/common.py +238 -0
  177. openocr/openrec/modeling/decoders/__init__.py +114 -0
  178. openocr/openrec/modeling/decoders/abinet_decoder.py +283 -0
  179. openocr/openrec/modeling/decoders/aster_decoder.py +170 -0
  180. openocr/openrec/modeling/decoders/bus_decoder.py +133 -0
  181. openocr/openrec/modeling/decoders/cam_decoder.py +43 -0
  182. openocr/openrec/modeling/decoders/cdistnet_decoder.py +334 -0
  183. openocr/openrec/modeling/decoders/cppd_decoder.py +393 -0
  184. openocr/openrec/modeling/decoders/ctc_decoder.py +203 -0
  185. openocr/openrec/modeling/decoders/dan_decoder.py +203 -0
  186. openocr/openrec/modeling/decoders/dptr_parseq_clip_b_decoder.py +1563 -0
  187. openocr/openrec/modeling/decoders/igtr_decoder.py +905 -0
  188. openocr/openrec/modeling/decoders/lister_decoder.py +535 -0
  189. openocr/openrec/modeling/decoders/lpv_decoder.py +119 -0
  190. openocr/openrec/modeling/decoders/matrn_decoder.py +236 -0
  191. openocr/openrec/modeling/decoders/mdiff_decoder.py +587 -0
  192. openocr/openrec/modeling/decoders/mgp_decoder.py +99 -0
  193. openocr/openrec/modeling/decoders/nrtr_decoder.py +439 -0
  194. openocr/openrec/modeling/decoders/ote_decoder.py +205 -0
  195. openocr/openrec/modeling/decoders/parseq_decoder.py +504 -0
  196. openocr/openrec/modeling/decoders/rctc_decoder.py +70 -0
  197. openocr/openrec/modeling/decoders/robustscanner_decoder.py +749 -0
  198. openocr/openrec/modeling/decoders/sar_decoder.py +236 -0
  199. openocr/openrec/modeling/decoders/smtr_decoder.py +672 -0
  200. openocr/openrec/modeling/decoders/smtr_decoder_nattn.py +521 -0
  201. openocr/openrec/modeling/decoders/srn_decoder.py +283 -0
  202. openocr/openrec/modeling/decoders/visionlan_decoder.py +321 -0
  203. openocr/openrec/modeling/encoders/__init__.py +41 -0
  204. openocr/openrec/modeling/encoders/autostr_encoder.py +327 -0
  205. openocr/openrec/modeling/encoders/cam_encoder.py +760 -0
  206. openocr/openrec/modeling/encoders/convnextv2.py +213 -0
  207. openocr/openrec/modeling/encoders/focalsvtr.py +631 -0
  208. openocr/openrec/modeling/encoders/nrtr_encoder.py +28 -0
  209. openocr/openrec/modeling/encoders/rec_hgnet.py +346 -0
  210. openocr/openrec/modeling/encoders/rec_lcnetv3.py +488 -0
  211. openocr/openrec/modeling/encoders/rec_mobilenet_v3.py +132 -0
  212. openocr/openrec/modeling/encoders/rec_mv1_enhance.py +254 -0
  213. openocr/openrec/modeling/encoders/rec_nrtr_mtb.py +37 -0
  214. openocr/openrec/modeling/encoders/rec_resnet_31.py +213 -0
  215. openocr/openrec/modeling/encoders/rec_resnet_45.py +183 -0
  216. openocr/openrec/modeling/encoders/rec_resnet_fpn.py +216 -0
  217. openocr/openrec/modeling/encoders/rec_resnet_vd.py +252 -0
  218. openocr/openrec/modeling/encoders/repvit.py +338 -0
  219. openocr/openrec/modeling/encoders/resnet31_rnn.py +123 -0
  220. openocr/openrec/modeling/encoders/svtrnet.py +574 -0
  221. openocr/openrec/modeling/encoders/svtrnet2dpos.py +616 -0
  222. openocr/openrec/modeling/encoders/svtrv2.py +470 -0
  223. openocr/openrec/modeling/encoders/svtrv2_lnconv.py +503 -0
  224. openocr/openrec/modeling/encoders/svtrv2_lnconv_two33.py +517 -0
  225. openocr/openrec/modeling/encoders/vit.py +120 -0
  226. openocr/openrec/modeling/transforms/__init__.py +15 -0
  227. openocr/openrec/modeling/transforms/aster_tps.py +262 -0
  228. openocr/openrec/modeling/transforms/moran.py +136 -0
  229. openocr/openrec/modeling/transforms/tps.py +246 -0
  230. openocr/openrec/modeling/unirec_modeling/configuration_unirec.py +166 -0
  231. openocr/openrec/modeling/unirec_modeling/modeling_unirec.py +433 -0
  232. openocr/openrec/optimizer/__init__.py +74 -0
  233. openocr/openrec/optimizer/lr.py +276 -0
  234. openocr/openrec/postprocess/__init__.py +88 -0
  235. openocr/openrec/postprocess/abinet_postprocess.py +37 -0
  236. openocr/openrec/postprocess/ar_postprocess.py +63 -0
  237. openocr/openrec/postprocess/ce_postprocess.py +43 -0
  238. openocr/openrec/postprocess/char_postprocess.py +108 -0
  239. openocr/openrec/postprocess/cmer_postprocess.py +86 -0
  240. openocr/openrec/postprocess/cppd_postprocess.py +42 -0
  241. openocr/openrec/postprocess/ctc_postprocess.py +118 -0
  242. openocr/openrec/postprocess/igtr_postprocess.py +100 -0
  243. openocr/openrec/postprocess/lister_postprocess.py +59 -0
  244. openocr/openrec/postprocess/mgp_postprocess.py +143 -0
  245. openocr/openrec/postprocess/nrtr_postprocess.py +75 -0
  246. openocr/openrec/postprocess/smtr_postprocess.py +73 -0
  247. openocr/openrec/postprocess/srn_postprocess.py +80 -0
  248. openocr/openrec/postprocess/unirec_postprocess.py +58 -0
  249. openocr/openrec/postprocess/visionlan_postprocess.py +81 -0
  250. openocr/openrec/preprocess/__init__.py +179 -0
  251. openocr/openrec/preprocess/abinet_aug.py +473 -0
  252. openocr/openrec/preprocess/abinet_label_encode.py +36 -0
  253. openocr/openrec/preprocess/ar_label_encode.py +36 -0
  254. openocr/openrec/preprocess/auto_augment.py +1012 -0
  255. openocr/openrec/preprocess/cam_label_encode.py +141 -0
  256. openocr/openrec/preprocess/ce_label_encode.py +116 -0
  257. openocr/openrec/preprocess/char_label_encode.py +36 -0
  258. openocr/openrec/preprocess/cmer_label_encode.py +1025 -0
  259. openocr/openrec/preprocess/cppd_label_encode.py +173 -0
  260. openocr/openrec/preprocess/ctc_label_encode.py +124 -0
  261. openocr/openrec/preprocess/dptr_label_encode.py +177 -0
  262. openocr/openrec/preprocess/ep_label_encode.py +38 -0
  263. openocr/openrec/preprocess/igtr_label_encode.py +373 -0
  264. openocr/openrec/preprocess/mdiff_label_encode.py +312 -0
  265. openocr/openrec/preprocess/mgp_label_encode.py +95 -0
  266. openocr/openrec/preprocess/parseq_aug.py +150 -0
  267. openocr/openrec/preprocess/rec_aug.py +338 -0
  268. openocr/openrec/preprocess/resize.py +599 -0
  269. openocr/openrec/preprocess/smtr_label_encode.py +125 -0
  270. openocr/openrec/preprocess/srn_label_encode.py +37 -0
  271. openocr/openrec/preprocess/unirec_label_encode.py +62 -0
  272. openocr/openrec/preprocess/visionlan_label_encode.py +67 -0
  273. openocr/tools/__init__.py +0 -0
  274. openocr/tools/create_lmdb_dataset.py +119 -0
  275. openocr/tools/data/__init__.py +136 -0
  276. openocr/tools/data/cmer_web_dataset.py +310 -0
  277. openocr/tools/data/collate_fn.py +100 -0
  278. openocr/tools/data/lmdb_dataset.py +142 -0
  279. openocr/tools/data/lmdb_dataset_test.py +167 -0
  280. openocr/tools/data/multi_scale_sampler.py +177 -0
  281. openocr/tools/data/native_size_dataset.py +799 -0
  282. openocr/tools/data/native_size_sampler.py +158 -0
  283. openocr/tools/data/ratio_dataset.py +217 -0
  284. openocr/tools/data/ratio_dataset_test.py +273 -0
  285. openocr/tools/data/ratio_dataset_tvresize.py +215 -0
  286. openocr/tools/data/ratio_dataset_tvresize_test.py +276 -0
  287. openocr/tools/data/ratio_sampler.py +191 -0
  288. openocr/tools/data/simple_dataset.py +266 -0
  289. openocr/tools/data/strlmdb_dataset.py +144 -0
  290. openocr/tools/data/text_lmdb_dataset.py +131 -0
  291. openocr/tools/download/download_dataset.py +38 -0
  292. openocr/tools/download/utils.py +28 -0
  293. openocr/tools/download_example_images.py +236 -0
  294. openocr/tools/engine/config.py +158 -0
  295. openocr/tools/engine/trainer.py +592 -0
  296. openocr/tools/eval_det.py +42 -0
  297. openocr/tools/eval_rec.py +42 -0
  298. openocr/tools/eval_rec_all_ch.py +185 -0
  299. openocr/tools/eval_rec_all_en.py +207 -0
  300. openocr/tools/eval_rec_all_long.py +120 -0
  301. openocr/tools/eval_rec_all_long_simple.py +123 -0
  302. openocr/tools/export_rec.py +118 -0
  303. openocr/tools/infer/onnx_engine.py +65 -0
  304. openocr/tools/infer/predict_rec.py +140 -0
  305. openocr/tools/infer/utility.py +236 -0
  306. openocr/tools/infer_det.py +374 -0
  307. openocr/tools/infer_doc.py +898 -0
  308. openocr/tools/infer_doc_onnx.py +1381 -0
  309. openocr/tools/infer_e2e.py +471 -0
  310. openocr/tools/infer_e2e_parallel.py +184 -0
  311. openocr/tools/infer_rec.py +506 -0
  312. openocr/tools/infer_unirec_onnx.py +807 -0
  313. openocr/tools/to_markdown.py +468 -0
  314. openocr/tools/toonnx.py +77 -0
  315. openocr/tools/train_det.py +40 -0
  316. openocr/tools/train_rec.py +40 -0
  317. openocr/tools/utility.py +45 -0
  318. openocr/tools/utils/EN_symbol_dict.txt +94 -0
  319. openocr/tools/utils/__init__.py +0 -0
  320. openocr/tools/utils/ckpt.py +99 -0
  321. openocr/tools/utils/dict/ar_dict.txt +117 -0
  322. openocr/tools/utils/dict/arabic_dict.txt +161 -0
  323. openocr/tools/utils/dict/be_dict.txt +145 -0
  324. openocr/tools/utils/dict/bg_dict.txt +140 -0
  325. openocr/tools/utils/dict/chinese_cht_dict.txt +8421 -0
  326. openocr/tools/utils/dict/cyrillic_dict.txt +163 -0
  327. openocr/tools/utils/dict/devanagari_dict.txt +167 -0
  328. openocr/tools/utils/dict/en_dict.txt +63 -0
  329. openocr/tools/utils/dict/fa_dict.txt +136 -0
  330. openocr/tools/utils/dict/french_dict.txt +136 -0
  331. openocr/tools/utils/dict/german_dict.txt +143 -0
  332. openocr/tools/utils/dict/hi_dict.txt +162 -0
  333. openocr/tools/utils/dict/it_dict.txt +118 -0
  334. openocr/tools/utils/dict/japan_dict.txt +4399 -0
  335. openocr/tools/utils/dict/ka_dict.txt +153 -0
  336. openocr/tools/utils/dict/kie_dict/xfund_class_list.txt +4 -0
  337. openocr/tools/utils/dict/korean_dict.txt +3688 -0
  338. openocr/tools/utils/dict/latex_symbol_dict.txt +111 -0
  339. openocr/tools/utils/dict/latin_dict.txt +185 -0
  340. openocr/tools/utils/dict/layout_dict/layout_cdla_dict.txt +10 -0
  341. openocr/tools/utils/dict/layout_dict/layout_publaynet_dict.txt +5 -0
  342. openocr/tools/utils/dict/layout_dict/layout_table_dict.txt +1 -0
  343. openocr/tools/utils/dict/mr_dict.txt +153 -0
  344. openocr/tools/utils/dict/ne_dict.txt +153 -0
  345. openocr/tools/utils/dict/oc_dict.txt +96 -0
  346. openocr/tools/utils/dict/pu_dict.txt +130 -0
  347. openocr/tools/utils/dict/rs_dict.txt +91 -0
  348. openocr/tools/utils/dict/rsc_dict.txt +134 -0
  349. openocr/tools/utils/dict/ru_dict.txt +125 -0
  350. openocr/tools/utils/dict/spin_dict.txt +68 -0
  351. openocr/tools/utils/dict/ta_dict.txt +128 -0
  352. openocr/tools/utils/dict/table_dict.txt +277 -0
  353. openocr/tools/utils/dict/table_master_structure_dict.txt +39 -0
  354. openocr/tools/utils/dict/table_structure_dict.txt +28 -0
  355. openocr/tools/utils/dict/table_structure_dict_ch.txt +48 -0
  356. openocr/tools/utils/dict/te_dict.txt +151 -0
  357. openocr/tools/utils/dict/ug_dict.txt +114 -0
  358. openocr/tools/utils/dict/uk_dict.txt +142 -0
  359. openocr/tools/utils/dict/ur_dict.txt +137 -0
  360. openocr/tools/utils/dict/xi_dict.txt +110 -0
  361. openocr/tools/utils/dict90.txt +90 -0
  362. openocr/tools/utils/e2e_metric/Deteval.py +802 -0
  363. openocr/tools/utils/e2e_metric/polygon_fast.py +70 -0
  364. openocr/tools/utils/e2e_utils/extract_batchsize.py +86 -0
  365. openocr/tools/utils/e2e_utils/extract_textpoint_fast.py +479 -0
  366. openocr/tools/utils/e2e_utils/extract_textpoint_slow.py +582 -0
  367. openocr/tools/utils/e2e_utils/pgnet_pp_utils.py +159 -0
  368. openocr/tools/utils/e2e_utils/visual.py +152 -0
  369. openocr/tools/utils/en_dict.txt +95 -0
  370. openocr/tools/utils/gen_label.py +68 -0
  371. openocr/tools/utils/ic15_dict.txt +36 -0
  372. openocr/tools/utils/logging.py +54 -0
  373. openocr/tools/utils/opendoc_onnx_utils/utils.py +1052 -0
  374. openocr/tools/utils/poly_nms.py +132 -0
  375. openocr/tools/utils/ppocr_keys_v1.txt +6623 -0
  376. openocr/tools/utils/stats.py +58 -0
  377. openocr/tools/utils/utility.py +165 -0
  378. openocr/tools/utils/visual.py +117 -0
  379. openocry-0.1.5.dist-info/METADATA +317 -0
  380. openocry-0.1.5.dist-info/RECORD +384 -0
  381. openocry-0.1.5.dist-info/WHEEL +5 -0
  382. openocry-0.1.5.dist-info/entry_points.txt +2 -0
  383. openocry-0.1.5.dist-info/licenses/LICENSE +201 -0
  384. openocry-0.1.5.dist-info/top_level.txt +1 -0
openocr/__init__.py ADDED
@@ -0,0 +1,45 @@
1
+ from __future__ import absolute_import
2
+ from __future__ import division
3
+ from __future__ import print_function
4
+ import os
5
+ import sys
6
+
7
+ __dir__ = os.path.dirname(os.path.abspath(__file__))
8
+ sys.path.append(__dir__)
9
+ sys.path.insert(0, os.path.abspath(os.path.join(__dir__, '..')))
10
+
11
+ # from .tools.infer_e2e import OpenOCRE2E, OpenDetector, OpenRecognizer
12
+ # from .tools.infer_unirec_onnx import UniRecONNX
13
+ # from .tools.infer_doc_onnx import OpenDocONNX
14
+ from .openocr import OpenOCR, main
15
+
16
+ __version__ = '0.1.5'
17
+
18
+ # Lazy import for demo interfaces to avoid initialization on import
19
+ def launch_openocr_demo(*args, **kwargs):
20
+ """Launch Gradio OCR demo"""
21
+ from .demo_gradio import launch_demo
22
+ return launch_demo(*args, **kwargs)
23
+
24
+ def launch_unirec_demo(*args, **kwargs):
25
+ """Launch UniRec demo"""
26
+ from .demo_unirec import launch_demo
27
+ return launch_demo(*args, **kwargs)
28
+
29
+ def launch_opendoc_demo(*args, **kwargs):
30
+ """Launch OpenDoc demo"""
31
+ from .demo_opendoc import launch_demo
32
+ return launch_demo(*args, **kwargs)
33
+
34
+ __all__ = [
35
+ 'OpenOCRE2E',
36
+ 'OpenDetector',
37
+ 'OpenRecognizer',
38
+ 'UniRecONNX',
39
+ 'OpenDocONNX',
40
+ 'OpenOCR',
41
+ 'main',
42
+ 'launch_openocr_demo',
43
+ 'launch_unirec_demo',
44
+ 'launch_opendoc_demo',
45
+ ]
@@ -0,0 +1,41 @@
1
+ root: ../evaluation
2
+ task: str
3
+ download_links:
4
+ # IC15_1811
5
+ - https://drive.usercontent.google.com/download?id=1eGY0kXNV1qVxeUpoGzs-ioUO-ky7msH6&authuser=0&confirm=t
6
+ - https://drive.usercontent.google.com/download?id=1BWv7aLoLAT7avY326gXP3GJF48UZpuBC&authuser=0&confirm=t
7
+ # SVT
8
+ - https://drive.usercontent.google.com/download?id=1ecEZ4cJ7dIbTCZRltE0s5KzUotQWagH-&authuser=0&confirm=t
9
+ - https://drive.usercontent.google.com/download?id=1OygBP7i9R-3Pwi6WodCcW31J8CUMugOJ&authuser=0&confirm=t
10
+ # IIIT5k
11
+ - https://drive.usercontent.google.com/download?id=1PJ9_IvIGZTS5hHdGLnpKuYKZcCO8jE0E&authuser=0&confirm=t
12
+ - https://drive.usercontent.google.com/download?id=10P3MixSBt1v8k8_6aFfziC33Z5IlM6Uf&authuser=0&confirm=t
13
+ # IC13_857
14
+ - https://drive.usercontent.google.com/download?id=1-wMHOFBXJaOaY-UD00nDn6qw2s_8R4Vd&authuser=0&confirm=t
15
+ - https://drive.usercontent.google.com/download?id=1J1QCFtOFxFKiLJIgTqZ6eRo9Y5QGqHpA&authuser=0&confirm=t
16
+ # SVTP
17
+ - https://drive.usercontent.google.com/download?id=1kckwfZkdaHG8k_FW5IIJKUaYZkF21Hza&authuser=0&confirm=t
18
+ - https://drive.usercontent.google.com/download?id=1x61lm_ea7lvIdxNPMG-jy-5W0MxtdH0N&authuser=0&confirm=t
19
+ # CUTE80
20
+ - https://drive.usercontent.google.com/download?id=1Zv_91c81tinLy5Je89HPr-5wUSnqXKIB&authuser=0&confirm=t
21
+ - https://drive.usercontent.google.com/download?id=1OuJ6QoJ9AlyNHIM9j2WedAPxTnac7kyY&authuser=0&confirm=t
22
+ filenames:
23
+ # IC15_1811
24
+ - ../evaluation/IC15_1811/data.mdb
25
+ - ../evaluation/IC15_1811/lock.mdb
26
+ # SVT
27
+ - ../evaluation/SVT/data.mdb
28
+ - ../evaluation/SVT/lock.mdb
29
+ # IIIT5k
30
+ - ../evaluation/IIIT5k/data.mdb
31
+ - ../evaluation/IIIT5k/lock.mdb
32
+ # IC13_857
33
+ - ../evaluation/IC13_857/data.mdb
34
+ - ../evaluation/IC13_857/lock.mdb
35
+ # SVTP
36
+ - ../evaluation/SVTP/data.mdb
37
+ - ../evaluation/SVTP/lock.mdb
38
+ # CUTE80
39
+ - ../evaluation/CUTE80/data.mdb
40
+ - ../evaluation/CUTE80/lock.mdb
41
+ check_validity: true
@@ -0,0 +1,9 @@
1
+ root: ../ltb
2
+ task: str
3
+ download_links:
4
+ - https://drive.usercontent.google.com/download?id=16AEA1YGTsyVB44uEjKi4ZUV1snjCYBr4&authuser=0&confirm=t
5
+ - https://drive.usercontent.google.com/download?id=1xU4OStrOaI23bPG4flWAPWn2YrQe2bmY&authuser=0&confirm=t
6
+ filenames:
7
+ - ../ltb/data.mdb
8
+ - ../ltb/lock.mdb
9
+ check_validity: true
@@ -0,0 +1,11 @@
1
+ root: ../synth
2
+ task: str
3
+ download_links:
4
+ - https://drive.usercontent.google.com/download?id=1FIoplSFZ-BKQoRDHDXsVMKa844e-K8PD&authuser=0&confirm=t
5
+ - https://drive.usercontent.google.com/download?id=1eckTvaeRtlTZvbO2orrVz-cIuIk6i87K&authuser=0&confirm=t
6
+ - https://drive.usercontent.google.com/download?id=1PBXTf-2PnmEvJBsqzJqxxRwzhAZGTiMG&authuser=0&confirm=t
7
+ filenames:
8
+ - ../synth/MJ_train.zip
9
+ - ../synth/MJ_val.zip
10
+ - ../synth/MJ_test.zip
11
+ check_validity: true
@@ -0,0 +1,25 @@
1
+ root: ../OpenVINO
2
+ task: str
3
+ download_links:
4
+ # train_1
5
+ - https://drive.usercontent.google.com/download?id=1q23QAIRTyG0t-bBm4aAwRwiqB6VUfphw&authuser=0&confirm=
6
+ # train_2
7
+ - https://drive.usercontent.google.com/download?id=1AtbaJljM68cbZqi5lcM92d9VkQUCbSqI&authuser=0&confirm=
8
+ # train_5
9
+ - https://drive.usercontent.google.com/download?id=1dejstYnJ8_sESuO_uvwi__jT1B8gPxf3&authuser=0&confirm=t
10
+ # train_f
11
+ - https://drive.usercontent.google.com/download?id=1C4akchTc7-yi1OS_sJ3KP693UKcnecke&authuser=0&confirm=t
12
+ # validation
13
+ - https://drive.usercontent.google.com/download?id=17TRzSQhuK_juAxAv3KmX0y13pQP2cz6R&authuser=0&confirm=t
14
+ filenames:
15
+ # train_1
16
+ - ../OpenVINO/train_1.zip
17
+ # train_2
18
+ - ../OpenVINO/train_2.zip
19
+ # train_5
20
+ - ../OpenVINO/train_5.zip
21
+ # train_f
22
+ - ../OpenVINO/train_f.zip
23
+ # validation
24
+ - ../OpenVINO/validation.zip
25
+ check_validity: true
@@ -0,0 +1,17 @@
1
+ root: ../OST
2
+ task: str
3
+ download_links:
4
+ # OST heavy
5
+ - https://drive.usercontent.google.com/download?id=1RGpIFbD_SRlrzZFBoVF_LGvetNx1-5pg&authuser=0&confirm=t
6
+ - https://drive.usercontent.google.com/download?id=1Th4MfDf44k0EBpIqCLqVoGRu6G-FP1hq&authuser=0&confirm=t
7
+ # OST weak
8
+ - https://drive.usercontent.google.com/download?id=1z5CTDJucUnvALG12Q4UXk1DDKJDd8WJn&authuser=0&confirm=t
9
+ - https://drive.usercontent.google.com/download?id=1V17TTkX3sjpV7v0km_F2SDCK0tL3k_ls&authuser=0&confirm=t
10
+ filenames:
11
+ # OST heavy
12
+ - ../OST/heavy/data.mdb
13
+ - ../OST/heavy/lock.mdb
14
+ # OST weak
15
+ - ../OST/weak/data.mdb
16
+ - ../OST/weak/lock.mdb
17
+ check_validity: true
@@ -0,0 +1,7 @@
1
+ root: ../synth
2
+ task: str
3
+ download_links:
4
+ - https://drive.usercontent.google.com/download?id=1T-enqkq6_l2HqrsV3da_h0oJ7CUKu_oc&authuser=0&confirm=t
5
+ filenames:
6
+ - ../synth/ST.zip
7
+ check_validity: true
@@ -0,0 +1,77 @@
1
+ root: ../test
2
+ task: str
3
+ download_links:
4
+ # IC13_857
5
+ - https://drive.usercontent.google.com/download?id=1PZSCbe6_DI8MlCqCRWXGT2PP92_frIXq&authuser=0&confirm=t
6
+ - https://drive.usercontent.google.com/download?id=1qkN7NDg0zUHxUiZHAeEatDTqlsgpFWp3&authuser=0&confirm=t
7
+ # IC15_2077
8
+ - https://drive.usercontent.google.com/download?id=1dFkY3DNbr-Mepn3TWBiA9COEJ63fGFcp&authuser=0&confirm=t
9
+ - https://drive.usercontent.google.com/download?id=1UvVwLNZ3tS1YdTBa8MulPzjeVezKaDro&authuser=0&confirm=t
10
+ # SVTP
11
+ - https://drive.usercontent.google.com/download?id=1aofeerilxJ7J3S7QxuCEXbmXTpz8Xshx&authuser=0&confirm=t
12
+ - https://drive.usercontent.google.com/download?id=1rJ1KoO4K_VUxEAUN_bMgBGzK8_JZAAno&authuser=0&confirm=t
13
+ # IIIT5k
14
+ - https://drive.usercontent.google.com/download?id=1XFO2M1Kbgwv3-iTNTmhQXAEjNmKYOeoT&authuser=0&confirm=t
15
+ - https://drive.usercontent.google.com/download?id=1stwK2hFsyaV7HHsEG9EYgnUQebNb2_nG&authuser=0&confirm=t
16
+ # COCOv1.4
17
+ - https://drive.usercontent.google.com/download?id=1Se2QSGS19xx7Gfy-SUdX9mlAOr2eYsfA&authuser=0&confirm=t
18
+ - https://drive.usercontent.google.com/download?id=1xvekFi389QfkH7yS0JIVV0QzjhUspjDv&authuser=0&confirm=t
19
+ # IC15_1811
20
+ - https://drive.usercontent.google.com/download?id=1pHsw8wrThD9EGEE6AusQLZozefSj4iyR&authuser=0&confirm=t
21
+ - https://drive.usercontent.google.com/download?id=1TXZ1qHuKAksaAlvd3qMv4IHKnN-IJW9a&authuser=0&confirm=t
22
+ # Uber
23
+ - https://drive.usercontent.google.com/download?id=1L2j6BZeLTGQ1FIl8HB_D3AFiWLltGV5r&authuser=0&confirm=t
24
+ - https://drive.usercontent.google.com/download?id=12DUj28yzLWxFO_gfMfSjTkRujYD5MNEE&authuser=0&confirm=t
25
+ # IC13_1095
26
+ - https://drive.usercontent.google.com/download?id=1fu8onMt3Z6fDLNAiHcm-sQ2qCXduE-FU&authuser=0&confirm=t
27
+ - https://drive.usercontent.google.com/download?id=1OQAZtLj8U2Cl4L0ErGFsz6vGIVTTWasD&authuser=0&confirm=t
28
+ # IC13_1015
29
+ - https://drive.usercontent.google.com/download?id=1mbsfuvWB282HYfn9tbqcj1nUDkLXcSNB&authuser=0&confirm=t
30
+ - https://drive.usercontent.google.com/download?id=1QGogU_hV-oN7iY2POutdD2LDcmK6plnV&authuser=0&confirm=t
31
+ # ArT
32
+ - https://drive.usercontent.google.com/download?id=1-53knSy-uTSngCG7wyBngVyTuTCmdnWl&authuser=0&confirm=t
33
+ - https://drive.usercontent.google.com/download?id=172EsSaf7BVaB1ORtohi-Jc_8SuUKZGGf&authuser=0&confirm=t
34
+ # SVT
35
+ - https://drive.usercontent.google.com/download?id=1p7aVUr9Yr7c4X4YUBvk2-YP28rraHjn9&authuser=0&confirm=t
36
+ - https://drive.usercontent.google.com/download?id=1ALmhvSleZ0yf-lcdbQPP3M9Zc3oqnXij&authuser=0&confirm=t
37
+ # CUTE80
38
+ - https://drive.usercontent.google.com/download?id=1Ujr4axHKnu54P2rIGUhkjdM6XlhDYrI_&authuser=0&confirm=t
39
+ - https://drive.usercontent.google.com/download?id=1DvZi9L3MqjO2zRUyCg3YvP4qMAt2bsme&authuser=0&confirm=t
40
+ filenames:
41
+ # IC13_857
42
+ - ../test/IC13_857/data.mdb
43
+ - ../test/IC13_857/lock.mdb
44
+ # IC15_2077
45
+ - ../test/IC15_2077/data.mdb
46
+ - ../test/IC15_2077/lock.mdb
47
+ # SVTP
48
+ - ../test/SVTP/data.mdb
49
+ - ../test/SVTP/lock.mdb
50
+ # IIIT5k
51
+ - ../test/IIIT5k/data.mdb
52
+ - ../test/IIIT5k/lock.mdb
53
+ # COCOv1.4
54
+ - ../test/COCOv1.4/data.mdb
55
+ - ../test/COCOv1.4/lock.mdb
56
+ # IC15_1811
57
+ - ../test/IC15_1811/data.mdb
58
+ - ../test/IC15_1811/lock.mdb
59
+ # Uber
60
+ - ../test/Uber/data.mdb
61
+ - ../test/Uber/lock.mdb
62
+ # IC13_1095
63
+ - ../test/IC13_1095/data.mdb
64
+ - ../test/IC13_1095/lock.mdb
65
+ # IC13_1015
66
+ - ../test/IC13_1015/data.mdb
67
+ - ../test/IC13_1015/lock.mdb
68
+ # ArT
69
+ - ../test/ArT/data.mdb
70
+ - ../test/ArT/lock.mdb
71
+ # SVT
72
+ - ../test/SVT/data.mdb
73
+ - ../test/SVT/lock.mdb
74
+ # CUTE80
75
+ - ../test/CUTE80/data.mdb
76
+ - ../test/CUTE80/lock.mdb
77
+ check_validity: true
@@ -0,0 +1,13 @@
1
+ root: ../TextOCR
2
+ task: str
3
+ download_links:
4
+ # train
5
+ - https://drive.usercontent.google.com/download?id=1jVjJFno4pnsU0Cp_kn4MIXQrChmELy92&authuser=0&confirm=
6
+ # val
7
+ - https://drive.usercontent.google.com/download?id=1ubIRu01MXIek6OvInu-XjaIbw6277-vw&authuser=0&confirm=t
8
+ filenames:
9
+ # train
10
+ - ../TextOCR/train.zip
11
+ # val
12
+ - ../TextOCR/val.zip
13
+ check_validity: true
@@ -0,0 +1,13 @@
1
+ root: ../TextOCR_horizontal
2
+ task: str
3
+ download_links:
4
+ # train
5
+ - https://drive.usercontent.google.com/download?id=1sWH6J11xbjQb8SH7fdG_8mIKVI81ZQy5&authuser=0&confirm=
6
+ # val
7
+ - https://drive.usercontent.google.com/download?id=1gIE-AU2o-5hvg288-bjphO6UkI5AEQ2d&authuser=0&confirm=t
8
+ filenames:
9
+ # train
10
+ - ../TextOCR_horizontal/train.zip
11
+ # val
12
+ - ../TextOCR_horizontal/val.zip
13
+ check_validity: true
@@ -0,0 +1,47 @@
1
+ root: ../u14m
2
+ task: str
3
+ download_links:
4
+ # artistic
5
+ - https://drive.usercontent.google.com/download?id=1Je2DTuFHnkXDI99yDnm9Anl5naWaCQwd&authuser=0&confirm=t
6
+ - https://drive.usercontent.google.com/download?id=1xtT_Q0juBJUIvAG55qBxoVNNTECd2usZ&authuser=0&confirm=t
7
+ # contextless
8
+ - https://drive.usercontent.google.com/download?id=1_0OzyzWhZOmGrHkayFTVrzhrQrNRDRPR&authuser=0&confirm=t
9
+ - https://drive.usercontent.google.com/download?id=1PPgC42y3xoM9bR0HQFbDYbcT3PzMdD_y&authuser=0&confirm=t
10
+ # salient
11
+ - https://drive.usercontent.google.com/download?id=1tHLMYBmTqRnxvFOTT3dfLfQiundqFWfd&authuser=0&confirm=t
12
+ - https://drive.usercontent.google.com/download?id=13NQgpAtCK0kh9M5E2pAUmKKEp6Qu5Xwj&authuser=0&confirm=t
13
+ # multi_words
14
+ - https://drive.usercontent.google.com/download?id=1IlnDKX3V_Vp9gsDGFB0xoqsVLH1vtxUI&authuser=0&confirm=t
15
+ - https://drive.usercontent.google.com/download?id=1mFFjC7C0CwevvkwFU9YeVbZBdps_3Qpb&authuser=0&confirm=t
16
+ # curve
17
+ - https://drive.usercontent.google.com/download?id=1MxhMd85cmhUtI2lmtXhZQuFk7lav0_fw&authuser=0&confirm=t
18
+ - https://drive.usercontent.google.com/download?id=1N03g-4e-kJG2mRvlM0c5TrwWAkd-iG-Q&authuser=0&confirm=t
19
+ # general
20
+ - https://drive.usercontent.google.com/download?id=1Oqt7OaycP466NWoDmoJ3FqS8YP3YRgvu&authuser=0&confirm=t
21
+ - https://drive.usercontent.google.com/download?id=1K0MrX5eYNt8IIGFHXCwg0_oI5OF5PPFO&authuser=0&confirm=t
22
+ # multi_oriented
23
+ - https://drive.usercontent.google.com/download?id=1TKZFcZPVk0ThqfF-AGhJk_OCLg0ykKbv&authuser=0&confirm=t
24
+ - https://drive.usercontent.google.com/download?id=1PAoLMUWuR7O2-7XRoKkNzQcSiznErQzD&authuser=0&confirm=t
25
+ filenames:
26
+ # artistic
27
+ - ../u14m/artistic/data.mdb
28
+ - ../u14m/artistic/lock.mdb
29
+ # contextless
30
+ - ../u14m/contextless/data.mdb
31
+ - ../u14m/contextless/lock.mdb
32
+ # salient
33
+ - ../u14m/salient/data.mdb
34
+ - ../u14m/salient/lock.mdb
35
+ # multi_words
36
+ - ../u14m/multi_words/data.mdb
37
+ - ../u14m/multi_words/lock.mdb
38
+ # curve
39
+ - ../u14m/curve/data.mdb
40
+ - ../u14m/curve/lock.mdb
41
+ # general
42
+ - ../u14m/general/data.mdb
43
+ - ../u14m/general/lock.mdb
44
+ # multi_oriented
45
+ - ../u14m/multi_oriented/data.mdb
46
+ - ../u14m/multi_oriented/lock.mdb
47
+ check_validity: true
@@ -0,0 +1,35 @@
1
+ root: ../Union14M-L-LMDB-Filtered
2
+ task: str
3
+ download_links:
4
+ # train_challenging
5
+ - https://drive.usercontent.google.com/download?id=1etwzBgGHjsFsb0sygsaRnKbanW2PMe07&authuser=0&confirm=t
6
+ - https://drive.usercontent.google.com/download?id=1ly6FJfPjItwGlVQ-ifTrzzM3rVu3Ezhr&authuser=0&confirm=t
7
+ # train_easy
8
+ - https://drive.usercontent.google.com/download?id=1_zeNluTnywIaa5h3PN-Ah9tKyByypot7&authuser=0&confirm=t
9
+ - https://drive.usercontent.google.com/download?id=1caYLeQHDidXgVBDi9IWXbO1gg__DYq9a&authuser=0&confirm=t
10
+ # train_hard
11
+ - https://drive.usercontent.google.com/download?id=1eP6s2xyYPZX9gykvWA4VSOc3Fqul_UB_&authuser=0&confirm=t
12
+ - https://drive.usercontent.google.com/download?id=1-ZlCvocX8P5uVRclUXp_5DNGLDzd16EO&authuser=0&confirm=t
13
+ # train_medium
14
+ - https://drive.usercontent.google.com/download?id=1s_CoaLNJEr-UxHYiqZ5jOcliMCFiRUUy&authuser=0&confirm=t
15
+ - https://drive.usercontent.google.com/download?id=1Wpj6WVpZ5Ily77kVwfQ18CiZBzkgmEnF&authuser=0&confirm=t
16
+ # train_normal
17
+ - https://drive.usercontent.google.com/download?id=1jPt44arlAswl9cXZjzmVcdpptdTPpJ3I&authuser=0&confirm=t
18
+ - https://drive.usercontent.google.com/download?id=1Rfc5kE03AzOUv7B_eYcBhUV8KMQ2MZ1m&authuser=0&confirm=t
19
+ filenames:
20
+ # train_challenging
21
+ - ../Union14M-L-LMDB-Filtered/train_challenging/data.mdb
22
+ - ../Union14M-L-LMDB-Filtered/train_challenging/lock.mdb
23
+ # train_easy
24
+ - ../Union14M-L-LMDB-Filtered/train_easy/data.mdb
25
+ - ../Union14M-L-LMDB-Filtered/train_easy/lock.mdb
26
+ # train_hard
27
+ - ../Union14M-L-LMDB-Filtered/train_hard/data.mdb
28
+ - ../Union14M-L-LMDB-Filtered/train_hard/lock.mdb
29
+ # train_medium
30
+ - ../Union14M-L-LMDB-Filtered/train_medium/data.mdb
31
+ - ../Union14M-L-LMDB-Filtered/train_medium/lock.mdb
32
+ # train_normal
33
+ - ../Union14M-L-LMDB-Filtered/train_normal/data.mdb
34
+ - ../Union14M-L-LMDB-Filtered/train_normal/lock.mdb
35
+ check_validity: true
@@ -0,0 +1,171 @@
1
+ Global:
2
+ device: gpu
3
+ epoch_num: &epoch_num 500
4
+ log_smooth_window: 20
5
+ print_batch_step: 100
6
+ output_dir: ./output/det_repsvtr_db
7
+ save_epoch_step: [400, 25]
8
+ eval_batch_step:
9
+ - 0
10
+ - 1000
11
+ cal_metric_during_train: false
12
+ checkpoints:
13
+ pretrained_model: openocr_det_repvit_ch.pth
14
+ save_inference_dir: null
15
+ use_tensorboard: false
16
+ infer_img:
17
+ save_res_path: ./checkpoints/det_db/predicts_db.txt
18
+ distributed: true
19
+ model_type: det
20
+
21
+ Architecture:
22
+ algorithm: DB_mobile
23
+ Backbone:
24
+ name: RepSVTR_det
25
+ Neck:
26
+ name: RSEFPN
27
+ out_channels: 96
28
+ shortcut: True
29
+ Head:
30
+ name: DBHead
31
+ k: 50
32
+
33
+ Loss:
34
+ name: DBLoss
35
+ balance_loss: true
36
+ main_loss_type: DiceLoss
37
+ alpha: 5
38
+ beta: 10
39
+ ohem_ratio: 3
40
+
41
+ Optimizer:
42
+ name: Adam
43
+ lr: 0.001
44
+ weight_decay: 5.0e-05
45
+ filter_bias_and_bn: False
46
+
47
+ LRScheduler:
48
+ name: CosineAnnealingLR
49
+ warmup_epoch: 2
50
+
51
+ PostProcess:
52
+ name: DBPostProcess
53
+ thresh: 0.3
54
+ box_thresh: 0.6
55
+ max_candidates: 1000
56
+ unclip_ratio: 1.5
57
+ score_mode: 'slow'
58
+
59
+ Metric:
60
+ name: DetMetric
61
+ main_indicator: hmean
62
+
63
+ Train:
64
+ dataset:
65
+ name: SimpleDataSet
66
+ data_dir: ../icdar2015/text_localization/
67
+ label_file_list:
68
+ - ../icdar2015/text_localization/train_icdar2015_label.txt
69
+ ratio_list: [1.0]
70
+ transforms:
71
+ - DecodeImage:
72
+ img_mode: BGR
73
+ channel_first: false
74
+ - DetLabelEncode: null
75
+ - CopyPaste: null
76
+ - IaaAugment:
77
+ augmenter_args:
78
+ - type: Fliplr
79
+ args:
80
+ p: 0.5
81
+ - type: Affine
82
+ args:
83
+ rotate:
84
+ - -10
85
+ - 10
86
+ - type: Resize
87
+ args:
88
+ size:
89
+ - 0.5
90
+ - 3
91
+ - EastRandomCropData:
92
+ size:
93
+ - 640
94
+ - 640
95
+ max_tries: 50
96
+ keep_ratio: true
97
+ - MakeBorderMap:
98
+ shrink_ratio: 0.4
99
+ thresh_min: 0.3
100
+ thresh_max: 0.7
101
+ total_epoch: *epoch_num
102
+ - MakeShrinkMap:
103
+ shrink_ratio: 0.4
104
+ min_text_size: 8
105
+ total_epoch: *epoch_num
106
+ - NormalizeImage:
107
+ scale: 1./255.
108
+ mean:
109
+ - 0.485
110
+ - 0.456
111
+ - 0.406
112
+ std:
113
+ - 0.229
114
+ - 0.224
115
+ - 0.225
116
+ order: hwc
117
+ - ToCHWImage: null
118
+ - KeepKeys:
119
+ keep_keys:
120
+ - image
121
+ - threshold_map
122
+ - threshold_mask
123
+ - shrink_map
124
+ - shrink_mask
125
+ loader:
126
+ shuffle: true
127
+ drop_last: false
128
+ batch_size_per_card: 8
129
+ num_workers: 8
130
+
131
+ Eval:
132
+ dataset:
133
+ name: SimpleDataSet
134
+ data_dir: ../icdar2015/text_localization/
135
+ label_file_list:
136
+ - ../icdar2015/text_localization/test_icdar2015_label.txt
137
+ transforms:
138
+ - DecodeImage:
139
+ img_mode: BGR
140
+ channel_first: false
141
+ - DetLabelEncode: null
142
+ - DetResizeForTest:
143
+ # image_shape: [1280, 1280]
144
+ # keep_ratio: True
145
+ # padding: True
146
+ limit_side_len: 960
147
+ limit_type: max
148
+ - NormalizeImage:
149
+ scale: 1./255.
150
+ mean:
151
+ - 0.485
152
+ - 0.456
153
+ - 0.406
154
+ std:
155
+ - 0.229
156
+ - 0.224
157
+ - 0.225
158
+ order: hwc
159
+ - ToCHWImage: null
160
+ - KeepKeys:
161
+ keep_keys:
162
+ - image
163
+ - shape
164
+ - polys
165
+ - ignore_tags
166
+ loader:
167
+ shuffle: false
168
+ drop_last: false
169
+ batch_size_per_card: 1
170
+ num_workers: 2
171
+ profiler_options: null
@@ -0,0 +1,94 @@
1
+ Global:
2
+ device: gpu
3
+ epoch_num: 20
4
+ log_smooth_window: 20
5
+ print_batch_step: 10
6
+ output_dir: ./output/rec/u14m_filter/resnet45_trans_abinet_lang/
7
+ eval_epoch_step: [0, 1]
8
+ eval_batch_step: [0, 500]
9
+ cal_metric_during_train: True
10
+ pretrained_model:
11
+ # ./openocr_nolang_abinet_lang.pth
12
+ checkpoints:
13
+ use_tensorboard: false
14
+ infer_img:
15
+ # for data or label process
16
+ character_dict_path: ./tools/utils/EN_symbol_dict.txt
17
+ max_text_length: 25
18
+ use_space_char: False
19
+ save_res_path: ./output/rec/u14m_filter/predicts_resnet45_trans_abinet_lang.txt
20
+ grad_clip_val: 20
21
+ use_amp: True
22
+
23
+ Optimizer:
24
+ name: Adam
25
+ lr: 0.000267
26
+ weight_decay: 0.0
27
+ filter_bias_and_bn: False
28
+
29
+ LRScheduler:
30
+ name: MultiStepLR
31
+ milestones: [12]
32
+ gamma: 0.1
33
+
34
+ Architecture:
35
+ model_type: rec
36
+ algorithm: ABINet
37
+ Transform:
38
+ Encoder:
39
+ name: ResNet45
40
+ in_channels: 3
41
+ strides: [2, 1, 2, 1, 1]
42
+ Decoder:
43
+ name: ABINetDecoder
44
+ iter_size: 3
45
+
46
+ Loss:
47
+ name: ABINetLoss
48
+
49
+ PostProcess:
50
+ name: ABINetLabelDecode
51
+
52
+ Metric:
53
+ name: RecMetric
54
+ main_indicator: acc
55
+ is_filter: True
56
+
57
+ Train:
58
+ dataset:
59
+ name: LMDBDataSet
60
+ data_dir: ../Union14M-L-LMDB-Filtered
61
+ transforms:
62
+ - DecodeImagePIL: # load image
63
+ img_mode: RGB
64
+ - PARSeqAugPIL:
65
+ - ABINetLabelEncode:
66
+ - RecTVResize:
67
+ image_shape: [32, 128]
68
+ padding: False
69
+ - KeepKeys:
70
+ keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
71
+ loader:
72
+ shuffle: True
73
+ batch_size_per_card: 256
74
+ drop_last: True
75
+ num_workers: 4
76
+
77
+ Eval:
78
+ dataset:
79
+ name: LMDBDataSet
80
+ data_dir: ../evaluation
81
+ transforms:
82
+ - DecodeImagePIL: # load image
83
+ img_mode: RGB
84
+ - ABINetLabelEncode:
85
+ - RecTVResize:
86
+ image_shape: [32, 128]
87
+ padding: False
88
+ - KeepKeys:
89
+ keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
90
+ loader:
91
+ shuffle: False
92
+ drop_last: False
93
+ batch_size_per_card: 256
94
+ num_workers: 2