register.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
  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 pathlib import Path
  17. from ...base.register import register_model_info, register_suite_info
  18. from .model import FormulaRecModel
  19. from .runner import FormulaRecRunner
  20. from .config import FormulaRecConfig
  21. REPO_ROOT_PATH = os.environ.get("PADDLE_PDX_PADDLEOCR_PATH")
  22. PDX_CONFIG_DIR = osp.abspath(osp.join(osp.dirname(__file__), "..", "configs"))
  23. register_suite_info(
  24. {
  25. "suite_name": "FormulaRec",
  26. "model": FormulaRecModel,
  27. "runner": FormulaRecRunner,
  28. "config": FormulaRecConfig,
  29. "runner_root_path": REPO_ROOT_PATH,
  30. }
  31. )
  32. register_model_info(
  33. {
  34. "model_name": "LaTeX_OCR_rec",
  35. "suite": "FormulaRec",
  36. "config_path": osp.join(PDX_CONFIG_DIR, "LaTeX_OCR_rec.yml"),
  37. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  38. }
  39. )
  40. register_model_info(
  41. {
  42. "model_name": "UniMERNet",
  43. "suite": "FormulaRec",
  44. "config_path": osp.join(PDX_CONFIG_DIR, "UniMERNet.yaml"),
  45. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  46. }
  47. )
  48. register_model_info(
  49. {
  50. "model_name": "PP-FormulaNet-S",
  51. "suite": "FormulaRec",
  52. "config_path": osp.join(PDX_CONFIG_DIR, "PP-FormulaNet-S.yaml"),
  53. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  54. }
  55. )
  56. register_model_info(
  57. {
  58. "model_name": "PP-FormulaNet-L",
  59. "suite": "FormulaRec",
  60. "config_path": osp.join(PDX_CONFIG_DIR, "PP-FormulaNet-L.yaml"),
  61. "supported_apis": ["train", "evaluate", "predict", "export", "infer"],
  62. }
  63. )