π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Small changes in suggestion calculation
laurenspriemd650bac50192
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.dartindex 2c57252c21..26623feccf 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@@ -784,24 +784,31 @@ class ClusterFeedbackService {Map<int, int>? allClusterIdsToCountMap,}) {final Map<int, List<(int, double)>> suggestions = {};+ const suggestionMax = 2000;int suggestionCount = 0;+ int comparisons = 0;final w = (kDebugMode ? EnteWatch('getSuggestions') : null)?..start();- for (final otherClusterID in clusterAvg.keys) {- // ignore the cluster that belong to the person or is ignored- if (personClusters.contains(otherClusterID) ||- ignoredClusters.contains(otherClusterID)) {++ // ignore the clusters that belong to the person or is ignored+ Set<int> otherClusters = clusterAvg.keys.toSet().difference(personClusters);+ otherClusters = otherClusters.difference(ignoredClusters);++ for (final otherClusterID in otherClusters) {+ final Vector? otherAvg = clusterAvg[otherClusterID];+ if (otherAvg == null) {+ _logger.warning('no avg for othercluster $otherClusterID');continue;}- final Vector otherAvg = clusterAvg[otherClusterID]!;int? nearestPersonCluster;double? minDistance;for (final personCluster in personClusters) {if (clusterAvg[personCluster] == null) {- _logger.info('no avg for cluster $personCluster');+ _logger.warning('no avg for personcluster $personCluster');continue;}final Vector avg = clusterAvg[personCluster]!;final distance = cosineDistanceSIMD(avg, otherAvg);+ comparisons++;if (distance < maxClusterDistance) {if (minDistance == null || distance < minDistance) {minDistance = distance;@@ -815,11 +822,13 @@ class ClusterFeedbackService {.add((otherClusterID, minDistance));suggestionCount++;}- if (suggestionCount >= 2000) {+ if (suggestionCount >= suggestionMax) {break;}}- w?.log('calculation inside calcSuggestionsMean');+ w?.log(+ 'calculation inside calcSuggestionsMean for ${personClusters.length} person clusters and ${otherClusters.length} other clusters (so ${personClusters.length * otherClusters.length} combinations, $comparisons comparisons made resulted in $suggestionCount suggestions)',+ );if (suggestions.isNotEmpty) {final List<(int, double)> suggestClusterIds = [];