Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge origin/main into ml/pet-recognition

Amrithesh Kakkoth Ente0c18c8ce019c
diff --cc mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
index 1ec368c453,6cd09a818e..f4dbd762b9
--- a/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
@@@ -1,7 -1,5 +1,6 @@@
- import "dart:io";
-
import "package:flutter/material.dart";
import "package:logging/logging.dart";
++import "package:photos/core/constants.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/components/buttons/button_widget_v2.dart";
@@@ -167,8 -165,7 +166,7 @@@ class _ReportIssuePageState extends Sta
_isSending = true;
});
- final bugsEmail =
- Platform.isAndroid ? "[email protected]" : "[email protected]";
- final recipientEmail = supportEmail;
++ const recipientEmail = supportEmail;
String? logsZipFilePath;
String? logsLabel;
diff --cc mobile/apps/photos/lib/utils/isolate/isolate_operations.dart
index 824e4d8faa,aaa21d6a90..b2511227a5
--- a/mobile/apps/photos/lib/utils/isolate/isolate_operations.dart
+++ b/mobile/apps/photos/lib/utils/isolate/isolate_operations.dart
@@@ -292,16 -326,7 +326,17 @@@ Future<void> _ensureRustRuntimePrepared
faceDetection: (args["faceDetectionModelPath"] as String?) ?? "",
faceEmbedding: (args["faceEmbeddingModelPath"] as String?) ?? "",
clipImage: (args["clipImageModelPath"] as String?) ?? "",
+ clipText: (args["clipTextModelPath"] as String?) ?? "",
+ petFaceDetection: (args["petFaceDetectionModelPath"] as String?) ?? "",
+ petFaceEmbeddingDog:
+ (args["petFaceEmbeddingDogModelPath"] as String?) ?? "",
+ petFaceEmbeddingCat:
+ (args["petFaceEmbeddingCatModelPath"] as String?) ?? "",
+ petBodyDetection: (args["petBodyDetectionModelPath"] as String?) ?? "",
+ petBodyEmbeddingDog:
+ (args["petBodyEmbeddingDogModelPath"] as String?) ?? "",
+ petBodyEmbeddingCat:
+ (args["petBodyEmbeddingCatModelPath"] as String?) ?? "",
);
final providerPolicy = rust_ml.RustExecutionProviderPolicy(
preferCoreml: args["preferCoreml"] as bool? ?? true,
diff --cc mobile/apps/photos/lib/utils/ml_util.dart
index f9e9906712,c256fee191..fa35d99ecd
--- a/mobile/apps/photos/lib/utils/ml_util.dart
+++ b/mobile/apps/photos/lib/utils/ml_util.dart
@@@ -669,12 -635,7 +669,13 @@@ Future<MLResult> analyzeImageRust(Map a
faceDetection: faceDetectionModelPath ?? "",
faceEmbedding: faceEmbeddingModelPath ?? "",
clipImage: clipImageModelPath ?? "",
+ clipText: "",
+ petFaceDetection: petFaceDetectionModelPath ?? "",
+ petFaceEmbeddingDog: petFaceEmbeddingDogModelPath ?? "",
+ petFaceEmbeddingCat: petFaceEmbeddingCatModelPath ?? "",
+ petBodyDetection: petBodyDetectionModelPath ?? "",
+ petBodyEmbeddingDog: petBodyEmbeddingDogModelPath ?? "",
+ petBodyEmbeddingCat: petBodyEmbeddingCatModelPath ?? "",
);
final providerPolicy = rust_ml.RustExecutionProviderPolicy(
preferCoreml: preferCoreml,
diff --cc mobile/apps/photos/rust/Cargo.lock
index 109668feee,2923cca577..74ca94b528
--- a/mobile/apps/photos/rust/Cargo.lock
+++ b/mobile/apps/photos/rust/Cargo.lock
@@@ -645,7 -763,7 +763,8 @@@ dependencies =
"ente_media_inspector",
"fast_image_resize",
"flutter_rust_bridge",
+ "half",
+ "html-escape",
"image",
"imageproc",
"kamadak-exif",
diff --cc mobile/apps/photos/rust/Cargo.toml
index 5e160e2881,c1256843e7..80607392e7
--- a/mobile/apps/photos/rust/Cargo.toml
+++ b/mobile/apps/photos/rust/Cargo.toml
@@@ -17,10 -17,13 +17,14 @@@ kamadak-exif = "0.6.1
libheic-rs = { git = "https://github.com/laurens-pilot/libheic-rs.git", tag = "v0.1.5", features = [
"image-integration",
] }
+ tiff = "0.10.3"
nalgebra = "0.33.2"
ndarray = "0.16.1"
+half = "2.1"
once_cell = "1.20.2"
+ regex = "1.11.1"
+ html-escape = "0.2.13"
+ plsfix = "0.1.8"
thiserror = "2.0.11"
[target.'cfg(target_os = "ios")'.dependencies]
diff --cc mobile/apps/photos/rust/src/api/ml_indexing_api.rs
index 0bc5851b56,2aee5eaa43..624f148e58
--- a/mobile/apps/photos/rust/src/api/ml_indexing_api.rs
+++ b/mobile/apps/photos/rust/src/api/ml_indexing_api.rs
@@@ -1,13 -1,8 +1,13 @@@
use crate::image::decode::decode_image_from_path;
use crate::ml::{
- clip::image::run_clip_image,
+ clip::{image::run_clip_image, text::run_clip_text_query, tokenizer::tokenize_clip_text},
error::{MlError, MlResult},
face::{align::run_face_alignment, detect::run_face_detection, embed::run_face_embedding},
+ pet::{
+ align::run_pet_face_alignment,
+ detect::{run_pet_body_detection, run_pet_face_detection},
+ embed::{run_pet_body_embedding, run_pet_face_embedding},
+ },
runtime::{self, ExecutionProviderPolicy, MlRuntimeConfig, ModelPaths},
};
@@@ -35,12 -30,7 +35,13 @@@ pub struct RustModelPaths
pub face_detection: String,
pub face_embedding: String,
pub clip_image: String,
+ pub clip_text: String,
+ pub pet_face_detection: String,
+ pub pet_face_embedding_dog: String,
+ pub pet_face_embedding_cat: String,
+ pub pet_body_detection: String,
+ pub pet_body_embedding_dog: String,
+ pub pet_body_embedding_cat: String,
}
#[derive(Clone, Debug)]
@@@ -136,10 -90,21 +137,23 @@@ pub struct AnalyzeImageResult
pub decoded_image_size: RustDimensions,
pub faces: Option<Vec<RustFaceResult>>,
pub clip: Option<RustClipResult>,
+ pub pet_faces: Option<Vec<RustPetFaceResult>>,
+ pub pet_bodies: Option<Vec<RustPetBodyResult>>,
}
+ #[derive(Clone, Debug)]
+ pub struct RunClipTextRequest {
+ pub text: String,
+ pub model_path: String,
+ pub vocab_path: String,
+ pub provider_policy: RustExecutionProviderPolicy,
+ }
+
+ #[derive(Clone, Debug)]
+ pub struct RunClipTextResult {
+ pub embedding: Vec<f64>,
+ }
+
pub fn init_ml_runtime(config: RustMlRuntimeConfig) -> Result<(), String> {
runtime::ensure_runtime(&to_runtime_config(&config)).map_err(|e| e.to_string())
}
@@@ -291,12 -261,7 +363,13 @@@ fn to_model_paths(paths: &RustModelPath
face_detection: paths.face_detection.clone(),
face_embedding: paths.face_embedding.clone(),
clip_image: paths.clip_image.clone(),
+ clip_text: paths.clip_text.clone(),
+ pet_face_detection: paths.pet_face_detection.clone(),
+ pet_face_embedding_dog: paths.pet_face_embedding_dog.clone(),
+ pet_face_embedding_cat: paths.pet_face_embedding_cat.clone(),
+ pet_body_detection: paths.pet_body_detection.clone(),
+ pet_body_embedding_dog: paths.pet_body_embedding_dog.clone(),
+ pet_body_embedding_cat: paths.pet_body_embedding_cat.clone(),
}
}
diff --cc mobile/apps/photos/rust/src/ml/runtime.rs
index ad594fe07a,765760d1f6..e41b592351
--- a/mobile/apps/photos/rust/src/ml/runtime.rs
+++ b/mobile/apps/photos/rust/src/ml/runtime.rs
@@@ -54,12 -32,7 +54,13 @@@ pub struct ModelPaths
pub face_detection: String,
pub face_embedding: String,
pub clip_image: String,
+ pub clip_text: String,
+ pub pet_face_detection: String,
+ pub pet_face_embedding_dog: String,
+ pub pet_face_embedding_cat: String,
+ pub pet_body_detection: String,
+ pub pet_body_embedding_dog: String,
+ pub pet_body_embedding_cat: String,
}
#[derive(Clone, Debug, PartialEq, Eq)]
@@@ -101,15 -53,10 +102,16 @@@ impl LazySession
#[derive(Debug)]
pub struct MlRuntime {
- face_detection: Option<ModelSession>,
- face_embedding: Option<ModelSession>,
- clip_image: Option<ModelSession>,
- clip_text: Option<ModelSession>,
+ face_detection: LazySession,
+ face_embedding: LazySession,
+ clip_image: LazySession,
++ clip_text: LazySession,
+ pet_face_detection: LazySession,
+ pet_face_embedding_dog: LazySession,
+ pet_face_embedding_cat: LazySession,
+ pet_body_detection: LazySession,
+ pet_body_embedding_dog: LazySession,
+ pet_body_embedding_cat: LazySession,
}
#[derive(Debug)]
@@@ -120,34 -66,26 +122,35 @@@ struct RuntimeState
static GLOBAL_RUNTIME: Lazy<Mutex<Option<RuntimeState>>> = Lazy::new(|| Mutex::new(None));
-impl MlRuntime {
- fn new() -> Self {
- Self {
- face_detection: None,
- face_embedding: None,
- clip_image: None,
- clip_text: None,
- }
+fn create_runtime(config: &MlRuntimeConfig) -> MlRuntime {
+ let p = &config.provider_policy;
+ // Pet models use CPU-only to avoid NNAPI/CoreML driver issues with
+ // FP16 models on some devices.
+ let pet_policy = ExecutionProviderPolicy {
+ prefer_coreml: false,
+ prefer_nnapi: false,
+ prefer_xnnpack: false,
+ allow_cpu_fallback: true,
+ };
+ MlRuntime {
+ face_detection: LazySession::new(config.model_paths.face_detection.clone(), p.clone()),
+ face_embedding: LazySession::new(config.model_paths.face_embedding.clone(), p.clone()),
+ clip_image: LazySession::new(config.model_paths.clip_image.clone(), p.clone()),
++ clip_text: LazySession::new(config.model_paths.clip_text.clone(), p.clone()),
+ pet_face_detection: LazySession::new(config.model_paths.pet_face_detection.clone(), pet_policy.clone()),
+ pet_face_embedding_dog: LazySession::new(config.model_paths.pet_face_embedding_dog.clone(), pet_policy.clone()),
+ pet_face_embedding_cat: LazySession::new(config.model_paths.pet_face_embedding_cat.clone(), pet_policy.clone()),
+ pet_body_detection: LazySession::new(config.model_paths.pet_body_detection.clone(), pet_policy.clone()),
+ pet_body_embedding_dog: LazySession::new(config.model_paths.pet_body_embedding_dog.clone(), pet_policy.clone()),
+ pet_body_embedding_cat: LazySession::new(config.model_paths.pet_body_embedding_cat.clone(), pet_policy),
}
+}
+impl MlRuntime {
pub fn face_detection_session_mut(&mut self) -> MlResult<&mut Session> {
- self.face_detection
- .as_mut()
- .ok_or_else(|| {
- MlError::InvalidRequest(
- "missing model path: faceDetectionModelPath is required when runFaces is true"
- .to_string(),
- )
- })
- .map(|model| &mut model.session)
+ self.face_detection.get_mut(
+ "missing model path: faceDetectionModelPath is required when runFaces is true",
+ )
}
pub fn face_embedding_session_mut(&mut self) -> MlResult<&mut Session> {
@@@ -157,41 -101,27 +160,47 @@@
}
pub fn clip_image_session_mut(&mut self) -> MlResult<&mut Session> {
- self.clip_image
- .as_mut()
- .ok_or_else(|| {
- MlError::InvalidRequest(
- "missing model path: clipImageModelPath is required when runClip is true"
- .to_string(),
- )
- })
- .map(|model| &mut model.session)
+ self.clip_image.get_mut(
+ "missing model path: clipImageModelPath is required when runClip is true",
+ )
}
+ pub fn clip_text_session_mut(&mut self) -> MlResult<&mut Session> {
- self.clip_text
- .as_mut()
- .ok_or_else(|| {
- MlError::InvalidRequest(
- "missing model path: clipTextModelPath is required when running clip text"
- .to_string(),
- )
- })
- .map(|model| &mut model.session)
++ self.clip_text.get_mut(
++ "missing model path: clipTextModelPath is required when running clip text",
++ )
++ }
++
+ pub fn pet_face_detection_session_mut(&mut self) -> MlResult<&mut Session> {
+ self.pet_face_detection.get_mut(
+ "missing model path: petFaceDetectionModelPath is required when runPets is true",
+ )
+ }
+
+ pub fn pet_face_embedding_dog_session_mut(&mut self) -> MlResult<&mut Session> {
+ self.pet_face_embedding_dog
+ .get_mut("missing model path: petFaceEmbeddingDogModelPath is required")
+ }
+
+ pub fn pet_face_embedding_cat_session_mut(&mut self) -> MlResult<&mut Session> {
+ self.pet_face_embedding_cat
+ .get_mut("missing model path: petFaceEmbeddingCatModelPath is required")
+ }
+
+ pub fn pet_body_detection_session_mut(&mut self) -> MlResult<&mut Session> {
+ self.pet_body_detection.get_mut(
+ "missing model path: petBodyDetectionModelPath is required when runPets is true",
+ )
+ }
+
+ pub fn pet_body_embedding_dog_session_mut(&mut self) -> MlResult<&mut Session> {
+ self.pet_body_embedding_dog
+ .get_mut("missing model path: petBodyEmbeddingDogModelPath is required")
+ }
+
+ pub fn pet_body_embedding_cat_session_mut(&mut self) -> MlResult<&mut Session> {
+ self.pet_body_embedding_cat
+ .get_mut("missing model path: petBodyEmbeddingCatModelPath is required")
}
}
diff --cc mobile/packages/native_video_editor/android/.gradle/8.9/checksums/checksums.lock
index 0000000000,0000000000..d49f70773f
new file mode 100644
Binary files differ
diff --cc mobile/packages/native_video_editor/android/.gradle/8.9/checksums/md5-checksums.bin
index 0000000000,0000000000..2240074d72
new file mode 100644
Binary files differ
diff --cc mobile/packages/native_video_editor/android/.gradle/8.9/checksums/sha1-checksums.bin
index 0000000000,0000000000..599fa830ad
new file mode 100644
Binary files differ
diff --cc mobile/packages/native_video_editor/android/.gradle/8.9/dependencies-accessors/gc.properties
index 0000000000,0000000000..e69de29bb2
new file mode 100644
--- /dev/null
+++ b/mobile/packages/native_video_editor/android/.gradle/8.9/dependencies-accessors/gc.properties
diff --cc mobile/packages/native_video_editor/android/.gradle/8.9/executionHistory/executionHistory.lock
index 0000000000,0000000000..3b55188a78
new file mode 100644
Binary files differ
diff --cc mobile/packages/native_video_editor/android/.gradle/8.9/fileChanges/last-build.bin
index 0000000000,0000000000..f76dd238ad
new file mode 100644
Binary files differ
diff --cc mobile/packages/native_video_editor/android/.gradle/8.9/fileHashes/fileHashes.lock
index 0000000000,0000000000..829c4cbc26
new file mode 100644
Binary files differ
diff --cc mobile/packages/native_video_editor/android/.gradle/8.9/gc.properties
index 0000000000,0000000000..e69de29bb2
new file mode 100644
--- /dev/null
+++ b/mobile/packages/native_video_editor/android/.gradle/8.9/gc.properties
diff --cc mobile/packages/native_video_editor/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
index 0000000000,0000000000..d52fc94f3d
new file mode 100644
Binary files differ
diff --cc mobile/packages/native_video_editor/android/.gradle/buildOutputCleanup/cache.properties
index 0000000000,0000000000..8c8cff0834
new file mode 100644
--- /dev/null
+++ b/mobile/packages/native_video_editor/android/.gradle/buildOutputCleanup/cache.properties
@@@ -1,0 -1,0 +1,2 @@@
++#Mon Feb 23 16:30:23 IST 2026
++gradle.version=8.9
diff --cc mobile/packages/native_video_editor/android/.gradle/vcs-1/gc.properties
index 0000000000,0000000000..e69de29bb2
new file mode 100644
--- /dev/null
+++ b/mobile/packages/native_video_editor/android/.gradle/vcs-1/gc.properties