From 88f9186be0362fa77258c6c2f2610cd7dc5aaa77 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 18 May 2024 10:25:35 +0530 Subject: [PATCH] Split --- web/apps/photos/src/services/face/f-index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/apps/photos/src/services/face/f-index.ts b/web/apps/photos/src/services/face/f-index.ts index 1ca7daf9e3..6d0fc6fb2d 100644 --- a/web/apps/photos/src/services/face/f-index.ts +++ b/web/apps/photos/src/services/face/f-index.ts @@ -155,8 +155,6 @@ const syncFileFaceDetections = async (fileContext: MLSyncFileContext) => { const detectFaces = async ( imageBitmap: ImageBitmap, ): Promise> => { - const maxFaceDistancePercent = Math.sqrt(2) / 100; - const maxFaceDistance = imageBitmap.width * maxFaceDistancePercent; const { yoloInput, yoloSize } = convertToYOLOInputFloat32ChannelsFirst(imageBitmap); const yoloOutput = await workerBridge.detectFaces(yoloInput); @@ -164,6 +162,9 @@ const detectFaces = async ( const inBox = newBox(0, 0, yoloSize.width, yoloSize.height); const toBox = newBox(0, 0, imageBitmap.width, imageBitmap.height); const faceDetections = transformFaceDetections(faces, inBox, toBox); + + const maxFaceDistancePercent = Math.sqrt(2) / 100; + const maxFaceDistance = imageBitmap.width * maxFaceDistancePercent; return removeDuplicateDetections(faceDetections, maxFaceDistance); };