Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Remove old mlVersions

laurenspriem87e2a32d491f
diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_methods.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_methods.dart
deleted file mode 100644
index 70c1d03ff6..0000000000
--- a/mobile/lib/services/machine_learning/face_ml/face_ml_methods.dart
+++ /dev/null
@@ -1,90 +0,0 @@
-import 'package:photos/services/machine_learning/face_ml/face_ml_version.dart';
-
-/// Represents a face detection method with a specific version.
-class FaceDetectionMethod extends VersionedMethod {
- /// Creates a [FaceDetectionMethod] instance with a specific `method` and `version` (default `1`)
- FaceDetectionMethod(String method, {int version = 1})
- : super(method, version);
-
- /// Creates a [FaceDetectionMethod] instance with 'Empty method' as the method, and a specific `version` (default `1`)
- const FaceDetectionMethod.empty() : super.empty();
-
- /// Creates a [FaceDetectionMethod] instance with 'BlazeFace' as the method, and a specific `version` (default `1`)
- FaceDetectionMethod.blazeFace({int version = 1})
- : super('BlazeFace', version);
-
- static FaceDetectionMethod fromMlVersion(int version) {
- switch (version) {
- case 1:
- return FaceDetectionMethod.blazeFace(version: version);
- default:
- return const FaceDetectionMethod.empty();
- }
- }
-
- static FaceDetectionMethod fromJson(Map<String, dynamic> json) {
- return FaceDetectionMethod(
- json['method'],
- version: json['version'],
- );
- }
-}
-
-/// Represents a face alignment method with a specific version.
-class FaceAlignmentMethod extends VersionedMethod {
- /// Creates a [FaceAlignmentMethod] instance with a specific `method` and `version` (default `1`)
- FaceAlignmentMethod(String method, {int version = 1})
- : super(method, version);
-
- /// Creates a [FaceAlignmentMethod] instance with 'Empty method' as the method, and a specific `version` (default `1`)
- const FaceAlignmentMethod.empty() : super.empty();
-
- /// Creates a [FaceAlignmentMethod] instance with 'affineTransform' as the method, and a specific `version` (default `1`)
- FaceAlignmentMethod.affineTransform({int version = 1}) : super('affineTransform', version);
-
- static FaceAlignmentMethod fromMlVersion(int version) {
- switch (version) {
- case 1:
- return FaceAlignmentMethod.affineTransform(version: version);
- default:
- return const FaceAlignmentMethod.empty();
- }
- }
-
- static FaceAlignmentMethod fromJson(Map<String, dynamic> json) {
- return FaceAlignmentMethod(
- json['method'],
- version: json['version'],
- );
- }
-}
-
-/// Represents a face embedding method with a specific version.
-class FaceEmbeddingMethod extends VersionedMethod {
- /// Creates a [FaceEmbeddingMethod] instance with a specific `method` and `version` (default `1`)
- FaceEmbeddingMethod(String method, {int version = 1})
- : super(method, version);
-
- /// Creates a [FaceEmbeddingMethod] instance with 'Empty method' as the method, and a specific `version` (default `1`)
- const FaceEmbeddingMethod.empty() : super.empty();
-
- /// Creates a [FaceEmbeddingMethod] instance with 'MobileFaceNet' as the method, and a specific `version` (default `1`)
- FaceEmbeddingMethod.mobileFaceNet({int version = 1})
- : super('MobileFaceNet', version);
-
- static FaceEmbeddingMethod fromMlVersion(int version) {
- switch (version) {
- case 1:
- return FaceEmbeddingMethod.mobileFaceNet(version: version);
- default:
- return const FaceEmbeddingMethod.empty();
- }
- }
-
- static FaceEmbeddingMethod fromJson(Map<String, dynamic> json) {
- return FaceEmbeddingMethod(
- json['method'],
- version: json['version'],
- );
- }
-}
diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_result.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_result.dart
index 9f87b87220..7e30097939 100644
--- a/mobile/lib/services/machine_learning/face_ml/face_ml_result.dart
+++ b/mobile/lib/services/machine_learning/face_ml/face_ml_result.dart
@@ -9,7 +9,6 @@ import "package:photos/models/ml/ml_versions.dart";
import 'package:photos/services/machine_learning/face_ml/face_alignment/alignment_result.dart';
import 'package:photos/services/machine_learning/face_ml/face_detection/detection.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_methods.dart';
final _logger = Logger('ClusterResult_FaceMlResult');
@@ -40,13 +39,6 @@ class FaceMlResult {
return List<int>.filled(faces.length, fileId);
}
- FaceDetectionMethod get faceDetectionMethod =>
- FaceDetectionMethod.fromMlVersion(mlVersion);
- FaceAlignmentMethod get faceAlignmentMethod =>
- FaceAlignmentMethod.fromMlVersion(mlVersion);
- FaceEmbeddingMethod get faceEmbeddingMethod =>
- FaceEmbeddingMethod.fromMlVersion(mlVersion);
-
const FaceMlResult({
required this.fileId,
required this.faces,
diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_version.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_version.dart
deleted file mode 100644
index a91c4c8434..0000000000
--- a/mobile/lib/services/machine_learning/face_ml/face_ml_version.dart
+++ /dev/null
@@ -1,15 +0,0 @@
-abstract class VersionedMethod {
- final String method;
- final int version;
-
- VersionedMethod(this.method, [this.version = 0]);
-
- const VersionedMethod.empty()
- : method = 'Empty method',
- version = 0;
-
- Map<String, dynamic> toJson() => {
- 'method': method,
- 'version': version,
- };
-}