Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] ml debug options 1/x

laurenspriem370731b56ae1
diff --git a/mobile/lib/services/machine_learning/face_ml/face_recognition_service.dart b/mobile/lib/services/machine_learning/face_ml/face_recognition_service.dart
index 4898fc5f4e..f639520df3 100644
--- a/mobile/lib/services/machine_learning/face_ml/face_recognition_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/face_recognition_service.dart
@@ -65,12 +65,6 @@ class FaceRecognitionService {
Future<void> sync() async {
await _syncPersonFeedback();
- if (localSettings.remoteFetchEnabled) {
- } else {
- _logger.severe(
- 'Not fetching embeddings because user manually disabled it in debug options',
- );
- }
}
Future<void> _syncPersonFeedback() async {
@@ -95,6 +89,10 @@ class FaceRecognitionService {
List<FileMLInstruction> batchToYield = [];
for (final chunk in chunks) {
+ if (!localSettings.remoteFetchEnabled) {
+ _logger.warning("remoteFetchEnabled is false, skiping embedding fetch");
+ yield chunk;
+ }
final Set<int> ids = {};
final Map<int, FileMLInstruction> pendingIndex = {};
for (final instruction in chunk) {
diff --git a/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart b/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart
index 0b375cce60..af6f8b16b2 100644
--- a/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart
+++ b/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart
@@ -17,6 +17,7 @@ import 'package:photos/ui/components/expandable_menu_item_widget.dart';
import 'package:photos/ui/components/menu_item_widget/menu_item_widget.dart';
import 'package:photos/ui/settings/common_settings.dart';
import "package:photos/utils/dialog_util.dart";
+import "package:photos/utils/ml_util.dart";
import 'package:photos/utils/toast_util.dart';
class MLDebugSectionWidget extends StatefulWidget {
@@ -58,14 +59,15 @@ class _MLDebugSectionWidgetState extends State<MLDebugSectionWidget> {
return Column(
children: [
MenuItemWidget(
- captionedTextWidget: FutureBuilder<int>(
- future: MLDataDB.instance.getFaceIndexedFileCount(),
+ captionedTextWidget: FutureBuilder<IndexStatus>(
+ future: getIndexStatus(),
builder: (context, snapshot) {
if (snapshot.hasData) {
+ final IndexStatus status = snapshot.data!;
return CaptionedTextWidget(
title: localSettings.isMLIndexingEnabled
- ? "Disable faces (${snapshot.data!} files done)"
- : "Enable faces (${snapshot.data!} files done)",
+ ? "Disable ML (${status.indexedItems} files indexed)"
+ : "Enable ML (${status.indexedItems} files indexed)",
);
}
return const SizedBox.shrink();
@@ -77,7 +79,11 @@ class _MLDebugSectionWidgetState extends State<MLDebugSectionWidget> {
onTap: () async {
try {
final isEnabled = await localSettings.toggleMLIndexing();
- if (!isEnabled) {
+ if (isEnabled) {
+ await MLService.instance.init();
+ await SemanticSearchService.instance.init();
+ unawaited(MLService.instance.runAllML(force: true));
+ } else {
MLService.instance.pauseIndexingAndClustering();
}
if (mounted) {
@@ -93,8 +99,8 @@ class _MLDebugSectionWidgetState extends State<MLDebugSectionWidget> {
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: localSettings.remoteFetchEnabled
- ? "Remote fetch enabled"
- : "Remote fetch disabled",
+ ? "Disable remote fetch"
+ : "Enable remote fetch",
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,