yolo_test_handler.py 886 B

123456789101112131415161718192021222324252627282930
  1. # -*- coding: utf-8 -*-
  2. # @Time : 2022/2/28 15:06
  3. # @Author : MaochengHu
  4. # @Email : wojiaohumaocheng@gmail.com
  5. # @File : yolo_test_handler.py
  6. # @Project : server_develop
  7. import sys
  8. import os
  9. print(os.getcwd())
  10. sys.path.append("../../src")
  11. from server_utils.image_convert import path2base64
  12. from object_detector_handler import ObjectDetectionHandler
  13. def main():
  14. test_source = "../test_images/test1.jpg"
  15. base64str = path2base64(test_source)
  16. context = None
  17. output_methods = ["pd_xywh_json", "pd_xywhn", "pd_xyxy", "pd_xyxyn", "tolist", "crop_np", "crop_base64",
  18. "detail_time_info", "render_base64"]
  19. obh = ObjectDetectionHandler()
  20. data = {"data": base64str, "output_methods": str(output_methods).encode(), "base64_bool": str(True).encode()}
  21. result = obh.handle([data], context)
  22. print(result)
  23. if __name__ == "__main__":
  24. main()