From 2a2cf0491865737c5f7e82805eb3ab59b9cdecfb Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Tue, 14 May 2024 12:48:59 +0530 Subject: [PATCH] Prune --- .../utils/machineLearning/mldataMappers.ts | 88 ------------------- 1 file changed, 88 deletions(-) diff --git a/web/apps/photos/src/utils/machineLearning/mldataMappers.ts b/web/apps/photos/src/utils/machineLearning/mldataMappers.ts index 1116448214..520fa94d53 100644 --- a/web/apps/photos/src/utils/machineLearning/mldataMappers.ts +++ b/web/apps/photos/src/utils/machineLearning/mldataMappers.ts @@ -30,14 +30,6 @@ class ServerFileMl { this.faceEmbedding = faceEmbedding; this.clipEmbedding = clipEmbedding; } - - toJson(): string { - return JSON.stringify(this); - } - - static fromJson(json: string): ServerFileMl { - return JSON.parse(json); - } } class ServerFaceEmbeddings { @@ -57,14 +49,6 @@ class ServerFaceEmbeddings { this.client = client; this.error = error; } - - toJson(): string { - return JSON.stringify(this); - } - - static fromJson(json: string): ServerFaceEmbeddings { - return JSON.parse(json); - } } class ServerFace { @@ -93,14 +77,6 @@ class ServerFace { this.blur = blur; this.fileInfo = fileInfo; } - - toJson(): string { - return JSON.stringify(this); - } - - static fromJson(json: string): ServerFace { - return JSON.parse(json); - } } class ServerFileInfo { @@ -121,14 +97,6 @@ class ServerDetection { this.box = box; this.landmarks = landmarks; } - - toJson(): string { - return JSON.stringify(this); - } - - static fromJson(json: string): ServerDetection { - return JSON.parse(json); - } } class ServerFaceBox { @@ -148,14 +116,6 @@ class ServerFaceBox { this.width = width; this.height = height; } - - toJson(): string { - return JSON.stringify(this); - } - - static fromJson(json: string): ServerFaceBox { - return JSON.parse(json); - } } export function LocalFileMlDataToServerFileMl( @@ -215,51 +175,3 @@ export function LocalFileMlDataToServerFileMl( imageDimensions.width, ); } - -// // Not sure if this actually works -// export function ServerFileMlToLocalFileMlData( -// serverFileMl: ServerFileMl, -// ): MlFileData { -// const faces: Face[] = []; -// const mlVersion: number = serverFileMl.faceEmbeddings.version; -// const errorCount = serverFileMl.faceEmbeddings.error ? 1 : 0; -// for (let i = 0; i < serverFileMl.faceEmbeddings.faces.length; i++) { -// const face = serverFileMl.faceEmbeddings.faces[i]; -// if(face.detection.landmarks.length === 0) { -// continue; -// } -// const detection = face.detection; -// const box = detection.box; -// const landmarks = detection.landmarks; -// const newBox = new FaceBox( -// box.xMin, -// box.yMin, -// box.width, -// box.height, -// ); -// const newLandmarks: Landmark[] = []; -// for (let j = 0; j < landmarks.length; j++) { -// newLandmarks.push( -// { -// x: landmarks[j].x, -// y: landmarks[j].y, -// } as Landmark -// ); -// } -// const newDetection = new Detection(newBox, newLandmarks); -// const newFace = { - -// } as Face -// faces.push(newFace); -// } -// return { -// fileId: serverFileMl.fileID, -// imageDimensions: { -// width: serverFileMl.width, -// height: serverFileMl.height, -// }, -// faces, -// mlVersion, -// errorCount, -// }; -// }