mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-03 06:50:58 +00:00
Catch case where input tensor can't be pre-defined
This commit is contained in:
parent
562ad3d373
commit
13b7c0fce0
@ -180,9 +180,14 @@ class OpenVINOModelRunner(BaseModelRunner):
|
|||||||
|
|
||||||
# Create reusable inference request
|
# Create reusable inference request
|
||||||
self.infer_request = self.compiled_model.create_infer_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()
|
try:
|
||||||
self.input_tensor = ov.Tensor(input_element_type, input_shape)
|
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]:
|
def get_input_names(self) -> list[str]:
|
||||||
"""Get input names for the model."""
|
"""Get input names for the model."""
|
||||||
@ -204,7 +209,7 @@ class OpenVINOModelRunner(BaseModelRunner):
|
|||||||
List of output tensors
|
List of output tensors
|
||||||
"""
|
"""
|
||||||
# Handle single input case for backward compatibility
|
# 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
|
# Single input case - use the pre-allocated tensor for efficiency
|
||||||
input_data = list(inputs.values())[0]
|
input_data = list(inputs.values())[0]
|
||||||
np.copyto(self.input_tensor.data, input_data)
|
np.copyto(self.input_tensor.data, input_data)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user