register.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 TableRecModel
  19. from .runner import TableRecRunner
  20. from .config import TableRecConfig
  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": "TableRec",
  26. "model": TableRecModel,
  27. "runner": TableRecRunner,
  28. "config": TableRecConfig,
  29. "runner_root_path": REPO_ROOT_PATH,
  30. }
  31. )
  32. register_model_info(
  33. {
  34. "model_name": "SLANet",
  35. "suite": "TableRec",
  36. "config_path": osp.join(PDX_CONFIG_DIR, "SLANet.yaml"),
  37. "supported_apis": ["train", "evaluate", "predict", "export"],
  38. }
  39. )
  40. register_model_info(
  41. {
  42. "model_name": "SLANet_plus",
  43. "suite": "TableRec",
  44. "config_path": osp.join(PDX_CONFIG_DIR, "SLANet_plus.yaml"),
  45. "supported_apis": ["train", "evaluate", "predict", "export"],
  46. }
  47. )
  48. register_model_info(
  49. {
  50. "model_name": "SLANeXt_wired",
  51. "suite": "TableRec",
  52. "config_path": osp.join(PDX_CONFIG_DIR, "SLANeXt_wired.yaml"),
  53. "supported_apis": ["train", "evaluate", "predict", "export"],
  54. }
  55. )
  56. register_model_info(
  57. {
  58. "model_name": "SLANeXt_wireless",
  59. "suite": "TableRec",
  60. "config_path": osp.join(PDX_CONFIG_DIR, "SLANeXt_wireless.yaml"),
  61. "supported_apis": ["train", "evaluate", "predict", "export"],
  62. }
  63. )