From bdb7ce2f03003ea3de77ebbae485bf291957da76 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:07:02 +0530 Subject: [PATCH] [mob] Store image height and width --- .../machine_learning/face_ml/face_ml_service.dart | 2 ++ mobile/lib/services/machine_learning/file_ml/file_ml.dart | 8 ++++++++ 2 files changed, 10 insertions(+) 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.dart index 746112b825..a11aa4c32e 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 @@ -681,6 +681,8 @@ class FaceMlService { result.mlVersion, error: result.errorOccured ? true : null, ), + height: result.faceDetectionImageSize!.height.truncate(), + width: result.faceDetectionImageSize!.width.truncate(), ), ); await FaceMLDataDB.instance.bulkInsertFaces(faces); diff --git a/mobile/lib/services/machine_learning/file_ml/file_ml.dart b/mobile/lib/services/machine_learning/file_ml/file_ml.dart index ed6d0eb2f1..cbd706dd79 100644 --- a/mobile/lib/services/machine_learning/file_ml/file_ml.dart +++ b/mobile/lib/services/machine_learning/file_ml/file_ml.dart @@ -2,6 +2,8 @@ import "package:photos/face/model/face.dart"; class FileMl { final int fileID; + final int? height; + final int? width; // json: face final FaceEmbeddings faceEmbedding; final ClipEmbedding? clipEmbedding; @@ -11,12 +13,16 @@ class FileMl { FileMl( this.fileID, this.faceEmbedding, { + this.height, + this.width, this.clipEmbedding, }); // toJson Map toJson() => { 'fileID': fileID, + 'height': height, + 'width': width, 'faceEmbedding': faceEmbedding.toJson(), 'clipEmbedding': clipEmbedding?.toJson(), }; @@ -25,6 +31,8 @@ class FileMl { return FileMl( json['fileID'] as int, FaceEmbeddings.fromJson(json['faceEmbedding'] as Map), + height: json['height'] as int?, + width: json['width'] as int?, clipEmbedding: json['clipEmbedding'] == null ? null : ClipEmbedding.fromJson(