From c9c5514c0607dcacaf8b84ef4a7730a815451d98 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 22 Aug 2024 15:36:41 -0400
Subject: from last

---
 src/client/views/search/FaceRecognitionHandler.tsx | 52 +++++++++++-----------
 1 file changed, 26 insertions(+), 26 deletions(-)

(limited to 'src/client/views/search/FaceRecognitionHandler.tsx')

diff --git a/src/client/views/search/FaceRecognitionHandler.tsx b/src/client/views/search/FaceRecognitionHandler.tsx
index 9b97fdfbd..f5fc12a8d 100644
--- a/src/client/views/search/FaceRecognitionHandler.tsx
+++ b/src/client/views/search/FaceRecognitionHandler.tsx
@@ -183,6 +183,32 @@ export class FaceRecognitionHandler {
         return uniqueFaceDoc;
     };
 
+    /**
+     * Finds the most similar matching Face Document to a face descriptor
+     * @param faceDescriptor face descriptor number list
+     * @returns face Doc
+     */
+    private findMatchingFaceDoc = (faceDescriptor: Float32Array) => {
+        if (!Doc.ActiveDashboard || FaceRecognitionHandler.UniqueFaces().length < 1) {
+            return undefined;
+        }
+
+        const faceDescriptors = FaceRecognitionHandler.UniqueFaces().map(faceDoc => {
+            const float32Array = FaceRecognitionHandler.UniqueFaceDescriptors(faceDoc).map(fd => new Float32Array(Array.from(fd)));
+            return new faceapi.LabeledFaceDescriptors(FaceRecognitionHandler.UniqueFaceLabel(faceDoc), float32Array);
+        });
+        const faceMatcher = new FaceMatcher(faceDescriptors, 0.6);
+        const match = faceMatcher.findBestMatch(faceDescriptor);
+        if (match.label !== 'unknown') {
+            for (const faceDoc of FaceRecognitionHandler.UniqueFaces()) {
+                if (FaceRecognitionHandler.UniqueFaceLabel(faceDoc) === match.label) {
+                    return faceDoc;
+                }
+            }
+        }
+        return undefined;
+    };
+
     /**
      * When a document is added, this finds faces in the images and tries to
      * match them to existing unique faces, otherwise new unique face(s) are created.
@@ -214,30 +240,4 @@ export class FaceRecognitionHandler {
             } // prettier-ignore
         }
     };
-
-    /**
-     * Finds the most similar matching Face Document to a face descriptor
-     * @param faceDescriptor face descriptor number list
-     * @returns face Doc
-     */
-    private findMatchingFaceDoc = (faceDescriptor: Float32Array) => {
-        if (!Doc.ActiveDashboard || FaceRecognitionHandler.UniqueFaces().length < 1) {
-            return undefined;
-        }
-
-        const faceDescriptors = FaceRecognitionHandler.UniqueFaces().map(faceDoc => {
-            const float32Array = FaceRecognitionHandler.UniqueFaceDescriptors(faceDoc).map(fd => new Float32Array(Array.from(fd)));
-            return new faceapi.LabeledFaceDescriptors(FaceRecognitionHandler.UniqueFaceLabel(faceDoc), float32Array);
-        });
-        const faceMatcher = new FaceMatcher(faceDescriptors, 0.6);
-        const match = faceMatcher.findBestMatch(faceDescriptor);
-        if (match.label !== 'unknown') {
-            for (const faceDoc of FaceRecognitionHandler.UniqueFaces()) {
-                if (FaceRecognitionHandler.UniqueFaceLabel(faceDoc) === match.label) {
-                    return faceDoc;
-                }
-            }
-        }
-        return undefined;
-    };
 }
-- 
cgit v1.2.3-70-g09d2

