mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
frigate: migrate to ai-edge-litert interpreter
The combination of tensorflow-bin and onnxruntime in the same Python interpreter is super fragile. This problem does not seem to exist with tflite-runtime (used upstream) or ai-edge-litert (the successor to tflite). Fixes: #476181
This commit is contained in:
parent
1235bf64d5
commit
6259a4d1da
3 changed files with 67 additions and 2 deletions
64
pkgs/by-name/fr/frigate/ai-edge-litert.patch
Normal file
64
pkgs/by-name/fr/frigate/ai-edge-litert.patch
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
diff --git a/frigate/data_processing/real_time/bird.py b/frigate/data_processing/real_time/bird.py
|
||||||
|
index d547f2dd..402876b7 100644
|
||||||
|
--- a/frigate/data_processing/real_time/bird.py
|
||||||
|
+++ b/frigate/data_processing/real_time/bird.py
|
||||||
|
@@ -21,7 +21,7 @@ from .api import RealTimeProcessorApi
|
||||||
|
try:
|
||||||
|
from tflite_runtime.interpreter import Interpreter
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
- from tensorflow.lite.python.interpreter import Interpreter
|
||||||
|
+ from ai_edge_litert.interpreter import Interpreter
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
diff --git a/frigate/detectors/plugins/cpu_tfl.py b/frigate/detectors/plugins/cpu_tfl.py
|
||||||
|
index 8a54363e..68ae558b 100644
|
||||||
|
--- a/frigate/detectors/plugins/cpu_tfl.py
|
||||||
|
+++ b/frigate/detectors/plugins/cpu_tfl.py
|
||||||
|
@@ -10,7 +10,7 @@ from frigate.detectors.detector_config import BaseDetectorConfig
|
||||||
|
try:
|
||||||
|
from tflite_runtime.interpreter import Interpreter
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
- from tensorflow.lite.python.interpreter import Interpreter
|
||||||
|
+ from ai_edge_litert.interpreter import Interpreter
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
diff --git a/frigate/detectors/plugins/edgetpu_tfl.py b/frigate/detectors/plugins/edgetpu_tfl.py
|
||||||
|
index 246d2dd4..e855bf87 100644
|
||||||
|
--- a/frigate/detectors/plugins/edgetpu_tfl.py
|
||||||
|
+++ b/frigate/detectors/plugins/edgetpu_tfl.py
|
||||||
|
@@ -11,7 +11,7 @@ from frigate.detectors.detector_config import BaseDetectorConfig
|
||||||
|
try:
|
||||||
|
from tflite_runtime.interpreter import Interpreter, load_delegate
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
- from tensorflow.lite.python.interpreter import Interpreter, load_delegate
|
||||||
|
+ from ai_edge_litert.interpreter import Interpreter, load_delegate
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
diff --git a/frigate/embeddings/onnx/face_embedding.py b/frigate/embeddings/onnx/face_embedding.py
|
||||||
|
index eb04b43b..0c6c26fc 100644
|
||||||
|
--- a/frigate/embeddings/onnx/face_embedding.py
|
||||||
|
+++ b/frigate/embeddings/onnx/face_embedding.py
|
||||||
|
@@ -14,7 +14,7 @@ from .runner import ONNXModelRunner
|
||||||
|
try:
|
||||||
|
from tflite_runtime.interpreter import Interpreter
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
- from tensorflow.lite.python.interpreter import Interpreter
|
||||||
|
+ from ai_edge_litert.interpreter import Interpreter
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
diff --git a/frigate/events/audio.py b/frigate/events/audio.py
|
||||||
|
index f2a217fd..82206b5a 100644
|
||||||
|
--- a/frigate/events/audio.py
|
||||||
|
+++ b/frigate/events/audio.py
|
||||||
|
@@ -36,7 +36,7 @@ from frigate.video import start_or_restart_ffmpeg, stop_ffmpeg
|
||||||
|
try:
|
||||||
|
from tflite_runtime.interpreter import Interpreter
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
- from tensorflow.lite.python.interpreter import Interpreter
|
||||||
|
+ from ai_edge_litert.interpreter import Interpreter
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -89,6 +89,7 @@ python3Packages.buildPythonApplication rec {
|
||||||
hash = "sha256-1+n0n0yCtjfAHkXzsZdIF0iCVdPGmsG7l8/VTqBVEjU=";
|
hash = "sha256-1+n0n0yCtjfAHkXzsZdIF0iCVdPGmsG7l8/VTqBVEjU=";
|
||||||
})
|
})
|
||||||
./ffmpeg.patch
|
./ffmpeg.patch
|
||||||
|
./ai-edge-litert.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
|
@ -132,6 +133,7 @@ python3Packages.buildPythonApplication rec {
|
||||||
# docker/main/requirements.txt
|
# docker/main/requirements.txt
|
||||||
scikit-build
|
scikit-build
|
||||||
# docker/main/requirements-wheel.txt
|
# docker/main/requirements-wheel.txt
|
||||||
|
ai-edge-litert
|
||||||
aiofiles
|
aiofiles
|
||||||
aiohttp
|
aiohttp
|
||||||
appdirs
|
appdirs
|
||||||
|
|
@ -180,7 +182,6 @@ python3Packages.buildPythonApplication rec {
|
||||||
slowapi
|
slowapi
|
||||||
starlette
|
starlette
|
||||||
starlette-context
|
starlette-context
|
||||||
tensorflow-bin
|
|
||||||
titlecase
|
titlecase
|
||||||
transformers
|
transformers
|
||||||
tzlocal
|
tzlocal
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
# optional-dependencies
|
# optional-dependencies
|
||||||
lark,
|
lark,
|
||||||
ml-dtypes
|
ml-dtypes,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue