Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove normalizations

vishnukvmd52943f38ab2d
diff --git a/lib/services/semantic_search/semantic_search_service.dart b/lib/services/semantic_search/semantic_search_service.dart
index 573ac8061e..8087d28dea 100644
--- a/lib/services/semantic_search/semantic_search_service.dart
+++ b/lib/services/semantic_search/semantic_search_service.dart
@@ -1,6 +1,5 @@
import "dart:async";
import "dart:collection";
-import "dart:math";
import "package:computer/computer.dart";
import "package:logging/logging.dart";
@@ -351,13 +350,9 @@ double computeScore(List<double> imageEmbedding, List<double> textEmbedding) {
"The two embeddings should have the same length",
);
double score = 0;
- double normalization = 0, normalization2 = 0;
for (int index = 0; index < imageEmbedding.length; index++) {
score += imageEmbedding[index] * textEmbedding[index];
- normalization += imageEmbedding[index] * imageEmbedding[index];
- normalization2 += textEmbedding[index] * textEmbedding[index];
}
- score /= sqrt((normalization * normalization2));
return score;
}