Skip to content

armgit / ente

Public Imported from GitHub
0

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

Prevent pet-only jobs from overwriting face/clip embeddings

Amrithesh Kakkoth Enteed22175a1076
diff --git a/mobile/apps/photos/lib/utils/ml_util.dart b/mobile/apps/photos/lib/utils/ml_util.dart
index 469b1032ad..435c6e23de 100644
--- a/mobile/apps/photos/lib/utils/ml_util.dart
+++ b/mobile/apps/photos/lib/utils/ml_util.dart
@@ -578,6 +578,7 @@ Future<MLResult> analyzeImageStatic(Map args) async {
final imageDimensions = decodedImage.dimensions;
final result = MLResult.fromEnteFileID(enteFileID);
result.decodedImageSize = imageDimensions;
+ if (!runFaces) result.faces = null;
final decodeTime = DateTime.now();
final decodeMs = decodeTime.difference(startTime).inMilliseconds;
@@ -783,6 +784,11 @@ Future<MLResult> analyzeImageRust(Map args) async {
height: rustResult.decodedImageSize.height,
);
+ // Nullify faces/clip when their pipelines were not requested so that
+ // facesRan/clipRan correctly report false and processImage does not
+ // overwrite existing remote embeddings with empty payloads.
+ if (!runFaces) result.faces = null;
+
if (runFaces) {
final rustFaces = rustResult.faces ?? const <rust_ml.RustFaceResult>[];
result.faces = rustFaces.map((face) {