Skip to content

Commit

Permalink
Set the min region size as the model size
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed Nov 5, 2023
1 parent 65e3e67 commit 60be86e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion frigate/app.py
Expand Up @@ -487,7 +487,9 @@ def init_historical_regions(self) -> None:
# 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:
Expand Down
6 changes: 5 additions & 1 deletion frigate/comms/dispatcher.py
Expand Up @@ -96,7 +96,11 @@ def _receive(self, topic: str, payload: str) -> None:
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)
Expand Down
6 changes: 4 additions & 2 deletions frigate/util/object.py
Expand Up @@ -30,7 +30,9 @@


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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 60be86e

Please sign in to comment.