Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Fix bug in discarding remote embedding

Neeraj Guptae82cda1e82b7
diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart
index 53c4bac486..d32a7f2bb0 100644
--- a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart
@@ -470,9 +470,22 @@ class FaceMlService {
"because version is ${fileMl.faceEmbedding.version} and we need $faceMlVersion");
return true;
}
+ if (fileMl.faceEmbedding.error ?? false) {
+ debugPrint("Discarding remote embedding for fileID ${fileMl.fileID} "
+ "because error is true");
+ return true;
+ }
// are all landmarks equal?
bool allLandmarksEqual = true;
+ if (fileMl.faceEmbedding.faces.isEmpty) {
+ debugPrint("No face for ${fileMl.fileID}");
+ allLandmarksEqual = false;
+ }
for (final face in fileMl.faceEmbedding.faces) {
+ if (face.detection.landmarks.isEmpty) {
+ allLandmarksEqual = false;
+ break;
+ }
if (face.detection.landmarks
.any((landmark) => landmark.x != landmark.y)) {
allLandmarksEqual = false;
@@ -482,6 +495,12 @@ class FaceMlService {
if (allLandmarksEqual) {
debugPrint("Discarding remote embedding for fileID ${fileMl.fileID} "
"because landmarks are not equal");
+ debugPrint(
+ fileMl.faceEmbedding.faces
+ .map((e) => e.detection.landmarks)
+ .toList()
+ .toString(),
+ );
return true;
}
if (fileMl.width == null || fileMl.height == null) {