id
This commit is contained in:
@@ -73,14 +73,14 @@ export function PhotoPeopleList() {
|
||||
}
|
||||
|
||||
export function UnidentifiedFaces({ file }: { file: EnteFile }) {
|
||||
const [faces, setFaces] = useState<{ id: string }[]>([]);
|
||||
const [faceIDs, setFaceIDs] = useState<string[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
let didCancel = false;
|
||||
|
||||
(async () => {
|
||||
const faces = await unidentifiedFaceIDs(file);
|
||||
!didCancel && setFaces(faces);
|
||||
const faceIDs = await unidentifiedFaceIDs(file);
|
||||
!didCancel && setFaceIDs(faceIDs);
|
||||
})();
|
||||
|
||||
return () => {
|
||||
@@ -88,7 +88,7 @@ export function UnidentifiedFaces({ file }: { file: EnteFile }) {
|
||||
};
|
||||
}, [file]);
|
||||
|
||||
if (faces.length == 0) return <></>;
|
||||
if (faceIDs.length == 0) return <></>;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -96,9 +96,9 @@ export function UnidentifiedFaces({ file }: { file: EnteFile }) {
|
||||
<Legend>{t("UNIDENTIFIED_FACES")}</Legend>
|
||||
</div>
|
||||
<FaceChipContainer>
|
||||
{faces.map((face) => (
|
||||
<FaceChip key={face.id}>
|
||||
<FaceCropImageView faceID={face.id} />
|
||||
{faceIDs.map((faceID) => (
|
||||
<FaceChip key={faceID}>
|
||||
<FaceCropImageView {...{ faceID }} />
|
||||
</FaceChip>
|
||||
))}
|
||||
</FaceChipContainer>
|
||||
|
||||
@@ -13,7 +13,7 @@ export const saveFaceCrop = async (
|
||||
faceCrop.close();
|
||||
|
||||
const cache = await blobCache("face-crops");
|
||||
await cache.put(face.id, blob);
|
||||
await cache.put(face.faceID, blob);
|
||||
|
||||
return blob;
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface MinimalPersistedFileData {
|
||||
fileID: number;
|
||||
mlVersion: number;
|
||||
errorCount: number;
|
||||
faceEmbedding: { faces?: { id: string }[] };
|
||||
faceEmbedding: { faces: { faceID: string }[] };
|
||||
}
|
||||
|
||||
interface Config {}
|
||||
|
||||
@@ -212,9 +212,9 @@ const convertToNewInterface = (indexStatus: IndexStatus) => {
|
||||
*/
|
||||
export const unidentifiedFaceIDs = async (
|
||||
enteFile: EnteFile,
|
||||
): Promise<{ id: string }[]> => {
|
||||
): Promise<string[]> => {
|
||||
const mlFileData = await mlIDbStorage.getFile(enteFile.id);
|
||||
return mlFileData?.faceEmbedding.faces ?? [];
|
||||
return mlFileData?.faceEmbedding.faces.map((f) => f.faceID) ?? [];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -118,7 +118,7 @@ function LocalFileMlDataToServerFileMl(
|
||||
const faces: ServerFace[] = [];
|
||||
for (let i = 0; i < localFileMlData.faceEmbedding.faces.length; i++) {
|
||||
const face: Face = localFileMlData.faceEmbedding.faces[i];
|
||||
const faceID = face.id;
|
||||
const faceID = face.faceID;
|
||||
const embedding = face.embedding;
|
||||
const score = face.detection.probability;
|
||||
const blur = face.blurValue;
|
||||
|
||||
@@ -8,8 +8,8 @@ export interface FaceDetection {
|
||||
}
|
||||
|
||||
export interface Face {
|
||||
faceID: string;
|
||||
detection: FaceDetection;
|
||||
id: string;
|
||||
blurValue?: number;
|
||||
|
||||
embedding?: Float32Array;
|
||||
|
||||
Reference in New Issue
Block a user