mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-21 22:41:54 +03:00
Reset state for complex models
This commit is contained in:
parent
a153418934
commit
d1f209e7e9
@ -159,6 +159,7 @@ class OpenVINOModelRunner(BaseModelRunner):
|
|||||||
def __init__(self, model_path: str, device: str, complex_model: bool, **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
|
||||||
|
self.complex_model = complex_model
|
||||||
|
|
||||||
if not os.path.isfile(model_path):
|
if not os.path.isfile(model_path):
|
||||||
raise FileNotFoundError(f"OpenVINO model file {model_path} not found.")
|
raise FileNotFoundError(f"OpenVINO model file {model_path} not found.")
|
||||||
@ -236,6 +237,15 @@ class OpenVINOModelRunner(BaseModelRunner):
|
|||||||
np.copyto(self.input_tensor.data, input_data)
|
np.copyto(self.input_tensor.data, input_data)
|
||||||
self.infer_request.infer(self.input_tensor)
|
self.infer_request.infer(self.input_tensor)
|
||||||
else:
|
else:
|
||||||
|
if self.complex_model:
|
||||||
|
try:
|
||||||
|
# This ensures the model starts with a clean state for each sequence
|
||||||
|
# Important for RNN models like PaddleOCR recognition
|
||||||
|
self.infer_request.reset_state()
|
||||||
|
except Exception:
|
||||||
|
# this will raise an exception for models with AUTO set as the device
|
||||||
|
pass
|
||||||
|
|
||||||
# Multiple inputs case - set each input by name
|
# Multiple inputs case - set each input by name
|
||||||
for input_name, input_data in inputs.items():
|
for input_name, input_data in inputs.items():
|
||||||
# Find the input by name
|
# Find the input by name
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user