mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-03 06:50:58 +00:00
Compare commits
3 Commits
abbb23b5b6
...
1cb4dd01f4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cb4dd01f4 | ||
|
|
13b7c0fce0 | ||
|
|
562ad3d373 |
@ -33,7 +33,7 @@ def get_openvino_available_devices() -> list[str]:
|
||||
try:
|
||||
core = ov.Core()
|
||||
available_devices = core.available_devices
|
||||
logger.info(f"OpenVINO available devices: {available_devices}")
|
||||
logger.debug(f"OpenVINO available devices: {available_devices}")
|
||||
return available_devices
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to get OpenVINO available devices: {e}")
|
||||
@ -180,9 +180,14 @@ class OpenVINOModelRunner(BaseModelRunner):
|
||||
|
||||
# Create reusable inference request
|
||||
self.infer_request = self.compiled_model.create_infer_request()
|
||||
input_shape = self.compiled_model.inputs[0].get_shape()
|
||||
input_element_type = self.compiled_model.inputs[0].get_element_type()
|
||||
self.input_tensor = ov.Tensor(input_element_type, input_shape)
|
||||
|
||||
try:
|
||||
input_shape = self.compiled_model.inputs[0].get_shape()
|
||||
input_element_type = self.compiled_model.inputs[0].get_element_type()
|
||||
self.input_tensor = ov.Tensor(input_element_type, input_shape)
|
||||
except RuntimeError:
|
||||
# model is complex and has dynamic shape
|
||||
self.input_tensor = None
|
||||
|
||||
def get_input_names(self) -> list[str]:
|
||||
"""Get input names for the model."""
|
||||
@ -204,7 +209,11 @@ class OpenVINOModelRunner(BaseModelRunner):
|
||||
List of output tensors
|
||||
"""
|
||||
# Handle single input case for backward compatibility
|
||||
if len(inputs) == 1 and len(self.compiled_model.inputs) == 1:
|
||||
if (
|
||||
len(inputs) == 1
|
||||
and len(self.compiled_model.inputs) == 1
|
||||
and self.input_tensor is not None
|
||||
):
|
||||
# Single input case - use the pre-allocated tensor for efficiency
|
||||
input_data = list(inputs.values())[0]
|
||||
np.copyto(self.input_tensor.data, input_data)
|
||||
@ -354,7 +363,7 @@ def get_optimized_runner(
|
||||
if rknn_path:
|
||||
return RKNNModelRunner(rknn_path)
|
||||
|
||||
if is_openvino_gpu_npu_available():
|
||||
if device != "CPU" and is_openvino_gpu_npu_available():
|
||||
return OpenVINOModelRunner(model_path, device, **kwargs)
|
||||
|
||||
providers, options = get_ort_providers(device == "CPU", device, **kwargs)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user