From 289879c8dde53c448fd84e3e30c253fa5fa9a954 Mon Sep 17 00:00:00 2001 From: yayoimizuha Date: Tue, 24 Oct 2023 00:16:37 +0900 Subject: [PATCH] update --- .drone.yml | 1 + test_script/onnx_cacher.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2a26d66..ff0ccec 100644 --- a/.drone.yml +++ b/.drone.yml @@ -16,6 +16,7 @@ steps: PYTHONPATH: /drone/src/ DATA_DIR: /drone/src/data/ commands: + - git diff --name-only `git merge-base refs/remotes/origin/master HEAD`..HEAD | grep finetune/facenet_transfer_learning.py > /dev/null || exit 78 - python -m pip install -q -U pip - pip install -q torchsummary matplotlib pytorch-metric-learning torchinfo torch torchvision tqdm Pillow facenet-pytorch - apt update -qq diff --git a/test_script/onnx_cacher.py b/test_script/onnx_cacher.py index a9cc4ab..5097e56 100644 --- a/test_script/onnx_cacher.py +++ b/test_script/onnx_cacher.py @@ -1,11 +1,14 @@ from os import getcwd from os.path import join -from onnxruntime import InferenceSession, SessionOptions, __version__ +from onnxruntime import InferenceSession, SessionOptions, __version__, get_all_providers, get_available_providers from PIL import Image import numpy +print(get_all_providers()) +print(get_available_providers()) + onnx_session = InferenceSession( - path_or_bytes="test_script/retinaface.onnx", + path_or_bytes=r"retinaface.onnx", providers=[ 'CUDAExecutionProvider', ('TensorrtExecutionProvider', { @@ -13,6 +16,7 @@ onnx_session = InferenceSession( 'trt_engine_cache_path': join(getcwd(), 'onnx_cache'), 'trt_fp16_enable': True, }), + 'DmlExecutionProvider', 'CPUExecutionProvider' ] ) @@ -20,7 +24,7 @@ print(__version__) image_arr = numpy.expand_dims(numpy.array( Image.open(r'C:\Users\tomokazu\CLionProjects\ameba_blog_downloader\manaka_test.jpg').convert('RGB')), 0).transpose( 0, 3, 1, 2).astype(numpy.float32) -image_arr /= 255.0 +# image_arr /= 255.0 print(image_arr) print(image_arr.shape) res = onnx_session.run(input_feed={'input': image_arr}, output_names=["bbox", "confidence", "landmark"])