[mob][photos] Show clustering progress
This commit is contained in:
parent
579239ad54
commit
725e628537
27 changed files with 87 additions and 22 deletions
|
@ -725,18 +725,20 @@ class FaceMLDataDB {
|
|||
return maps.first['count'] as int;
|
||||
}
|
||||
|
||||
Future<int> getClusteredFaceCount() async {
|
||||
final db = await instance.asyncDB;
|
||||
final List<Map<String, dynamic>> maps = await db.getAll(
|
||||
'SELECT COUNT(DISTINCT $fcFaceId) as count FROM $faceClustersTable',
|
||||
);
|
||||
return maps.first['count'] as int;
|
||||
}
|
||||
|
||||
Future<double> getClusteredToTotalFacesRatio() async {
|
||||
final db = await instance.asyncDB;
|
||||
|
||||
final List<Map<String, dynamic>> totalFacesMaps = await db.getAll(
|
||||
'SELECT COUNT(*) as count FROM $facesTable WHERE $faceScore > $kMinimumQualityFaceScore AND $faceBlur > $kLaplacianHardThreshold',
|
||||
);
|
||||
final int totalFaces = totalFacesMaps.first['count'] as int;
|
||||
final int totalFaces = await getTotalFaceCount();
|
||||
|
||||
final List<Map<String, dynamic>> clusteredFacesMaps = await db.getAll(
|
||||
'SELECT COUNT(DISTINCT $fcFaceId) as count FROM $faceClustersTable',
|
||||
);
|
||||
final int clusteredFaces = clusteredFacesMaps.first['count'] as int;
|
||||
final int clusteredFaces = await getClusteredFaceCount();
|
||||
|
||||
return clusteredFaces / totalFaces;
|
||||
}
|
||||
|
|
2
mobile/lib/generated/intl/messages_cs.dart
generated
2
mobile/lib/generated/intl/messages_cs.dart
generated
|
@ -34,6 +34,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"addViewers": m1,
|
||||
"changeLocationOfSelectedItems": MessageLookupByLibrary.simpleMessage(
|
||||
"Change location of selected items?"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"contacts": MessageLookupByLibrary.simpleMessage("Contacts"),
|
||||
"createCollaborativeLink":
|
||||
MessageLookupByLibrary.simpleMessage("Create collaborative link"),
|
||||
|
|
2
mobile/lib/generated/intl/messages_de.dart
generated
2
mobile/lib/generated/intl/messages_de.dart
generated
|
@ -436,6 +436,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"Nach Aufnahmezeit gruppieren"),
|
||||
"clubByFileName":
|
||||
MessageLookupByLibrary.simpleMessage("Nach Dateiname gruppieren"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"codeAppliedPageTitle":
|
||||
MessageLookupByLibrary.simpleMessage("Code eingelöst"),
|
||||
"codeCopiedToClipboard": MessageLookupByLibrary.simpleMessage(
|
||||
|
|
2
mobile/lib/generated/intl/messages_en.dart
generated
2
mobile/lib/generated/intl/messages_en.dart
generated
|
@ -435,6 +435,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
MessageLookupByLibrary.simpleMessage("Club by capture time"),
|
||||
"clubByFileName":
|
||||
MessageLookupByLibrary.simpleMessage("Club by file name"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"codeAppliedPageTitle":
|
||||
MessageLookupByLibrary.simpleMessage("Code applied"),
|
||||
"codeCopiedToClipboard":
|
||||
|
|
2
mobile/lib/generated/intl/messages_es.dart
generated
2
mobile/lib/generated/intl/messages_es.dart
generated
|
@ -367,6 +367,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"close": MessageLookupByLibrary.simpleMessage("Cerrar"),
|
||||
"clubByCaptureTime": MessageLookupByLibrary.simpleMessage(
|
||||
"Agrupar por tiempo de captura"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"codeAppliedPageTitle":
|
||||
MessageLookupByLibrary.simpleMessage("Código aplicado"),
|
||||
"codeCopiedToClipboard": MessageLookupByLibrary.simpleMessage(
|
||||
|
|
2
mobile/lib/generated/intl/messages_fr.dart
generated
2
mobile/lib/generated/intl/messages_fr.dart
generated
|
@ -425,6 +425,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
MessageLookupByLibrary.simpleMessage("Grouper par durée"),
|
||||
"clubByFileName":
|
||||
MessageLookupByLibrary.simpleMessage("Grouper par nom de fichier"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"codeAppliedPageTitle":
|
||||
MessageLookupByLibrary.simpleMessage("Code appliqué"),
|
||||
"codeCopiedToClipboard": MessageLookupByLibrary.simpleMessage(
|
||||
|
|
2
mobile/lib/generated/intl/messages_it.dart
generated
2
mobile/lib/generated/intl/messages_it.dart
generated
|
@ -411,6 +411,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
MessageLookupByLibrary.simpleMessage("Club per tempo di cattura"),
|
||||
"clubByFileName":
|
||||
MessageLookupByLibrary.simpleMessage("Unisci per nome file"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"codeAppliedPageTitle":
|
||||
MessageLookupByLibrary.simpleMessage("Codice applicato"),
|
||||
"codeCopiedToClipboard": MessageLookupByLibrary.simpleMessage(
|
||||
|
|
2
mobile/lib/generated/intl/messages_ko.dart
generated
2
mobile/lib/generated/intl/messages_ko.dart
generated
|
@ -34,6 +34,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"addViewers": m1,
|
||||
"changeLocationOfSelectedItems": MessageLookupByLibrary.simpleMessage(
|
||||
"Change location of selected items?"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"contacts": MessageLookupByLibrary.simpleMessage("Contacts"),
|
||||
"createCollaborativeLink":
|
||||
MessageLookupByLibrary.simpleMessage("Create collaborative link"),
|
||||
|
|
2
mobile/lib/generated/intl/messages_nl.dart
generated
2
mobile/lib/generated/intl/messages_nl.dart
generated
|
@ -447,6 +447,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
MessageLookupByLibrary.simpleMessage("Samenvoegen op tijd"),
|
||||
"clubByFileName":
|
||||
MessageLookupByLibrary.simpleMessage("Samenvoegen op bestandsnaam"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"codeAppliedPageTitle":
|
||||
MessageLookupByLibrary.simpleMessage("Code toegepast"),
|
||||
"codeCopiedToClipboard": MessageLookupByLibrary.simpleMessage(
|
||||
|
|
2
mobile/lib/generated/intl/messages_no.dart
generated
2
mobile/lib/generated/intl/messages_no.dart
generated
|
@ -39,6 +39,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"cancel": MessageLookupByLibrary.simpleMessage("Avbryt"),
|
||||
"changeLocationOfSelectedItems": MessageLookupByLibrary.simpleMessage(
|
||||
"Change location of selected items?"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"confirmAccountDeletion":
|
||||
MessageLookupByLibrary.simpleMessage("Bekreft sletting av konto"),
|
||||
"confirmDeletePrompt": MessageLookupByLibrary.simpleMessage(
|
||||
|
|
2
mobile/lib/generated/intl/messages_pl.dart
generated
2
mobile/lib/generated/intl/messages_pl.dart
generated
|
@ -49,6 +49,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
MessageLookupByLibrary.simpleMessage("Zmień hasło"),
|
||||
"checkInboxAndSpamFolder": MessageLookupByLibrary.simpleMessage(
|
||||
"Sprawdź swoją skrzynkę odbiorczą (i spam), aby zakończyć weryfikację"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"codeCopiedToClipboard": MessageLookupByLibrary.simpleMessage(
|
||||
"Kod został skopiowany do schowka"),
|
||||
"confirm": MessageLookupByLibrary.simpleMessage("Potwierdź"),
|
||||
|
|
2
mobile/lib/generated/intl/messages_pt.dart
generated
2
mobile/lib/generated/intl/messages_pt.dart
generated
|
@ -445,6 +445,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"Agrupar por tempo de captura"),
|
||||
"clubByFileName": MessageLookupByLibrary.simpleMessage(
|
||||
"Agrupar pelo nome de arquivo"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"codeAppliedPageTitle":
|
||||
MessageLookupByLibrary.simpleMessage("Código aplicado"),
|
||||
"codeCopiedToClipboard": MessageLookupByLibrary.simpleMessage(
|
||||
|
|
2
mobile/lib/generated/intl/messages_zh.dart
generated
2
mobile/lib/generated/intl/messages_zh.dart
generated
|
@ -382,6 +382,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"close": MessageLookupByLibrary.simpleMessage("关闭"),
|
||||
"clubByCaptureTime": MessageLookupByLibrary.simpleMessage("按拍摄时间分组"),
|
||||
"clubByFileName": MessageLookupByLibrary.simpleMessage("按文件名排序"),
|
||||
"clusteringProgress":
|
||||
MessageLookupByLibrary.simpleMessage("Clustering progress"),
|
||||
"codeAppliedPageTitle": MessageLookupByLibrary.simpleMessage("代码已应用"),
|
||||
"codeCopiedToClipboard":
|
||||
MessageLookupByLibrary.simpleMessage("代码已复制到剪贴板"),
|
||||
|
|
10
mobile/lib/generated/l10n.dart
generated
10
mobile/lib/generated/l10n.dart
generated
|
@ -8783,6 +8783,16 @@ class S {
|
|||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Clustering progress`
|
||||
String get clusteringProgress {
|
||||
return Intl.message(
|
||||
'Clustering progress',
|
||||
name: 'clusteringProgress',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
"removePersonLabel": "Remove person label",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -1211,5 +1211,6 @@
|
|||
"removePersonLabel": "Remove person label",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -1234,5 +1234,6 @@
|
|||
"pairWithPin": "Pair with PIN",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -985,5 +985,6 @@
|
|||
"removePersonLabel": "Remove person label",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -1166,5 +1166,6 @@
|
|||
"removePersonLabel": "Remove person label",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -1128,5 +1128,6 @@
|
|||
"removePersonLabel": "Remove person label",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -23,5 +23,6 @@
|
|||
"removePersonLabel": "Remove person label",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -1229,5 +1229,6 @@
|
|||
"pairingComplete": "Koppeling voltooid",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -37,5 +37,6 @@
|
|||
"removePersonLabel": "Remove person label",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -124,5 +124,6 @@
|
|||
"removePersonLabel": "Remove person label",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -1229,5 +1229,6 @@
|
|||
"pairingComplete": "Pareamento concluído",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -1229,5 +1229,6 @@
|
|||
"pairingComplete": "配对完成",
|
||||
"faceRecognition": "Face recognition",
|
||||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces"
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress"
|
||||
}
|
|
@ -378,14 +378,16 @@ class FaceRecognitionStatusWidgetState
|
|||
});
|
||||
}
|
||||
|
||||
Future<(int, int, int)> getIndexStatus() async {
|
||||
Future<(int, int, int, double)> getIndexStatus() async {
|
||||
final indexedFiles = await FaceMLDataDB.instance
|
||||
.getIndexedFileCount(minimumMlVersion: faceMlVersion);
|
||||
final indexableFiles = await FaceMlService.getIndexableFilesCount();
|
||||
final pendingFiles = max(indexableFiles - indexedFiles, 0);
|
||||
final foundFaces = await FaceMLDataDB.instance.getTotalFaceCount();
|
||||
final clusteredFaces = await FaceMLDataDB.instance.getClusteredFaceCount();
|
||||
final clusteringDoneRatio = clusteredFaces / foundFaces;
|
||||
|
||||
return (indexedFiles, pendingFiles, foundFaces);
|
||||
return (indexedFiles, pendingFiles, foundFaces, clusteringDoneRatio);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -411,6 +413,9 @@ class FaceRecognitionStatusWidgetState
|
|||
final int indexedFiles = snapshot.data!.$1;
|
||||
final int pendingFiles = snapshot.data!.$2;
|
||||
final int foundFaces = snapshot.data!.$3;
|
||||
final double clusteringDoneRatio = snapshot.data!.$4;
|
||||
final double clusteringPercentage =
|
||||
(clusteringDoneRatio * 100).clamp(0, 100);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
|
@ -450,6 +455,18 @@ class FaceRecognitionStatusWidgetState
|
|||
alignCaptionedTextToLeft: true,
|
||||
isGestureDetectorDisabled: true,
|
||||
),
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: CaptionedTextWidget(
|
||||
title: S.of(context).clusteringProgress,
|
||||
),
|
||||
trailingWidget: Text(
|
||||
"${clusteringPercentage.toStringAsFixed(0)}%",
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
singleBorderRadius: 8,
|
||||
alignCaptionedTextToLeft: true,
|
||||
isGestureDetectorDisabled: true,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue