diff --git a/frigate/detectors/plugins/onnx.py b/frigate/detectors/plugins/onnx.py index ccd0ffc68..117cdae02 100644 --- a/frigate/detectors/plugins/onnx.py +++ b/frigate/detectors/plugins/onnx.py @@ -1,4 +1,5 @@ import logging +import os import cv2 import numpy as np @@ -42,6 +43,9 @@ class ONNXDetector(DetectionApi): for provider in providers: if provider == "TensorrtExecutionProvider": + os.makedirs( + "/config/model_cache/tensorrt/ort/trt-engines", exist_ok=True + ) options.append( { "trt_timing_cache_enable": True, @@ -51,7 +55,13 @@ class ONNXDetector(DetectionApi): } ) elif provider == "OpenVINOExecutionProvider": - options.append({"cache_dir": "/config/model_cache/openvino/ort"}) + os.makedirs("/config/model_cache/openvino/ort", exist_ok=True) + options.append( + { + "cache_dir": "/config/model_cache/openvino/ort", + "device_type": "GPU", + } + ) else: options.append({}) diff --git a/frigate/embeddings/functions/clip.py b/frigate/embeddings/functions/clip.py index 6e44033df..8a5a05775 100644 --- a/frigate/embeddings/functions/clip.py +++ b/frigate/embeddings/functions/clip.py @@ -49,22 +49,24 @@ class Clip(OnnxClip): @staticmethod def _load_model(path: str, silent: bool): - providers = ort.get_available_providers() + providers = [] options = [] - for provider in providers: + for provider in ort.get_available_providers(): if provider == "TensorrtExecutionProvider": + continue + elif provider == "OpenVINOExecutionProvider": + # TODO need to verify openvino works correctly + os.makedirs("/config/model_cache/openvino/ort", exist_ok=True) + providers.append(provider) options.append( { - "trt_timing_cache_enable": True, - "trt_timing_cache_path": "/config/model_cache/tensorrt/ort", - "trt_engine_cache_enable": True, - "trt_engine_cache_path": "/config/model_cache/tensorrt/ort/trt-engines", + "cache_dir": "/config/model_cache/openvino/ort", + "device_type": "GPU", } ) - elif provider == "OpenVINOExecutionProvider": - options.append({"cache_dir": "/config/model_cache/openvino/ort"}) else: + providers.append(provider) options.append({}) try: