register.py 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. # Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import os
  15. import os.path as osp
  16. from ...base.register import register_model_info, register_suite_info
  17. from .config import TextRecConfig
  18. from .model import TextRecModel
  19. from .runner import TextRecRunner
  20. REPO_ROOT_PATH = os.environ.get("PADDLE_PDX_PADDLEOCR_PATH")
  21. PDX_CONFIG_DIR = osp.abspath(osp.join(osp.dirname(__file__), "..", "configs"))
  22. register_suite_info(
  23. {
  24. "suite_name": "TextRec",
  25. "model": TextRecModel,
  26. "runner": TextRecRunner,
  27. "config": TextRecConfig,
  28. "runner_root_path": REPO_ROOT_PATH,
  29. }
  30. )
  31. register_model_info(
  32. {
  33. "model_name": "PP-OCRv3_mobile_rec",
  34. "suite": "TextRec",
  35. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv3_mobile_rec.yaml"),
  36. "supported_apis": ["train", "evaluate", "predict", "export"],
  37. }
  38. )
  39. register_model_info(
  40. {
  41. "model_name": "en_PP-OCRv3_mobile_rec",
  42. "suite": "TextRec",
  43. "config_path": osp.join(PDX_CONFIG_DIR, "en_PP-OCRv3_mobile_rec.yaml"),
  44. "supported_apis": ["train", "evaluate", "predict", "export"],
  45. }
  46. )
  47. register_model_info(
  48. {
  49. "model_name": "korean_PP-OCRv3_mobile_rec",
  50. "suite": "TextRec",
  51. "config_path": osp.join(PDX_CONFIG_DIR, "korean_PP-OCRv3_mobile_rec.yaml"),
  52. "supported_apis": ["train", "evaluate", "predict", "export"],
  53. }
  54. )
  55. register_model_info(
  56. {
  57. "model_name": "japan_PP-OCRv3_mobile_rec",
  58. "suite": "TextRec",
  59. "config_path": osp.join(PDX_CONFIG_DIR, "japan_PP-OCRv3_mobile_rec.yaml"),
  60. "supported_apis": ["train", "evaluate", "predict", "export"],
  61. }
  62. )
  63. register_model_info(
  64. {
  65. "model_name": "chinese_cht_PP-OCRv3_mobile_rec",
  66. "suite": "TextRec",
  67. "config_path": osp.join(PDX_CONFIG_DIR, "chinese_cht_PP-OCRv3_mobile_rec.yaml"),
  68. "supported_apis": ["train", "evaluate", "predict", "export"],
  69. }
  70. )
  71. register_model_info(
  72. {
  73. "model_name": "te_PP-OCRv3_mobile_rec",
  74. "suite": "TextRec",
  75. "config_path": osp.join(PDX_CONFIG_DIR, "te_PP-OCRv3_mobile_rec.yaml"),
  76. "supported_apis": ["train", "evaluate", "predict", "export"],
  77. }
  78. )
  79. register_model_info(
  80. {
  81. "model_name": "ka_PP-OCRv3_mobile_rec",
  82. "suite": "TextRec",
  83. "config_path": osp.join(PDX_CONFIG_DIR, "ka_PP-OCRv3_mobile_rec.yaml"),
  84. "supported_apis": ["train", "evaluate", "predict", "export"],
  85. }
  86. )
  87. register_model_info(
  88. {
  89. "model_name": "ta_PP-OCRv3_mobile_rec",
  90. "suite": "TextRec",
  91. "config_path": osp.join(PDX_CONFIG_DIR, "ta_PP-OCRv3_mobile_rec.yaml"),
  92. "supported_apis": ["train", "evaluate", "predict", "export"],
  93. }
  94. )
  95. register_model_info(
  96. {
  97. "model_name": "latin_PP-OCRv3_mobile_rec",
  98. "suite": "TextRec",
  99. "config_path": osp.join(PDX_CONFIG_DIR, "latin_PP-OCRv3_mobile_rec.yaml"),
  100. "supported_apis": ["train", "evaluate", "predict", "export"],
  101. }
  102. )
  103. register_model_info(
  104. {
  105. "model_name": "arabic_PP-OCRv3_mobile_rec",
  106. "suite": "TextRec",
  107. "config_path": osp.join(PDX_CONFIG_DIR, "arabic_PP-OCRv3_mobile_rec.yaml"),
  108. "supported_apis": ["train", "evaluate", "predict", "export"],
  109. }
  110. )
  111. register_model_info(
  112. {
  113. "model_name": "cyrillic_PP-OCRv3_mobile_rec",
  114. "suite": "TextRec",
  115. "config_path": osp.join(PDX_CONFIG_DIR, "cyrillic_PP-OCRv3_mobile_rec.yaml"),
  116. "supported_apis": ["train", "evaluate", "predict", "export"],
  117. }
  118. )
  119. register_model_info(
  120. {
  121. "model_name": "devanagari_PP-OCRv3_mobile_rec",
  122. "suite": "TextRec",
  123. "config_path": osp.join(PDX_CONFIG_DIR, "devanagari_PP-OCRv3_mobile_rec.yaml"),
  124. "supported_apis": ["train", "evaluate", "predict", "export"],
  125. }
  126. )
  127. register_model_info(
  128. {
  129. "model_name": "PP-OCRv4_mobile_rec",
  130. "suite": "TextRec",
  131. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv4_mobile_rec.yaml"),
  132. "supported_apis": ["train", "evaluate", "predict", "export"],
  133. }
  134. )
  135. register_model_info(
  136. {
  137. "model_name": "PP-OCRv4_server_rec",
  138. "suite": "TextRec",
  139. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv4_server_rec.yaml"),
  140. "supported_apis": ["train", "evaluate", "predict", "export"],
  141. }
  142. )
  143. register_model_info(
  144. {
  145. "model_name": "en_PP-OCRv4_mobile_rec",
  146. "suite": "TextRec",
  147. "config_path": osp.join(PDX_CONFIG_DIR, "en_PP-OCRv4_mobile_rec.yaml"),
  148. "supported_apis": ["train", "evaluate", "predict", "export"],
  149. }
  150. )
  151. register_model_info(
  152. {
  153. "model_name": "PP-OCRv4_server_rec_doc",
  154. "suite": "TextRec",
  155. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv4_server_rec_doc.yaml"),
  156. "supported_apis": ["train", "evaluate", "predict", "export"],
  157. }
  158. )
  159. register_model_info(
  160. {
  161. "model_name": "ch_SVTRv2_rec",
  162. "suite": "TextRec",
  163. "config_path": osp.join(PDX_CONFIG_DIR, "ch_SVTRv2_rec.yaml"),
  164. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  165. }
  166. )
  167. register_model_info(
  168. {
  169. "model_name": "ch_RepSVTR_rec",
  170. "suite": "TextRec",
  171. "config_path": osp.join(PDX_CONFIG_DIR, "ch_RepSVTR_rec.yaml"),
  172. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  173. }
  174. )
  175. register_model_info(
  176. {
  177. "model_name": "PP-OCRv5_server_rec",
  178. "suite": "TextRec",
  179. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv5_server_rec.yaml"),
  180. "supported_apis": ["train", "evaluate", "predict", "export"],
  181. }
  182. )