mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-26 16:47:41 +03:00
Check complex model
This commit is contained in:
parent
26178444f3
commit
a153418934
@ -156,7 +156,7 @@ class CudaGraphRunner(BaseModelRunner):
|
|||||||
class OpenVINOModelRunner(BaseModelRunner):
|
class OpenVINOModelRunner(BaseModelRunner):
|
||||||
"""OpenVINO model runner that handles inference efficiently."""
|
"""OpenVINO model runner that handles inference efficiently."""
|
||||||
|
|
||||||
def __init__(self, model_path: str, device: str, **kwargs):
|
def __init__(self, model_path: str, device: str, complex_model: bool, **kwargs):
|
||||||
self.model_path = model_path
|
self.model_path = model_path
|
||||||
self.device = device
|
self.device = device
|
||||||
|
|
||||||
@ -180,14 +180,16 @@ 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()
|
||||||
|
self.input_tensor: ov.Tensor | None = None
|
||||||
|
|
||||||
try:
|
if not complex_model:
|
||||||
input_shape = self.compiled_model.inputs[0].get_shape()
|
try:
|
||||||
input_element_type = self.compiled_model.inputs[0].get_element_type()
|
input_shape = self.compiled_model.inputs[0].get_shape()
|
||||||
self.input_tensor = ov.Tensor(input_element_type, input_shape)
|
input_element_type = self.compiled_model.inputs[0].get_element_type()
|
||||||
except RuntimeError:
|
self.input_tensor = ov.Tensor(input_element_type, input_shape)
|
||||||
# model is complex and has dynamic shape
|
except RuntimeError:
|
||||||
self.input_tensor = None
|
# model is complex and has dynamic shape
|
||||||
|
raise
|
||||||
|
|
||||||
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."""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user