From 684904173524be7afc283bef17a47bbbb4833877 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 18 May 2024 20:26:20 +0530 Subject: [PATCH] Tweak --- web/apps/photos/src/services/face/f-index.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/web/apps/photos/src/services/face/f-index.ts b/web/apps/photos/src/services/face/f-index.ts index 62f61aef8..668612ad1 100644 --- a/web/apps/photos/src/services/face/f-index.ts +++ b/web/apps/photos/src/services/face/f-index.ts @@ -151,7 +151,7 @@ const indexFaces_ = async (enteFile: EnteFile, imageBitmap: ImageBitmap) => { const detectFaces = async ( imageBitmap: ImageBitmap, ): Promise => { - const rect = ({ width, height }: { width: number; height: number }) => + const rect = ({ width, height }: Dimensions) => new Box({ x: 0, y: 0, width, height }); const { yoloInput, yoloSize } = @@ -659,18 +659,17 @@ const convertFaceDetectionsToRelative = (mlFile: MlFileData) => { const relativeDetection = ( faceDetection: FaceDetection, - dimensions: Dimensions, + { width, height }: Dimensions, ): FaceDetection => { const oldBox: Box = faceDetection.box; const box = new Box({ - x: oldBox.x / dimensions.width, - y: oldBox.y / dimensions.height, - width: oldBox.width / dimensions.width, - height: oldBox.height / dimensions.height, + x: oldBox.x / width, + y: oldBox.y / height, + width: oldBox.width / width, + height: oldBox.height / height, }); - const oldLandmarks: Point[] = faceDetection.landmarks; - const landmarks = oldLandmarks.map((l) => { - return new Point(l.x / dimensions.width, l.y / dimensions.height); + const landmarks = faceDetection.landmarks.map((l) => { + return new Point(l.x / width, l.y / height); }); const probability = faceDetection.probability; return { box, landmarks, probability };