Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Prune

Manav Rathid2e7925c6305
diff --git a/web/apps/photos/src/services/machineLearning/machineLearningFactory.ts b/web/apps/photos/src/services/machineLearning/machineLearningFactory.ts
index bc04921d8a..920649bb4f 100644
--- a/web/apps/photos/src/services/machineLearning/machineLearningFactory.ts
+++ b/web/apps/photos/src/services/machineLearning/machineLearningFactory.ts
@@ -121,7 +121,6 @@ export class LocalMLSyncContext implements MLSyncContext {
public blurDetectionService: BlurDetectionService;
public faceEmbeddingService: FaceEmbeddingService;
public faceClusteringService: ClusteringService;
- public sceneDetectionService: SceneDetectionService;
public localFilesMap: Map<number, EnteFile>;
public outOfSyncFiles: EnteFile[];
@@ -175,10 +174,6 @@ export class LocalMLSyncContext implements MLSyncContext {
this.config.faceClustering.method,
);
- this.sceneDetectionService = MLFactory.getSceneDetectionService(
- this.config.sceneDetection.method,
- );
-
this.outOfSyncFiles = [];
this.nSyncedFiles = 0;
this.nSyncedFaces = 0;
diff --git a/web/apps/photos/src/services/machineLearning/machineLearningService.ts b/web/apps/photos/src/services/machineLearning/machineLearningService.ts
index 97e4a6b7c7..7fbd563f39 100644
--- a/web/apps/photos/src/services/machineLearning/machineLearningService.ts
+++ b/web/apps/photos/src/services/machineLearning/machineLearningService.ts
@@ -22,8 +22,6 @@ import PeopleService from "./peopleService";
import ReaderService from "./readerService";
class MachineLearningService {
- private initialized = false;
-
private localSyncContext: Promise<MLSyncContext>;
private syncContext: Promise<MLSyncContext>;
@@ -300,7 +298,7 @@ class MachineLearningService {
throw error;
}
- await this.persistMLFileSyncError(syncContext, enteFile, error);
+ await this.persistMLFileSyncError(enteFile, error);
syncContext.nSyncedFiles += 1;
}
}
@@ -337,7 +335,7 @@ class MachineLearningService {
newMlFile.errorCount = 0;
newMlFile.lastErrorMessage = undefined;
await this.persistOnServer(newMlFile, enteFile);
- await this.persistMLFileData(syncContext, newMlFile);
+ await mlIDbStorage.putFile(newMlFile);
} catch (e) {
log.error("ml detection failed", e);
newMlFile.mlVersion = oldMlFile.mlVersion;
@@ -368,38 +366,11 @@ class MachineLearningService {
log.info("putEmbedding response: ", res);
}
- public async init() {
- if (this.initialized) {
- return;
- }
-
- await tf.ready();
-
- log.info("01 TF Memory stats: ", JSON.stringify(tf.memory()));
-
- this.initialized = true;
- }
-
- public async dispose() {
- this.initialized = false;
- }
-
private async getMLFileData(fileId: number) {
return mlIDbStorage.getFile(fileId);
}
- private async persistMLFileData(
- syncContext: MLSyncContext,
- mlFileData: MlFileData,
- ) {
- mlIDbStorage.putFile(mlFileData);
- }
-
- private async persistMLFileSyncError(
- syncContext: MLSyncContext,
- enteFile: EnteFile,
- e: Error,
- ) {
+ private async persistMLFileSyncError(enteFile: EnteFile, e: Error) {
try {
await mlIDbStorage.upsertFileInTx(enteFile.id, (mlFileData) => {
if (!mlFileData) {
@@ -432,8 +403,6 @@ class MachineLearningService {
await PeopleService.syncPeopleIndex(syncContext);
- await ObjectService.syncThingsIndex(syncContext);
-
await this.persistMLLibraryData(syncContext);
}