From ab875ea9a9fd3a513dccb06a01502e393da8611e Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 29 Mar 2024 14:33:11 +0530 Subject: [PATCH 1/3] [mob] Use epochTime as clusterID --- .../face_ml/face_clustering/linear_clustering_service.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart b/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart index 5e0855eb47..09dc398891 100644 --- a/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart +++ b/mobile/lib/services/machine_learning/face_ml/face_clustering/linear_clustering_service.dart @@ -273,7 +273,8 @@ class FaceLinearClustering { // Make sure the first face has a clusterId final int totalFaces = sortedFaceInfos.length; - int clusterID = 1; + // set current epoch time as clusterID + int clusterID = DateTime.now().millisecondsSinceEpoch; if (sortedFaceInfos.isNotEmpty) { if (sortedFaceInfos.first.clusterId == null) { sortedFaceInfos.first.clusterId = clusterID; From 44a5b97de14be59378ecd9ab75a2ac42f3112219 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 29 Mar 2024 15:39:12 +0530 Subject: [PATCH 2/3] [mob] Storge cluster summary in batches --- .../machine_learning/face_ml/feedback/cluster_feedback.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mobile/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart b/mobile/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart index dfb6675b4b..3a906e4eb7 100644 --- a/mobile/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart +++ b/mobile/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart @@ -387,6 +387,11 @@ class ClusterFeedbackService { updatesForClusterSummary[clusterID] = (avgEmbeedingBuffer, embedings.length); } + // store the intermediate updates + if (updatesForClusterSummary.length > 100) { + await faceMlDb.clusterSummaryUpdate(updatesForClusterSummary); + updatesForClusterSummary.clear(); + } clusterAvg[clusterID] = avg; } if (updatesForClusterSummary.isNotEmpty) { From 67134db3a4cf87c5b6d548c4a7b9b13e7a0b1f87 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 29 Mar 2024 15:43:13 +0530 Subject: [PATCH 3/3] [mob] Fixed typo --- mobile/lib/face/model/person.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mobile/lib/face/model/person.dart b/mobile/lib/face/model/person.dart index ea7ab3d5d7..c1e6105c17 100644 --- a/mobile/lib/face/model/person.dart +++ b/mobile/lib/face/model/person.dart @@ -23,13 +23,13 @@ class PersonAttr { final bool isHidden; String? avatarFaceId; final List faces; - final String? birthDatae; + final String? birthDate; PersonAttr({ required this.name, required this.faces, this.avatarFaceId, this.isHidden = false, - this.birthDatae, + this.birthDate, }); // copyWith PersonAttr copyWith({ @@ -37,14 +37,14 @@ class PersonAttr { List? faces, String? avatarFaceId, bool? isHidden, - String? birthDatae, + String? birthDate, }) { return PersonAttr( name: name ?? this.name, faces: faces ?? this.faces, avatarFaceId: avatarFaceId ?? this.avatarFaceId, isHidden: isHidden ?? this.isHidden, - birthDatae: birthDatae ?? this.birthDatae, + birthDate: birthDate ?? this.birthDate, ); } @@ -54,7 +54,7 @@ class PersonAttr { 'faces': faces.toList(), 'avatarFaceId': avatarFaceId, 'isHidden': isHidden, - 'birthDatae': birthDatae, + 'birthDate': birthDate, }; // fromJson @@ -64,7 +64,7 @@ class PersonAttr { faces: List.from(json['faces'] as List), avatarFaceId: json['avatarFaceId'] as String?, isHidden: json['isHidden'] as bool? ?? false, - birthDatae: json['birthDatae'] as String?, + birthDate: json['birthDatae'] as String?, ); } }