Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Minor improvements for ml sync

Neeraj Gupta2b147c1a87de
diff --git a/mobile/lib/models/ml/face/face.dart b/mobile/lib/models/ml/face/face.dart
index 2aeeb7aff3..75c3549c41 100644
--- a/mobile/lib/models/ml/face/face.dart
+++ b/mobile/lib/models/ml/face/face.dart
@@ -98,7 +98,7 @@ class Face {
faceID,
fileID,
parseAsDoubleList(json['embedding'] as List),
- json['score'] as double,
+ parseIntOrDoubleAsDouble(json['score'])!,
Detection.fromJson(json['detection'] as Map<String, dynamic>),
// high value means t
parseIntOrDoubleAsDouble(json['blur']) ?? kLapacianDefault,
diff --git a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
index da46b4b62a..31ccb54960 100644
--- a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
@@ -113,13 +113,12 @@ class PersonService {
PersonData personData,
Map<String, Set<String>> dbPersonCluster,
) {
- bool result = false;
if ((personData.assigned?.length ?? 0) != dbPersonCluster.length) {
log(
"Person ${personData.name} has ${personData.assigned?.length} clusters, but ${dbPersonCluster.length} clusters found in DB",
name: "PersonService",
);
- result = true;
+ return true;
} else {
for (ClusterInfo info in personData.assigned!) {
final dbCluster = dbPersonCluster[info.id];
@@ -128,15 +127,14 @@ class PersonService {
"Cluster ${info.id} not found in DB for person ${personData.name}",
name: "PersonService",
);
- result = true;
- continue;
+ return true;
}
if (info.faces.length != dbCluster.length) {
log(
"Cluster ${info.id} has ${info.faces.length} faces, but ${dbCluster.length} faces found in DB",
name: "PersonService",
);
- result = true;
+ return true;
}
for (var faceId in info.faces) {
if (!dbCluster.contains(faceId)) {
@@ -144,12 +142,12 @@ class PersonService {
"Face $faceId not found in cluster ${info.id} for person ${personData.name}",
name: "PersonService",
);
- result = true;
+ return true;
}
}
}
}
- return result;
+ return false;
}
Future<PersonEntity> addPerson(