diff --git a/web/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx b/web/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx index 1e62422dc..62d4a1f43 100644 --- a/web/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx +++ b/web/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx @@ -9,7 +9,7 @@ import { useCallback, useContext, useEffect, useRef, useState } from "react"; import { components } from "react-select"; import AsyncSelect from "react-select/async"; import { InputActionMeta } from "react-select/src/types"; -import { Person } from "services/face/types"; +import type { Person } from "services/face/people"; import { City } from "services/locationSearchService"; import { getAutoCompleteSuggestions, diff --git a/web/apps/photos/src/components/ml/PeopleList.tsx b/web/apps/photos/src/components/ml/PeopleList.tsx index b9ceea883..12c133915 100644 --- a/web/apps/photos/src/components/ml/PeopleList.tsx +++ b/web/apps/photos/src/components/ml/PeopleList.tsx @@ -5,7 +5,8 @@ import { Legend } from "components/PhotoViewer/styledComponents/Legend"; import { t } from "i18next"; import React, { useEffect, useState } from "react"; import mlIDbStorage from "services/face/db"; -import { Face, Person, type MlFileData } from "services/face/types"; +import type { Person } from "services/face/people"; +import type { Face, MlFileData } from "services/face/types"; import { EnteFile } from "types/file"; const FaceChipContainer = styled("div")` diff --git a/web/apps/photos/src/services/face/db.ts b/web/apps/photos/src/services/face/db.ts index 9be1a537b..e362b46d2 100644 --- a/web/apps/photos/src/services/face/db.ts +++ b/web/apps/photos/src/services/face/db.ts @@ -9,7 +9,8 @@ import { openDB, } from "idb"; import isElectron from "is-electron"; -import { Face, MlFileData, Person } from "services/face/types"; +import type { Person } from "services/face/people"; +import type { Face, MlFileData } from "services/face/types"; import { DEFAULT_ML_SEARCH_CONFIG, MAX_ML_SYNC_ERROR_COUNT, diff --git a/web/apps/photos/src/services/face/f-index.ts b/web/apps/photos/src/services/face/f-index.ts index 6224c87d3..2f806114a 100644 --- a/web/apps/photos/src/services/face/f-index.ts +++ b/web/apps/photos/src/services/face/f-index.ts @@ -5,11 +5,11 @@ import { workerBridge } from "@/next/worker/worker-bridge"; import { euclidean } from "hdbscan"; import { Matrix } from "ml-matrix"; import { Box, Dimensions, Point, enlargeBox } from "services/face/geom"; -import { +import type { Face, FaceAlignment, FaceDetection, - type MlFileData, + MlFileData, } from "services/face/types"; import { defaultMLVersion } from "services/machineLearning/machineLearningService"; import { getSimilarityTransformation } from "similarity-transformation"; diff --git a/web/apps/photos/src/services/face/people.ts b/web/apps/photos/src/services/face/people.ts index f5a073328..ddbc15953 100644 --- a/web/apps/photos/src/services/face/people.ts +++ b/web/apps/photos/src/services/face/people.ts @@ -1,9 +1,13 @@ import log from "@/next/log"; import mlIDbStorage from "services/face/db"; -import { Person } from "services/face/types"; import { clusterFaces } from "./cluster"; -import { saveFaceCrop } from "./f-index"; -import { fetchImageBitmap, getLocalFile } from "./file"; + +export interface Person { + id: number; + name?: string; + files: Array; + displayFaceId?: string; +} export const syncPeopleIndex = async () => { // TODO-ML(MR): Forced disable clustering. It doesn't currently work, @@ -83,11 +87,13 @@ export const syncPeopleIndex = async () => { : best, ); + /* Generate face crop if (personFace && !personFace.crop?.cacheKey) { const file = await getLocalFile(personFace.fileId); const imageBitmap = await fetchImageBitmap(file); await saveFaceCrop(imageBitmap, personFace); } + */ const person: Person = { id: index, diff --git a/web/apps/photos/src/services/face/transform-box.ts b/web/apps/photos/src/services/face/transform-box.ts index b62f19548..a61bb6105 100644 --- a/web/apps/photos/src/services/face/transform-box.ts +++ b/web/apps/photos/src/services/face/transform-box.ts @@ -1,5 +1,5 @@ import { Box, Point, boxFromBoundingBox } from "services/face/geom"; -import { FaceDetection } from "services/face/types"; +import type { FaceDetection } from "services/face/types"; // TODO-ML: Do we need two separate Matrix libraries? // // Keeping this in a separate file so that we can audit this. If these can be diff --git a/web/apps/photos/src/services/face/types.ts b/web/apps/photos/src/services/face/types.ts index 261fcf7fc..0a3b0119a 100644 --- a/web/apps/photos/src/services/face/types.ts +++ b/web/apps/photos/src/services/face/types.ts @@ -34,13 +34,6 @@ export interface Face { personId?: number; } -export interface Person { - id: number; - name?: string; - files: Array; - displayFaceId?: string; -} - export interface MlFileData { fileId: number; faces?: Face[]; diff --git a/web/apps/photos/src/services/machineLearning/machineLearningService.ts b/web/apps/photos/src/services/machineLearning/machineLearningService.ts index 4fcd909e3..1f6f93048 100644 --- a/web/apps/photos/src/services/machineLearning/machineLearningService.ts +++ b/web/apps/photos/src/services/machineLearning/machineLearningService.ts @@ -460,6 +460,7 @@ class ServerFaceEmbeddings { class ServerFace { public faceID: string; + // TODO-ML: singular? public embeddings: number[]; public detection: ServerDetection; public score: number; @@ -536,7 +537,7 @@ function LocalFileMlDataToServerFileMl( } as Landmark); } - // TODO: Add client UA and version + // TODO-ML: Add client UA and version const newFaceObject = new ServerFace( faceID, Array.from(embedding), diff --git a/web/apps/photos/src/services/searchService.ts b/web/apps/photos/src/services/searchService.ts index d646ecd00..4bbab115c 100644 --- a/web/apps/photos/src/services/searchService.ts +++ b/web/apps/photos/src/services/searchService.ts @@ -3,7 +3,7 @@ import log from "@/next/log"; import * as chrono from "chrono-node"; import { t } from "i18next"; import mlIDbStorage from "services/face/db"; -import { Person } from "services/face/types"; +import type { Person } from "services/face/people"; import { defaultMLVersion } from "services/machineLearning/machineLearningService"; import { Collection } from "types/collection"; import { EntityType, LocationTag, LocationTagData } from "types/entity"; diff --git a/web/apps/photos/src/types/search/index.ts b/web/apps/photos/src/types/search/index.ts index aa5f12804..33f5eba9a 100644 --- a/web/apps/photos/src/types/search/index.ts +++ b/web/apps/photos/src/types/search/index.ts @@ -1,6 +1,6 @@ import { FILE_TYPE } from "@/media/file-type"; import { IndexStatus } from "services/face/db"; -import { Person } from "services/face/types"; +import type { Person } from "services/face/people"; import { City } from "services/locationSearchService"; import { LocationTagData } from "types/entity"; import { EnteFile } from "types/file";