register.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 TextDetConfig
  18. from .model import TextDetModel
  19. from .runner import TextDetRunner
  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": "TextDet",
  25. "model": TextDetModel,
  26. "runner": TextDetRunner,
  27. "config": TextDetConfig,
  28. "runner_root_path": REPO_ROOT_PATH,
  29. }
  30. )
  31. ################ Models Using Universal Config ################
  32. register_model_info(
  33. {
  34. "model_name": "PP-OCRv4_mobile_det",
  35. "suite": "TextDet",
  36. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv4_mobile_det.yaml"),
  37. "supported_apis": ["train", "evaluate", "predict", "export"],
  38. }
  39. )
  40. register_model_info(
  41. {
  42. "model_name": "PP-OCRv4_server_det",
  43. "suite": "TextDet",
  44. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv4_server_det.yaml"),
  45. "supported_apis": ["train", "evaluate", "predict", "export"],
  46. }
  47. )
  48. register_model_info(
  49. {
  50. "model_name": "PP-OCRv4_server_seal_det",
  51. "suite": "TextDet",
  52. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv4_server_seal_det.yaml"),
  53. "supported_apis": ["train", "evaluate", "predict", "export"],
  54. }
  55. )
  56. register_model_info(
  57. {
  58. "model_name": "PP-OCRv4_mobile_seal_det",
  59. "suite": "TextDet",
  60. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv4_mobile_seal_det.yaml"),
  61. "supported_apis": ["train", "evaluate", "predict", "export"],
  62. }
  63. )
  64. register_model_info(
  65. {
  66. "model_name": "PP-OCRv3_mobile_det",
  67. "suite": "TextDet",
  68. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv3_mobile_det.yaml"),
  69. "supported_apis": ["train", "evaluate", "predict", "export"],
  70. }
  71. )
  72. register_model_info(
  73. {
  74. "model_name": "PP-OCRv3_server_det",
  75. "suite": "TextDet",
  76. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv3_server_det.yaml"),
  77. "supported_apis": ["train", "evaluate", "predict", "export"],
  78. }
  79. )
  80. register_model_info(
  81. {
  82. "model_name": "PP-OCRv5_server_det",
  83. "suite": "TextDet",
  84. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv5_server_det.yaml"),
  85. "supported_apis": ["train", "evaluate", "predict", "export"],
  86. }
  87. )
  88. register_model_info(
  89. {
  90. "model_name": "PP-OCRv5_mobile_det",
  91. "suite": "TextDet",
  92. "config_path": osp.join(PDX_CONFIG_DIR, "PP-OCRv5_mobile_det.yaml"),
  93. "supported_apis": ["train", "evaluate", "predict", "export"],
  94. }
  95. )