[mob] Debug log blur values of cluster when opening cluster page
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 disstance
|
||||
Future<Map<int, List<(int, double)>>> getSuggestionsUsingMean(
|
||||
PersonEntity p, {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user