π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove ssdMobileNetV2
Manav Rathi03df858dcc57
diff --git a/web/apps/photos/src/services/machineLearning/machineLearningFactory.ts b/web/apps/photos/src/services/machineLearning/machineLearningFactory.tsindex 7017bd1a68..96be5a0f52 100644--- a/web/apps/photos/src/services/machineLearning/machineLearningFactory.ts+++ b/web/apps/photos/src/services/machineLearning/machineLearningFactory.ts@@ -22,8 +22,6 @@ import {MLLibraryData,MLSyncConfig,MLSyncContext,- ObjectDetectionMethod,- ObjectDetectionService,SceneDetectionMethod,SceneDetectionService,} from "types/machineLearning";@@ -35,7 +33,6 @@ import hdbscanClusteringService from "./hdbscanClusteringService";import imageSceneService from "./imageSceneService";import laplacianBlurDetectionService from "./laplacianBlurDetectionService";import mobileFaceNetEmbeddingService from "./mobileFaceNetEmbeddingService";-import ssdMobileNetV2Service from "./ssdMobileNetV2Service";import yoloFaceDetectionService from "./yoloFaceDetectionService";export class MLFactory {@@ -49,16 +46,6 @@ export class MLFactory {throw Error("Unknon face detection method: " + method);}- public static getObjectDetectionService(- method: ObjectDetectionMethod,- ): ObjectDetectionService {- if (method === "SSDMobileNetV2") {- return ssdMobileNetV2Service;- }-- throw Error("Unknown object detection method: " + method);- }-public static getSceneDetectionService(method: SceneDetectionMethod,): SceneDetectionService {@@ -147,7 +134,6 @@ export class LocalMLSyncContext implements MLSyncContext {public blurDetectionService: BlurDetectionService;public faceEmbeddingService: FaceEmbeddingService;public faceClusteringService: ClusteringService;- public objectDetectionService: ObjectDetectionService;public sceneDetectionService: SceneDetectionService;public localFilesMap: Map<number, EnteFile>;@@ -202,9 +188,6 @@ export class LocalMLSyncContext implements MLSyncContext {this.config.faceClustering.method,);- this.objectDetectionService = MLFactory.getObjectDetectionService(- this.config.objectDetection.method,- );this.sceneDetectionService = MLFactory.getSceneDetectionService(this.config.sceneDetection.method,);diff --git a/web/apps/photos/src/services/machineLearning/ssdMobileNetV2Service.ts b/web/apps/photos/src/services/machineLearning/ssdMobileNetV2Service.tsdeleted file mode 100644index 1866565321..0000000000--- a/web/apps/photos/src/services/machineLearning/ssdMobileNetV2Service.ts+++ /dev/null@@ -1,66 +0,0 @@-import log from "@/next/log";-import * as tf from "@tensorflow/tfjs-core";-import {- ObjectDetection,- ObjectDetectionMethod,- ObjectDetectionService,- Versioned,-} from "types/machineLearning";--import * as SSDMobileNet from "@tensorflow-models/coco-ssd";-import { OBJECT_DETECTION_IMAGE_SIZE } from "constants/mlConfig";-import { resizeToSquare } from "utils/image";--class SSDMobileNetV2 implements ObjectDetectionService {- private ssdMobileNetV2Model: SSDMobileNet.ObjectDetection;- public method: Versioned<ObjectDetectionMethod>;- private ready: Promise<void>;-- public constructor() {- this.method = {- value: "SSDMobileNetV2",- version: 1,- };- }-- private async init() {- this.ssdMobileNetV2Model = await SSDMobileNet.load({- base: "mobilenet_v2",- modelUrl: "/models/ssdmobilenet/model.json",- });- log.info("loaded ssdMobileNetV2Model", tf.getBackend());- }-- private async getSSDMobileNetV2Model() {- if (!this.ready) {- this.ready = this.init();- }- await this.ready;- return this.ssdMobileNetV2Model;- }-- public async detectObjects(- image: ImageBitmap,- maxNumberBoxes: number,- minScore: number,- ): Promise<ObjectDetection[]> {- const ssdMobileNetV2Model = await this.getSSDMobileNetV2Model();- const resized = resizeToSquare(image, OBJECT_DETECTION_IMAGE_SIZE);- const tfImage = tf.browser.fromPixels(resized.image);- const detections = await ssdMobileNetV2Model.detect(- tfImage,- maxNumberBoxes,- minScore,- );- tfImage.dispose();- return detections;- }-- public async dispose() {- const ssdMobileNetV2Model = await this.getSSDMobileNetV2Model();- ssdMobileNetV2Model?.dispose();- this.ssdMobileNetV2Model = null;- }-}--export default new SSDMobileNetV2();diff --git a/web/apps/photos/src/types/machineLearning/index.ts b/web/apps/photos/src/types/machineLearning/index.tsindex f1895cd415..c28627492e 100644--- a/web/apps/photos/src/types/machineLearning/index.ts+++ b/web/apps/photos/src/types/machineLearning/index.ts@@ -265,7 +265,6 @@ export interface MLSyncContext {faceEmbeddingService: FaceEmbeddingService;blurDetectionService: BlurDetectionService;faceClusteringService: ClusteringService;- objectDetectionService: ObjectDetectionService;sceneDetectionService: SceneDetectionService;localFilesMap: Map<number, EnteFile>;@@ -273,7 +272,6 @@ export interface MLSyncContext {nSyncedFiles: number;nSyncedFaces: number;allSyncedFacesMap?: Map<number, Array<Face>>;- allSyncedObjectsMap?: Map<number, Array<RealWorldObject>>;tsne?: any;error?: Error;