Skip to content

NVR with realtime local object detection for IP cameras

Reset saved search stats on reindex (#14280)

Josh Hawkins2897afce4110
diff --git a/frigate/embeddings/embeddings.py b/frigate/embeddings/embeddings.py
index 5fe0566f24..85c65b33e7 100644
--- a/frigate/embeddings/embeddings.py
+++ b/frigate/embeddings/embeddings.py
@@ -3,6 +3,7 @@
import base64
import io
import logging
+import os
import time
from PIL import Image
@@ -10,7 +11,11 @@ from playhouse.shortcuts import model_to_dict
from frigate.comms.inter_process import InterProcessRequestor
from frigate.config.semantic_search import SemanticSearchConfig
-from frigate.const import UPDATE_EMBEDDINGS_REINDEX_PROGRESS, UPDATE_MODEL_STATE
+from frigate.const import (
+ CONFIG_DIR,
+ UPDATE_EMBEDDINGS_REINDEX_PROGRESS,
+ UPDATE_MODEL_STATE,
+)
from frigate.db.sqlitevecq import SqliteVecQueueDatabase
from frigate.models import Event
from frigate.types import ModelStatusTypesEnum
@@ -160,6 +165,10 @@ class Embeddings:
self.db.create_embeddings_tables()
logger.debug("Created embeddings tables.")
+ # Delete the saved stats file
+ if os.path.exists(os.path.join(CONFIG_DIR, ".search_stats.json")):
+ os.remove(os.path.join(CONFIG_DIR, ".search_stats.json"))
+
st = time.time()
totals = {
"thumbnails": 0,