Skip to content

NVR with realtime local object detection for IP cameras

Set the min region size as the model size (#8486)

Nicolas Mowen2b2c831253e0
diff --git a/frigate/app.py b/frigate/app.py
index 554d882773..c5357e4008 100644
--- a/frigate/app.py
+++ b/frigate/app.py
@@ -487,7 +487,9 @@ class FrigateApp:
# create or update region grids for each camera
for camera in self.config.cameras.values():
self.region_grids[camera.name] = get_camera_regions_grid(
- camera.name, camera.detect
+ camera.name,
+ camera.detect,
+ max(self.config.model.width, self.config.model.height),
)
def start_camera_processors(self) -> None:
diff --git a/frigate/comms/dispatcher.py b/frigate/comms/dispatcher.py
index bcef9a2fb1..b7bdb86fa2 100644
--- a/frigate/comms/dispatcher.py
+++ b/frigate/comms/dispatcher.py
@@ -96,7 +96,11 @@ class Dispatcher:
elif topic == REQUEST_REGION_GRID:
camera = payload
self.camera_metrics[camera]["region_grid_queue"].put(
- get_camera_regions_grid(camera, self.config.cameras[camera].detect)
+ get_camera_regions_grid(
+ camera,
+ self.config.cameras[camera].detect,
+ max(self.config.model.width, self.config.model.height),
+ )
)
else:
self.publish(topic, payload, retain=False)
diff --git a/frigate/util/object.py b/frigate/util/object.py
index 9605e8ab4c..0bf7ea1799 100644
--- a/frigate/util/object.py
+++ b/frigate/util/object.py
@@ -30,7 +30,9 @@ GRID_SIZE = 8
def get_camera_regions_grid(
- name: str, detect: DetectConfig
+ name: str,
+ detect: DetectConfig,
+ min_region_size: int,
) -> list[list[dict[str, any]]]:
"""Build a grid of expected region sizes for a camera."""
# get grid from db if available
@@ -99,7 +101,7 @@ def get_camera_regions_grid(
box[1] * height,
(box[0] + box[2]) * width,
(box[1] + box[3]) * height,
- 320,
+ min_region_size,
1.35,
)
# save width of region to grid as relative