Skip to content

armgit / ente

Public Imported from GitHub
0

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

Inline

Manav Rathic557e4a7a590
diff --git a/web/apps/photos/src/services/face/f-index.ts b/web/apps/photos/src/services/face/f-index.ts
index 2883eb0146..68c73172d2 100644
--- a/web/apps/photos/src/services/face/f-index.ts
+++ b/web/apps/photos/src/services/face/f-index.ts
@@ -105,27 +105,7 @@ const indexFaces_ = async (enteFile: EnteFile, imageBitmap: ImageBitmap) => {
const { width, height } = imageBitmap;
fileContext.newMlFile.imageDimensions = { width, height };
- await syncFileFaceDetections(fileContext);
-
- if (newMlFile.faces && newMlFile.faces.length > 0) {
- await syncFileFaceCrops(fileContext);
-
- const alignedFacesData = await syncFileFaceAlignments(fileContext);
-
- await syncFileFaceEmbeddings(fileContext, alignedFacesData);
-
- await syncFileFaceMakeRelativeDetections(fileContext);
- }
- newMlFile.errorCount = 0;
-
- return newMlFile;
-};
-
-const syncFileFaceDetections = async (fileContext: MLSyncFileContext) => {
- const { newMlFile } = fileContext;
- const imageBitmap = fileContext.imageBitmap;
const faceDetections = await detectFaces(imageBitmap);
- // TODO-ML(MR): reenable faces filtering based on width
const detectedFaces = faceDetections?.map((detection) => {
return {
fileId: fileContext.enteFile.id,
@@ -136,10 +116,23 @@ const syncFileFaceDetections = async (fileContext: MLSyncFileContext) => {
...detectedFace,
id: makeFaceID(detectedFace, newMlFile.imageDimensions),
}));
+ // TODO-ML(MR): reenable faces filtering based on width
// ?.filter((f) =>
// f.box.width > syncContext.config.faceDetection.minFaceSize
// );
- log.info("[MLService] Detected Faces: ", newMlFile.faces?.length);
+
+ if (newMlFile.faces && newMlFile.faces.length > 0) {
+ await syncFileFaceCrops(fileContext);
+
+ const alignedFacesData = await syncFileFaceAlignments(fileContext);
+
+ await syncFileFaceEmbeddings(fileContext, alignedFacesData);
+
+ await syncFileFaceMakeRelativeDetections(fileContext);
+ }
+ newMlFile.errorCount = 0;
+
+ return newMlFile;
};
/**