π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Cleanup face embedding service
laurenspriem2855181de945
diff --git a/mobile/lib/services/machine_learning/face_ml/face_embedding/face_embedding_exceptions.dart b/mobile/lib/services/machine_learning/face_ml/face_embedding/face_embedding_exceptions.dartdeleted file mode 100644index 548b80a957..0000000000--- a/mobile/lib/services/machine_learning/face_ml/face_embedding/face_embedding_exceptions.dart+++ /dev/null@@ -1,11 +0,0 @@-class MobileFaceNetInterpreterInitializationException implements Exception {}--class MobileFaceNetImagePreprocessingException implements Exception {}--class MobileFaceNetEmptyInput implements Exception {}--class MobileFaceNetWrongInputSize implements Exception {}--class MobileFaceNetWrongInputRange implements Exception {}--class MobileFaceNetInterpreterRunException implements Exception {}\ No newline at end of filediff --git a/mobile/lib/services/machine_learning/face_ml/face_embedding/face_embedding_service.dart b/mobile/lib/services/machine_learning/face_ml/face_embedding/face_embedding_service.dartindex deff1fbd39..bee85cfa31 100644--- a/mobile/lib/services/machine_learning/face_ml/face_embedding/face_embedding_service.dart+++ b/mobile/lib/services/machine_learning/face_ml/face_embedding/face_embedding_service.dart@@ -7,6 +7,8 @@ import 'package:logging/logging.dart';import 'package:onnxruntime/onnxruntime.dart';import "package:photos/services/remote_assets_service.dart";+class MobileFaceNetInterpreterRunException implements Exception {}+/// This class is responsible for running the face embedding model (MobileFaceNet) on ONNX runtime, and can be accessed through the singleton instance [FaceEmbeddingService.instance].class FaceEmbeddingService {static const kModelBucketEndpoint = "https://models.ente.io/";@@ -127,7 +129,7 @@ class FaceEmbeddingService {return embeddings;} catch (e) {_logger.info('MobileFaceNet Error while running inference: $e');- rethrow;+ throw MobileFaceNetInterpreterRunException();}}}diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dartindex d87993d180..737be8a548 100644--- a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart+++ b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart@@ -34,7 +34,6 @@ import 'package:photos/services/machine_learning/face_ml/face_clustering/face_climport "package:photos/services/machine_learning/face_ml/face_clustering/face_db_info_for_clustering.dart";import 'package:photos/services/machine_learning/face_ml/face_detection/detection.dart';import 'package:photos/services/machine_learning/face_ml/face_detection/face_detection_service.dart';-import 'package:photos/services/machine_learning/face_ml/face_embedding/face_embedding_exceptions.dart';import 'package:photos/services/machine_learning/face_ml/face_embedding/face_embedding_service.dart';import 'package:photos/services/machine_learning/face_ml/face_filtering/face_filtering_constants.dart';import 'package:photos/services/machine_learning/face_ml/face_ml_exceptions.dart';@@ -1205,17 +1204,8 @@ class FaceMlService {}return embeddings;- } on MobileFaceNetInterpreterInitializationException {- throw CouldNotInitializeFaceEmbeddor();} on MobileFaceNetInterpreterRunException {throw CouldNotRunFaceEmbeddor();- } on MobileFaceNetEmptyInput {- throw InputProblemFaceEmbeddor("Input is empty");- } on MobileFaceNetWrongInputSize {- throw InputProblemFaceEmbeddor("Input size is wrong");- } on MobileFaceNetWrongInputRange {- throw InputProblemFaceEmbeddor("Input range is wrong");- // ignore: avoid_catches_without_on_clauses} catch (e) {dev.log('[SEVERE] Face embedding (batch) failed: $e');throw GeneralFaceMlException('Face embedding (batch) failed: $e');