det.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_detection, draw_pr_curve
  17. from .cv.models.utils.det_metrics.coco_utils import coco_error_analysis
  18. message = 'Your script can be run normally only under PaddleX<2.0.0 ' + \
  19. 'but the installed PaddleX version is greater than or equal to 2.0.0, ' + \
  20. 'the solution is writen in the link {}, please refer to this link ro solve this issue.'.format(
  21. 'https://github.com/PaddlePaddle/PaddleX/tree/develop/tutorials/train#%E7%89%88%E6%9C%AC%E5%8D%87%E7%BA%A7'
  22. )
  23. def __getattr__(attr):
  24. if attr == 'transforms':
  25. print("\033[1;31;40m{}\033[0m".format(message).encode("utf-8")
  26. .decode("latin1"))
  27. sys.exit(-1)
  28. visualize = visualize_detection
  29. draw_pr_curve = draw_pr_curve
  30. coco_error_analysis = coco_error_analysis
  31. # detection
  32. YOLOv3 = cv.models.YOLOv3
  33. FasterRCNN = cv.models.FasterRCNN
  34. PPYOLO = cv.models.PPYOLO
  35. PPYOLOTiny = cv.models.PPYOLOTiny
  36. PPYOLOv2 = cv.models.PPYOLOv2
  37. PicoDet = cv.models.PicoDet
  38. # instance segmentation
  39. MaskRCNN = cv.models.MaskRCNN