π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Prune
Manav Rathice566f522dd6
diff --git a/web/apps/photos/src/constants/mlConfig.ts b/web/apps/photos/src/constants/mlConfig.tsindex ac40cd5fb3..ff3eed264a 100644--- a/web/apps/photos/src/constants/mlConfig.ts+++ b/web/apps/photos/src/constants/mlConfig.ts@@ -46,22 +46,6 @@ export const DEFAULT_ML_SYNC_CONFIG: MLSyncConfig = {// maxDistanceInsideCluster: 0.4,generateDebugInfo: true,},- objectDetection: {- method: "SSDMobileNetV2",- maxNumBoxes: 20,- minScore: 0.2,- },- sceneDetection: {- method: "ImageScene",- minScore: 0.1,- },- // tsne: {- // samples: 200,- // dim: 2,- // perplexity: 10.0,- // learningRate: 10.0,- // metric: 'euclidean',- // },mlVersion: 3,};@@ -80,12 +64,4 @@ export const TEXT_DETECTION_TIMEOUT_MS = [10000, 30000, 60000, 120000, 240000];export const MOBILEFACENET_FACE_SIZE = 112;export const MOBILEFACENET_EMBEDDING_SIZE = 192;-// scene detection model takes fixed-shaped (224x224) inputs-// https://tfhub.dev/sayannath/lite-model/image-scene/1-export const SCENE_DETECTION_IMAGE_SIZE = 224;--// SSD with Mobilenet v2 initialized from Imagenet classification checkpoint. Trained on COCO 2017 dataset (images scaled to 320x320 resolution).-// https://tfhub.dev/tensorflow/ssd_mobilenet_v2/2-export const OBJECT_DETECTION_IMAGE_SIZE = 320;-export const BATCHES_BEFORE_SYNCING_INDEX = 5;diff --git a/web/apps/photos/src/services/machineLearning/machineLearningFactory.ts b/web/apps/photos/src/services/machineLearning/machineLearningFactory.tsindex 920649bb4f..36e37d9b83 100644--- a/web/apps/photos/src/services/machineLearning/machineLearningFactory.ts+++ b/web/apps/photos/src/services/machineLearning/machineLearningFactory.ts@@ -127,7 +127,6 @@ export class LocalMLSyncContext implements MLSyncContext {public nSyncedFiles: number;public nSyncedFaces: number;public allSyncedFacesMap?: Map<number, Array<Face>>;- public tsne?: any;public error?: Error;diff --git a/web/apps/photos/src/services/machineLearning/machineLearningService.ts b/web/apps/photos/src/services/machineLearning/machineLearningService.tsindex 7fbd563f39..03a3b7e2c7 100644--- a/web/apps/photos/src/services/machineLearning/machineLearningService.ts+++ b/web/apps/photos/src/services/machineLearning/machineLearningService.ts@@ -61,7 +61,6 @@ class MachineLearningService {.length,nFaceNoise:syncContext.mlLibraryData?.faceClusteringResults?.noise.length,- tsne: syncContext.tsne,error: syncContext.error,};// log.info('[MLService] sync results: ', mlSyncResult);diff --git a/web/apps/photos/src/services/machineLearning/readerService.ts b/web/apps/photos/src/services/machineLearning/readerService.tsindex e3c8e95c4c..a18b3c9082 100644--- a/web/apps/photos/src/services/machineLearning/readerService.ts+++ b/web/apps/photos/src/services/machineLearning/readerService.ts@@ -16,7 +16,6 @@ class ReaderService {if (fileContext.imageBitmap) {return fileContext.imageBitmap;}- // log.info('1 TF Memory stats: ',JSON.stringify(tf.memory()));if (fileContext.localFile) {if (fileContext.enteFile.metadata.fileType !== FILE_TYPE.IMAGE@@ -47,7 +46,6 @@ class ReaderService {fileContext.newMlFile.imageSource = syncContext.config.imageSource;const { width, height } = fileContext.imageBitmap;fileContext.newMlFile.imageDimensions = { width, height };- // log.info('2 TF Memory stats: ',JSON.stringify(tf.memory()));return fileContext.imageBitmap;} catch (e) {diff --git a/web/apps/photos/src/services/machineLearning/yoloFaceDetectionService.ts b/web/apps/photos/src/services/machineLearning/yoloFaceDetectionService.tsindex 0b95802132..6ed3e12056 100644--- a/web/apps/photos/src/services/machineLearning/yoloFaceDetectionService.ts+++ b/web/apps/photos/src/services/machineLearning/yoloFaceDetectionService.ts@@ -1,7 +1,4 @@-import {- BLAZEFACE_FACE_SIZE,- MAX_FACE_DISTANCE_PERCENT,-} from "constants/mlConfig";+import { MAX_FACE_DISTANCE_PERCENT } from "constants/mlConfig";import { Dimensions } from "types/image";import {FaceDetection,@@ -35,14 +32,12 @@ class YoloFaceDetectionService implements FaceDetectionService {// private onnxInferenceSession?: ort.InferenceSession;private onnxInferenceSession?: any;public method: Versioned<FaceDetectionMethod>;- private desiredFaceSize;- public constructor(desiredFaceSize: number = BLAZEFACE_FACE_SIZE) {+ public constructor() {this.method = {value: "YoloFace",version: 1,};- this.desiredFaceSize = desiredFaceSize;}private async initOnnx() {diff --git a/web/apps/photos/src/types/machineLearning/archface.ts b/web/apps/photos/src/types/machineLearning/archface.tsdeleted file mode 100644index e69de29bb2..0000000000diff --git a/web/apps/photos/src/types/machineLearning/index.ts b/web/apps/photos/src/types/machineLearning/index.tsindex 6cdd23c98d..e09569ecb8 100644--- a/web/apps/photos/src/types/machineLearning/index.ts+++ b/web/apps/photos/src/types/machineLearning/index.ts@@ -1,5 +1,3 @@-import * as tf from "@tensorflow/tfjs-core";-import { DebugInfo } from "hdbscan";import PQueue from "p-queue";import { EnteFile } from "types/file";@@ -12,7 +10,6 @@ export interface MLSyncResult {nSyncedFaces: number;nFaceClusters: number;nFaceNoise: number;- tsne?: any;error?: Error;}@@ -226,9 +223,6 @@ export interface MLSyncConfig {blurDetection: BlurDetectionConfig;faceEmbedding: FaceEmbeddingConfig;faceClustering: FaceClusteringConfig;- objectDetection: ObjectDetectionConfig;- sceneDetection: SceneDetectionConfig;- tsne?: TSNEConfig;mlVersion: number;}@@ -254,7 +248,6 @@ export interface MLSyncContext {nSyncedFiles: number;nSyncedFaces: number;allSyncedFacesMap?: Map<number, Array<Face>>;- tsne?: any;error?: Error;diff --git a/web/apps/photos/src/utils/machineLearning/index.ts b/web/apps/photos/src/utils/machineLearning/index.tsindex afe4ba83ea..8425d45991 100644--- a/web/apps/photos/src/utils/machineLearning/index.ts+++ b/web/apps/photos/src/utils/machineLearning/index.ts@@ -2,7 +2,6 @@ import log from "@/next/log";import { CACHES } from "@ente/shared/storage/cacheStorage/constants";import { cached } from "@ente/shared/storage/cacheStorage/helpers";import { FILE_TYPE } from "constants/file";-import { BLAZEFACE_FACE_SIZE } from "constants/mlConfig";import { euclidean } from "hdbscan";import PQueue from "p-queue";import DownloadManager from "services/download";@@ -21,10 +20,10 @@ import {Versioned,} from "types/machineLearning";import { getRenderableImage } from "utils/file";-import { clamp, imageBitmapToBlob, warpAffineFloat32List } from "utils/image";+import { clamp, warpAffineFloat32List } from "utils/image";import mlIDbStorage from "utils/storage/mlIDbStorage";import { Box, Point } from "../../../thirdparty/face-api/classes";-import { ibExtractFaceImage, ibExtractFaceImages } from "./faceAlign";+import { ibExtractFaceImages } from "./faceAlign";import { getFaceCropBlobFromStorage } from "./faceCrop";export function f32Average(descriptors: Float32Array[]) {@@ -105,29 +104,6 @@ export async function getLocalFile(fileId: number) {return localFiles.find((f) => f.id === fileId);}-export async function getFaceImage(- face: AlignedFace,- token: string,- faceSize: number = BLAZEFACE_FACE_SIZE,- file?: EnteFile,-): Promise<FaceImageBlob> {- if (!file) {- file = await getLocalFile(face.fileId);- }-- const imageBitmap = await getOriginalImageBitmap(file);- const faceImageBitmap = ibExtractFaceImage(- imageBitmap,- face.alignment,- faceSize,- );- const faceImage = imageBitmapToBlob(faceImageBitmap);- faceImageBitmap.close();- imageBitmap.close();-- return faceImage;-}-export async function extractFaceImages(faces: Array<AlignedFace>,faceSize: number,