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

This commit is contained in:
Nicolas Mowen 2023-11-06 05:45:37 -07:00 committed by GitHub
parent 08777100b5
commit 2b2c831253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -487,7 +487,9 @@ class FrigateApp:
# create or update region grids for each camera # create or update region grids for each camera
for camera in self.config.cameras.values(): for camera in self.config.cameras.values():
self.region_grids[camera.name] = get_camera_regions_grid( 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: def start_camera_processors(self) -> None:

View File

@ -96,7 +96,11 @@ class Dispatcher:
elif topic == REQUEST_REGION_GRID: elif topic == REQUEST_REGION_GRID:
camera = payload camera = payload
self.camera_metrics[camera]["region_grid_queue"].put( 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: else:
self.publish(topic, payload, retain=False) self.publish(topic, payload, retain=False)

View File

@ -30,7 +30,9 @@ GRID_SIZE = 8
def get_camera_regions_grid( def get_camera_regions_grid(
name: str, detect: DetectConfig name: str,
detect: DetectConfig,
min_region_size: int,
) -> list[list[dict[str, any]]]: ) -> list[list[dict[str, any]]]:
"""Build a grid of expected region sizes for a camera.""" """Build a grid of expected region sizes for a camera."""
# get grid from db if available # get grid from db if available
@ -99,7 +101,7 @@ def get_camera_regions_grid(
box[1] * height, box[1] * height,
(box[0] + box[2]) * width, (box[0] + box[2]) * width,
(box[1] + box[3]) * height, (box[1] + box[3]) * height,
320, min_region_size,
1.35, 1.35,
) )
# save width of region to grid as relative # save width of region to grid as relative