Prechádzať zdrojové kódy

[mob] empty constructor for Face

laurenspriem 1 rok pred
rodič
commit
83d8d7ae7a

+ 11 - 0
mobile/lib/face/model/face.dart

@@ -20,6 +20,17 @@ class Face {
     this.blur,
   );
 
+  factory Face.empty(int fileID, {bool error = false}) {
+    return Face(
+      "$fileID-0",
+      fileID,
+      <double>[],
+      error ? -1.0 : 0.0,
+      Detection.empty(),
+      0.0,
+    );
+  }
+
   factory Face.fromJson(Map<String, dynamic> json) {
     return Face(
       json['faceID'] as String,

+ 2 - 6
mobile/lib/services/face_ml/face_ml_service.dart

@@ -461,13 +461,9 @@ class FaceMlService {
             if (fileMl.faceEmbedding.version != faceMlVersion) continue;
             if (fileMl.faceEmbedding.faces.isEmpty) {
               faces.add(
-                Face(
-                  '${fileMl.fileID}-0',
+                Face.empty(
                   fileMl.fileID,
-                  <double>[],
-                  (fileMl.faceEmbedding.error ?? false) ? -1.0 : 0.0,
-                  face_detection.Detection.empty(),
-                  0.0,
+                  error: (fileMl.faceEmbedding.error ?? false),
                 ),
               );
             } else {

+ 2 - 1
mobile/lib/services/machine_learning/file_ml/remote_fileml_service.dart

@@ -123,7 +123,8 @@ class RemoteFileMLService {
   }
 
   Future<Map<int, FileMl>> decryptFileMLComputer(
-      Map<String, dynamic> args) async {
+    Map<String, dynamic> args,
+  ) async {
     final result = <int, FileMl>{};
     final inputs = args["inputs"] as List<EmbeddingsDecoderInput>;
     for (final input in inputs) {