diff --git a/web/apps/photos/src/services/face/f-index.ts b/web/apps/photos/src/services/face/f-index.ts index 4bf829ff6f..a0faaea34b 100644 --- a/web/apps/photos/src/services/face/f-index.ts +++ b/web/apps/photos/src/services/face/f-index.ts @@ -110,12 +110,12 @@ const indexFacesInBitmap = async ( imageBitmap: ImageBitmap, ): Promise => { const { width, height } = imageBitmap; - const imageBox = { width, height }; + const imageDimensions = { width, height }; const yoloFaceDetections = await detectFaces(imageBitmap); const partialResult = yoloFaceDetections.map( ({ box, landmarks, score }) => { - const faceID = makeFaceID(fileID, box, imageBox); + const faceID = makeFaceID(fileID, box, imageDimensions); const detection = { box, landmarks }; return { faceID, detection, score }; }, @@ -150,7 +150,7 @@ const indexFacesInBitmap = async ( return partialResult.map(({ faceID, detection, score }, i) => ({ faceID, - detection: relativeDetection(detection, imageBox), + detection: normalizeToImageDimensions(detection, imageDimensions), score, blur: blurs[i], embedding: Array.from(embeddings[i]), @@ -742,7 +742,7 @@ const computeEmbeddings = async ( /** * Convert the coordinates to between 0-1, normalized by the image's dimensions. */ -const relativeDetection = ( +const normalizeToImageDimensions = ( faceDetection: FaceDetection, { width, height }: Dimensions, ): FaceDetection => {