π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Tweak
Manav Rathi875fd10b5067
diff --git a/web/packages/new/photos/services/ml/clip.ts b/web/packages/new/photos/services/ml/clip.tsindex 4981a25906..e1f14cdde6 100644--- a/web/packages/new/photos/services/ml/clip.ts+++ b/web/packages/new/photos/services/ml/clip.ts@@ -178,7 +178,8 @@ export const clipMatches = async (const textEmbedding = normalized(t);const items = (await cachedOrReadCLIPIndexes()).map(({ fileID, embedding }) =>-+ // The dot product gives us cosine similarity here since both the+ // vectors are already normalized.[fileID, dotProduct(embedding, textEmbedding)] as const,);// This score threshold was obtain heuristically. 0.2 generally gives soliddiff --git a/web/packages/new/photos/services/ml/math.ts b/web/packages/new/photos/services/ml/math.tsindex ca965da0a5..9e78dcd822 100644--- a/web/packages/new/photos/services/ml/math.ts+++ b/web/packages/new/photos/services/ml/math.ts@@ -24,7 +24,7 @@ export const clamp = (value: number, min: number, max: number) =>* product. When we're computing dot products in a hot loop, skipping over that* unnecessary renormalization matters.*- * When comparing embeddings we usually want is the cosine similarity, but when+ * When comparing embeddings we usually want is the cosine similarity, but if* both the embeddings involved are already normalized, we can save the norm* calculations and directly do their `dotProduct`.*