Face identity editing
Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
This commit is contained in:
parent
c5211a6fd7
commit
c543afdf82
@ -153,14 +153,21 @@ function getIdentities(id) {
|
|||||||
div.textContent = "Related faces " + identity.relatedFaces.length;
|
div.textContent = "Related faces " + identity.relatedFaces.length;
|
||||||
block.appendChild(div);
|
block.appendChild(div);
|
||||||
|
|
||||||
const random = Math.floor(Math.random() * identity.relatedFaces.length);
|
identity.relatedFaces.sort((a, b) => {
|
||||||
const facePhoto = createFace(identity.relatedFaces[random].faceId, identity.relatedFaces[random].photoId);
|
return a.distance - b.distance;
|
||||||
const distance = document.createElement("div");
|
});
|
||||||
distance.classList.add("distance");
|
div = document.createElement("div");
|
||||||
distance.textContent = Math.round(100 * identity.relatedFaces[random].distance) / 100;
|
div.classList.add("face-block");
|
||||||
facePhoto.appendChild(distance);
|
for (let i = 0; i < identity.relatedFaces.length && i < 4; i++) {
|
||||||
block.appendChild(facePhoto);
|
const facePhoto = createFace(identity.relatedFaces[i].faceId, identity.relatedFaces[i].photoId),
|
||||||
|
distance = document.createElement("div");
|
||||||
|
distance.classList.add("distance");
|
||||||
|
distance.textContent = identity.relatedFaces[i].distance.toFixed(2);
|
||||||
|
facePhoto.appendChild(distance);
|
||||||
|
div.appendChild(facePhoto);
|
||||||
|
}
|
||||||
|
|
||||||
|
block.appendChild(div);
|
||||||
identitiesBlock.appendChild(block);
|
identitiesBlock.appendChild(block);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -222,6 +229,10 @@ body {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
.more {
|
.more {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@ -249,6 +260,22 @@ body {
|
|||||||
filter: grayscale(100%);
|
filter: grayscale(100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.face-block {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin: 0.5em;
|
||||||
|
min-width: 128px;
|
||||||
|
max-width: 128px;
|
||||||
|
min-height: 128px;
|
||||||
|
max-height: 128px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.face-block .face {
|
||||||
|
max-width: 64px;
|
||||||
|
max-height: 64px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.face {
|
.face {
|
||||||
position: relative;
|
position: relative;
|
||||||
max-width: 128px;
|
max-width: 128px;
|
||||||
@ -270,11 +297,13 @@ body {
|
|||||||
.face .distance {
|
.face .distance {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: black;
|
background: black;
|
||||||
opacity: 0.8;
|
opacity: 0.5;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
color: white;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-row {
|
.editor-row {
|
||||||
|
@ -169,6 +169,8 @@ router.get("/:id?", (req, res) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For each face's descriptor returned for this identity, compute the distance between the
|
||||||
|
* requested photo and that face descriptor */
|
||||||
descriptors.forEach((descriptor) => {
|
descriptors.forEach((descriptor) => {
|
||||||
for (let i = 0; i < identity.relatedFaces.length; i++) {
|
for (let i = 0; i < identity.relatedFaces.length; i++) {
|
||||||
if (identity.relatedFaces[i].faceId == descriptor.faceId) {
|
if (identity.relatedFaces[i].faceId == descriptor.faceId) {
|
||||||
@ -179,6 +181,8 @@ router.get("/:id?", (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}, {
|
||||||
|
maxConcurrency: 5
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return identities;
|
return identities;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user