mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-11 16:05:26 +03:00
log(masks): include camera name in invalid-coordinates error (#23156)
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
get_relative_coordinates() previously logged "Not applying mask due to invalid coordinates. X,Y is outside ..." without naming the camera, so on a multi-camera setup the user had to guess which one to fix. Add an optional camera_name kwarg with default "" (no behavior change for existing callers). The global object-mask path in FrigateConfig.validate_config passes camera_name=camera_config.name since it already has it in scope, so legacy configs with absolute pixel coordinates now get an actionable log line: Not applying mask due to invalid coordinates for camera back. 9000,9000 is outside of the detection resolution 800x400. Use the editor in the UI to correct the mask. Existing wording is preserved verbatim except for the inserted " for camera <name>" segment. Runtime behavior is unchanged. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
1f154a0205
commit
e9432d55e8
@ -862,7 +862,9 @@ class FrigateConfig(FrigateBaseModel):
|
||||
if mask_config:
|
||||
coords = mask_config.coordinates
|
||||
relative_coords = get_relative_coordinates(
|
||||
coords, camera_config.frame_shape
|
||||
coords,
|
||||
camera_config.frame_shape,
|
||||
camera_name=camera_config.name,
|
||||
)
|
||||
# Create a new ObjectMaskConfig with raw_coordinates set
|
||||
processed_global_masks[mask_id] = ObjectMaskConfig(
|
||||
|
||||
@ -608,11 +608,14 @@ def migrate_018_0(config: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any]
|
||||
|
||||
|
||||
def get_relative_coordinates(
|
||||
mask: Optional[Union[str, list]], frame_shape: tuple[int, int]
|
||||
mask: Optional[Union[str, list]],
|
||||
frame_shape: tuple[int, int],
|
||||
camera_name: str = "",
|
||||
) -> Union[str, list]:
|
||||
# masks and zones are saved as relative coordinates
|
||||
# we know if any points are > 1 then it is using the
|
||||
# old native resolution coordinates
|
||||
where = f" for camera {camera_name}" if camera_name else ""
|
||||
if mask:
|
||||
if isinstance(mask, list) and any(x > "1.0" for x in mask[0].split(",")):
|
||||
relative_masks = []
|
||||
@ -627,7 +630,7 @@ def get_relative_coordinates(
|
||||
|
||||
if x > frame_shape[1] or y > frame_shape[0]:
|
||||
logger.error(
|
||||
f"Not applying mask due to invalid coordinates. {x},{y} is outside of the detection resolution {frame_shape[1]}x{frame_shape[0]}. Use the editor in the UI to correct the mask."
|
||||
f"Not applying mask due to invalid coordinates{where}. {x},{y} is outside of the detection resolution {frame_shape[1]}x{frame_shape[0]}. Use the editor in the UI to correct the mask."
|
||||
)
|
||||
continue
|
||||
|
||||
@ -650,7 +653,7 @@ def get_relative_coordinates(
|
||||
|
||||
if x > frame_shape[1] or y > frame_shape[0]:
|
||||
logger.error(
|
||||
f"Not applying mask due to invalid coordinates. {x},{y} is outside of the detection resolution {frame_shape[1]}x{frame_shape[0]}. Use the editor in the UI to correct the mask."
|
||||
f"Not applying mask due to invalid coordinates{where}. {x},{y} is outside of the detection resolution {frame_shape[1]}x{frame_shape[0]}. Use the editor in the UI to correct the mask."
|
||||
)
|
||||
return []
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user