[mob][photos] Only sort big suggestions
This commit is contained in:
parent
3786c9def9
commit
7312633e02
|
@ -855,18 +855,31 @@ class ClusterFeedbackService {
|
||||||
|
|
||||||
Future<void> _sortSuggestionsOnDistanceToPerson(
|
Future<void> _sortSuggestionsOnDistanceToPerson(
|
||||||
PersonEntity person,
|
PersonEntity person,
|
||||||
List<ClusterSuggestion> suggestions,
|
List<ClusterSuggestion> suggestions, {
|
||||||
) async {
|
bool onlySortBigSuggestions = true,
|
||||||
|
}) async {
|
||||||
if (suggestions.isEmpty) {
|
if (suggestions.isEmpty) {
|
||||||
debugPrint('No suggestions to sort');
|
debugPrint('No suggestions to sort');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (onlySortBigSuggestions) {
|
||||||
|
final bigSuggestions = suggestions
|
||||||
|
.where(
|
||||||
|
(s) => s.filesInCluster.length > kMinimumClusterSizeSearchResult,
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
if (bigSuggestions.isEmpty) {
|
||||||
|
debugPrint('No big suggestions to sort');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
final startTime = DateTime.now();
|
final startTime = DateTime.now();
|
||||||
final faceMlDb = FaceMLDataDB.instance;
|
final faceMlDb = FaceMLDataDB.instance;
|
||||||
|
|
||||||
// Get the cluster averages for the person's clusters and the suggestions' clusters
|
// Get the cluster averages for the person's clusters and the suggestions' clusters
|
||||||
final Map<int, (Uint8List, int)> clusterToSummary =
|
final Map<int, (Uint8List, int)> clusterToSummary =
|
||||||
await faceMlDb.getAllClusterSummary();
|
await faceMlDb.getAllClusterSummary();
|
||||||
|
final clusterSummaryCallTime = DateTime.now();
|
||||||
|
|
||||||
// Calculate the avg embedding of the person
|
// Calculate the avg embedding of the person
|
||||||
final personClusters = await faceMlDb.getPersonClusterIDs(person.remoteID);
|
final personClusters = await faceMlDb.getPersonClusterIDs(person.remoteID);
|
||||||
|
@ -913,7 +926,7 @@ class ClusterFeedbackService {
|
||||||
|
|
||||||
final endTime = DateTime.now();
|
final endTime = DateTime.now();
|
||||||
_logger.info(
|
_logger.info(
|
||||||
"Sorting suggestions based on distance to person took ${endTime.difference(startTime).inMilliseconds} ms for ${suggestions.length} suggestions",
|
"Sorting suggestions based on distance to person took ${endTime.difference(startTime).inMilliseconds} ms for ${suggestions.length} suggestions, of which ${clusterSummaryCallTime.difference(startTime).inMilliseconds} ms was spent on the cluster summary call",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue