register.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 FormulaRecConfig
  18. from .model import FormulaRecModel
  19. from .runner import FormulaRecRunner
  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": "FormulaRec",
  25. "model": FormulaRecModel,
  26. "runner": FormulaRecRunner,
  27. "config": FormulaRecConfig,
  28. "runner_root_path": REPO_ROOT_PATH,
  29. }
  30. )
  31. register_model_info(
  32. {
  33. "model_name": "LaTeX_OCR_rec",
  34. "suite": "FormulaRec",
  35. "config_path": osp.join(PDX_CONFIG_DIR, "LaTeX_OCR_rec.yaml"),
  36. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  37. }
  38. )
  39. register_model_info(
  40. {
  41. "model_name": "UniMERNet",
  42. "suite": "FormulaRec",
  43. "config_path": osp.join(PDX_CONFIG_DIR, "UniMERNet.yaml"),
  44. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  45. }
  46. )
  47. register_model_info(
  48. {
  49. "model_name": "PP-FormulaNet-S",
  50. "suite": "FormulaRec",
  51. "config_path": osp.join(PDX_CONFIG_DIR, "PP-FormulaNet-S.yaml"),
  52. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  53. }
  54. )
  55. register_model_info(
  56. {
  57. "model_name": "PP-FormulaNet-L",
  58. "suite": "FormulaRec",
  59. "config_path": osp.join(PDX_CONFIG_DIR, "PP-FormulaNet-L.yaml"),
  60. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  61. }
  62. )
  63. register_model_info(
  64. {
  65. "model_name": "PP-FormulaNet_plus-S",
  66. "suite": "FormulaRec",
  67. "config_path": osp.join(PDX_CONFIG_DIR, "PP-FormulaNet_plus-S.yaml"),
  68. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  69. }
  70. )
  71. register_model_info(
  72. {
  73. "model_name": "PP-FormulaNet_plus-M",
  74. "suite": "FormulaRec",
  75. "config_path": osp.join(PDX_CONFIG_DIR, "PP-FormulaNet_plus-M.yaml"),
  76. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  77. }
  78. )
  79. register_model_info(
  80. {
  81. "model_name": "PP-FormulaNet_plus-L",
  82. "suite": "FormulaRec",
  83. "config_path": osp.join(PDX_CONFIG_DIR, "PP-FormulaNet_plus-L.yaml"),
  84. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  85. }
  86. )