register.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 ...base.register import register_model_info, register_suite_info
  17. from .model import TextRecModel
  18. from .runner import TextRecRunner
  19. from .config import TextRecConfig
  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. 'suite_name': 'TextRec',
  24. 'model': TextRecModel,
  25. 'runner': TextRecRunner,
  26. 'config': TextRecConfig,
  27. 'runner_root_path': REPO_ROOT_PATH
  28. })
  29. register_model_info({
  30. 'model_name': 'PP-OCRv4_mobile_rec',
  31. 'suite': 'TextRec',
  32. 'config_path': osp.join(PDX_CONFIG_DIR, 'PP-OCRv4_mobile_rec.yaml'),
  33. 'supported_apis': ['train', 'evaluate', 'predict', 'export']
  34. })
  35. register_model_info({
  36. 'model_name': 'PP-OCRv4_server_rec',
  37. 'suite': 'TextRec',
  38. 'config_path': osp.join(PDX_CONFIG_DIR, 'PP-OCRv4_server_rec.yaml'),
  39. 'supported_apis': ['train', 'evaluate', 'predict', 'export']
  40. })
  41. register_model_info({
  42. 'model_name': 'ch_SVTRv2_rec',
  43. 'suite': 'TextRec',
  44. 'config_path': osp.join(PDX_CONFIG_DIR, 'ch_SVTRv2_rec.yaml'),
  45. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer']
  46. })
  47. register_model_info({
  48. 'model_name': 'ch_RepSVTR_rec',
  49. 'suite': 'TextRec',
  50. 'config_path': osp.join(PDX_CONFIG_DIR, 'ch_RepSVTR_rec.yaml'),
  51. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer']
  52. })
  53. register_model_info({
  54. 'model_name': 'LaTeX_OCR_rec',
  55. 'suite': 'TextRec',
  56. 'config_path': osp.join(PDX_CONFIG_DIR, 'LaTeX_OCR_rec.yml'),
  57. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer']
  58. })