π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Fix regression in suggestion calculation
laurenspriem74ae4ea74f53
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 95b3f2b081..2c57252c21 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@@ -481,46 +481,46 @@ class ClusterFeedbackService {late Map<int, Vector> clusterAvgBigClusters;final List<(int, double)> suggestionsMean = [];for (final minimumSize in checkSizes.toSet()) {- // if (smallestPersonClusterSize >= minimumSize) {- clusterAvgBigClusters = await _getUpdateClusterAvg(- allClusterIdsToCountMap,- ignoredClusters,- minClusterSize: minimumSize,- );- w?.log(- 'Calculate avg for ${clusterAvgBigClusters.length} clusters of min size $minimumSize',- );- final List<(int, double)> suggestionsMeanBigClusters =- _calcSuggestionsMean(- clusterAvgBigClusters,- personClusters,- ignoredClusters,- goodMeanDistance,- );- w?.log(- 'Calculate suggestions using mean for ${clusterAvgBigClusters.length} clusters of min size $minimumSize',- );- for (final suggestion in suggestionsMeanBigClusters) {- // Skip suggestions that have a high overlap with the person's files- final suggestionSet = allClusterIdToFaceIDs[suggestion.$1]!- .map((faceID) => getFileIdFromFaceId(faceID))- .toSet();- final overlap = personFileIDs.intersection(suggestionSet);- if (overlap.isNotEmpty &&- ((overlap.length / suggestionSet.length) > 0.5)) {- await FaceMLDataDB.instance.captureNotPersonFeedback(- personID: p.remoteID,- clusterID: suggestion.$1,- );- continue;+ if (smallestPersonClusterSize >= minimumSize) {+ clusterAvgBigClusters = await _getUpdateClusterAvg(+ allClusterIdsToCountMap,+ ignoredClusters,+ minClusterSize: minimumSize,+ );+ w?.log(+ 'Calculate avg for ${clusterAvgBigClusters.length} clusters of min size $minimumSize',+ );+ final List<(int, double)> suggestionsMeanBigClusters =+ _calcSuggestionsMean(+ clusterAvgBigClusters,+ personClusters,+ ignoredClusters,+ goodMeanDistance,+ );+ w?.log(+ 'Calculate suggestions using mean for ${clusterAvgBigClusters.length} clusters of min size $minimumSize',+ );+ for (final suggestion in suggestionsMeanBigClusters) {+ // Skip suggestions that have a high overlap with the person's files+ final suggestionSet = allClusterIdToFaceIDs[suggestion.$1]!+ .map((faceID) => getFileIdFromFaceId(faceID))+ .toSet();+ final overlap = personFileIDs.intersection(suggestionSet);+ if (overlap.isNotEmpty &&+ ((overlap.length / suggestionSet.length) > 0.5)) {+ await FaceMLDataDB.instance.captureNotPersonFeedback(+ personID: p.remoteID,+ clusterID: suggestion.$1,+ );+ continue;+ }+ suggestionsMean.add(suggestion);+ }+ if (suggestionsMean.isNotEmpty) {+ return suggestionsMean+ .map((e) => (e.$1, e.$2, true))+ .toList(growable: false);}- suggestionsMean.add(suggestion);- }- if (suggestionsMean.isNotEmpty) {- return suggestionsMean- .map((e) => (e.$1, e.$2, true))- .toList(growable: false);- // }}}w?.reset();