Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix batch sizes

Manav Rathi602aa74bd956
diff --git a/web/packages/new/photos/services/ml/cluster.ts b/web/packages/new/photos/services/ml/cluster.ts
index c008c1213f..e8d3345ca8 100644
--- a/web/packages/new/photos/services/ml/cluster.ts
+++ b/web/packages/new/photos/services/ml/cluster.ts
@@ -266,11 +266,12 @@ export const clusterFaces = (
// Keep an overlap between batches to allow "links" to form with
// existing clusters.
- const batchStart = Math.max(i - lookbackSize, 0);
- const embeddingBatch = faceEmbeddings.slice(
- batchStart,
- batchStart + batchSize,
- );
+ const [batchStart, batchEnd] =
+ i < lookbackSize
+ ? [0, batchSize]
+ : [i - lookbackSize, i + batchSize];
+ const embeddingBatch = faceEmbeddings.slice(batchStart, batchEnd);
+ console.log("from", batchStart, batchEnd);
let batchClusters: EmbeddingCluster[];
if (method == "hdbscan") {