π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob] Debug log blur values of cluster when opening cluster page
laurensprieme3b1cb8014b4
diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dartindex f192607ec9..e12242987d 100644--- a/mobile/lib/face/db.dart+++ b/mobile/lib/face/db.dart@@ -344,6 +344,26 @@ class FaceMLDataDB {return maps.map((e) => e[fcFaceId] as String).toSet();}+ Future<Iterable<double>> getBlurValuesForCluster(int clusterID) async {+ final db = await instance.sqliteAsyncDB;+ const String query = '''+ SELECT $facesTable.$faceBlur+ FROM $facesTable+ JOIN $faceClustersTable ON $facesTable.$faceIDColumn = $faceClustersTable.$fcFaceId+ WHERE $faceClustersTable.$fcClusterID = ?+ ''';+ // const String query2 = '''+ // SELECT $faceBlur+ // FROM $facesTable+ // WHERE $faceIDColumn IN (SELECT $fcFaceId FROM $faceClustersTable WHERE $fcClusterID = ?)+ // ''';+ final List<Map<String, dynamic>> maps = await db.getAll(+ query,+ [clusterID],+ );+ return maps.map((e) => e[faceBlur] as double).toSet();+ }+Future<Map<String, int?>> getFaceIdsToClusterIds(Iterable<String> faceIds,) async {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 d1cdb2b7b1..6ce0aeb1cd 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@@ -295,6 +295,30 @@ class ClusterFeedbackService {return clusterIdToFaceIds;}+ Future<void> debugLogClusterBlurValues(+ int clusterID, {+ int? clusterSize,+ }) async {+ final List<double> blurValues = await FaceMLDataDB.instance+ .getBlurValuesForCluster(clusterID)+ .then((value) => value.toList());++ // Round the blur values to integers+ final blurValuesIntegers =+ blurValues.map((value) => value.round()).toList();++ // Sort the blur values in ascending order+ blurValuesIntegers.sort();++ // Log the sorted blur values++ _logger.info(+ "Blur values for cluster $clusterID${clusterSize != null ? ' with $clusterSize photos' : ''}: $blurValuesIntegers",+ );++ return;+ }+/// Returns a map of person's clusterID to map of closest clusterID to with disstanceFuture<Map<int, List<(int, double)>>> getSuggestionsUsingMean(PersonEntity p, {diff --git a/mobile/lib/ui/viewer/people/cluster_page.dart b/mobile/lib/ui/viewer/people/cluster_page.dartindex e2cdaca525..7c3a7c3370 100644--- a/mobile/lib/ui/viewer/people/cluster_page.dart+++ b/mobile/lib/ui/viewer/people/cluster_page.dart@@ -1,5 +1,6 @@import "dart:async";+import "package:flutter/foundation.dart";import 'package:flutter/material.dart';import "package:flutter_animate/flutter_animate.dart";import 'package:photos/core/event_bus.dart';@@ -69,6 +70,12 @@ class _ClusterPageState extends State<ClusterPage> {setState(() {});}});+ kDebugMode+ ? ClusterFeedbackService.instance.debugLogClusterBlurValues(+ widget.clusterID,+ clusterSize: files.length,+ )+ : null;}@override