Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob]Improve handling of multiple assignment of same faceID to different clusters

Neeraj Guptaf3647df1e9ca
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 774267de1c..509862abc8 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
@@ -170,7 +170,13 @@ class PersonService {
faceCount += cluster.faces.length;
for (var faceId in cluster.faces) {
if (faceIdToClusterID.containsKey(faceId)) {
- throw Exception("Face $faceId is already assigned to a cluster");
+ final otherPersonID = clusterToPersonID[faceIdToClusterID[faceId]!];
+ if (otherPersonID != e.id) {
+ final otherPerson = await getPerson(otherPersonID!);
+ throw Exception(
+ "Face $faceId is already assigned to person $otherPersonID (${otherPerson!.data.name}) and person ${e.id} (${personData.name})",
+ );
+ }
}
faceIdToClusterID[faceId] = cluster.id;
}