From 9ffa7f140cb188ad75f750ffabe41bb0a24a20b8 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 7 Jul 2025 07:35:55 -0500 Subject: [PATCH] Fixes (#18935) * Sort names alphabetically in face library dropdown * fix potential divide by zero in misconfigured speed zones --- frigate/util/velocity.py | 5 +++++ web/src/pages/FaceLibrary.tsx | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frigate/util/velocity.py b/frigate/util/velocity.py index 207215bfb..61f1a0d94 100644 --- a/frigate/util/velocity.py +++ b/frigate/util/velocity.py @@ -59,6 +59,11 @@ def create_ground_plane(zone_points, distances): :param y: Y-coordinate in the image :return: Real-world distance per pixel at the given (x, y) coordinate """ + + # Return 0 if divide by zero would occur + if (B[0] - A[0]) == 0 or (D[1] - A[1]) == 0: + return 0 + # Normalize x and y within the zone x_norm = (x - A[0]) / (B[0] - A[0]) y_norm = (y - A[1]) / (D[1] - A[1]) diff --git a/web/src/pages/FaceLibrary.tsx b/web/src/pages/FaceLibrary.tsx index cf3929de9..54040e2ad 100644 --- a/web/src/pages/FaceLibrary.tsx +++ b/web/src/pages/FaceLibrary.tsx @@ -87,7 +87,11 @@ export default function FaceLibrary() { const faces = useMemo( () => - faceData ? Object.keys(faceData).filter((face) => face != "train") : [], + faceData + ? Object.keys(faceData) + .filter((face) => face != "train") + .sort() + : [], [faceData], ); const faceImages = useMemo(