seg.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright (c) 2021 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 sys
  15. from . import cv
  16. from .cv.models.utils.visualize import visualize_segmentation
  17. message = 'Your script can be run normally only under PaddleX<2.0.0 ' + \
  18. 'but the installed PaddleX version is greater than or equal to 2.0.0, ' + \
  19. 'the solution is writen in the link {}, please refer to this link ro solve this issue.'.format(
  20. 'https://github.com/PaddlePaddle/PaddleX/tree/develop/tutorials/train#%E7%89%88%E6%9C%AC%E5%8D%87%E7%BA%A7'
  21. )
  22. def __getattr__(attr):
  23. if attr == 'transforms':
  24. print("\033[1;31;40m{}\033[0m".format(message).encode("utf-8")
  25. .decode("latin1"))
  26. sys.exit(-1)
  27. visualize = visualize_segmentation
  28. UNet = cv.models.UNet
  29. DeepLabV3P = cv.models.DeepLabV3P
  30. FastSCNN = cv.models.FastSCNN
  31. HRNet = cv.models.HRNet
  32. BiSeNetV2 = cv.models.BiSeNetV2