mediapipe测试

onnx测试

   img_path=r'D:\data\val_result\1212\test\1\2\02370_1.jpg'

    img=cv2.imread(img_path)

    img_o = cv2.resize(img, (192, 192))
    img=cv2.cvtColor(img_o,cv2.COLOR_BGR2RGB)
    img = img.astype(np.float32)
    # img=img-127.5
    img/=255.0

    # dummy_input = np.ones([1, 192, 192, 3], dtype=np.float32)
    dummy_input = np.array([img])
    model_path = r'E:\project\angle_net\xuanzhuan_detect\ncnn-20220420-windows-vs2017\x64\bin/model_float32.onnx'
    # model_path = r'C:\Users\Administrator\Pictures\mm\resources.tar\resources\face_landmark_with_attention_192x192/model_float32.onnx'
    model_file_name = model_path.split(".")[0]
    session_option = onnxruntime.SessionOptions()
    session_option.optimized_model_filepath = f"{model_file_name}_cudaopt.onnx"
    session_option.graph_optimization_level = onnxruntime.Graph

你可能感兴趣的:(深度学习宝典,opencv,python,计算机视觉)