__init__.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Copyright (c) 2020 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. __all__ = ["build_neck"]
  15. def build_neck(config):
  16. from .db_fpn import DBFPN, RSEFPN, LKPAN
  17. from .east_fpn import EASTFPN
  18. from .sast_fpn import SASTFPN
  19. from .rnn import SequenceEncoder
  20. from .pg_fpn import PGFPN
  21. from .table_fpn import TableFPN
  22. from .fpn import FPN
  23. from .fce_fpn import FCEFPN
  24. from .pren_fpn import PRENFPN
  25. from .csp_pan import CSPPAN
  26. from .ct_fpn import CTFPN
  27. from .fpn_unet import FPN_UNet
  28. from .rf_adaptor import RFAdaptor
  29. support_dict = [
  30. "FPN",
  31. "FCEFPN",
  32. "LKPAN",
  33. "DBFPN",
  34. "RSEFPN",
  35. "EASTFPN",
  36. "SASTFPN",
  37. "SequenceEncoder",
  38. "PGFPN",
  39. "TableFPN",
  40. "PRENFPN",
  41. "CSPPAN",
  42. "CTFPN",
  43. "RFAdaptor",
  44. "FPN_UNet",
  45. ]
  46. module_name = config.pop("name")
  47. assert module_name in support_dict, Exception(
  48. "neck only support {}".format(support_dict)
  49. )
  50. module_class = eval(module_name)(**config)
  51. return module_class