Add "forget" as face type
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
34960de283
commit
f6685e78e1
@ -738,6 +738,26 @@ const App = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const forgetFace = async () => {
|
||||||
|
try {
|
||||||
|
const res = await window.fetch(
|
||||||
|
`${base}/api/v1/faces`, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({
|
||||||
|
action: 'forget',
|
||||||
|
faces: selected
|
||||||
|
})
|
||||||
|
});
|
||||||
|
await res.json();
|
||||||
|
removeFacesFromIdentity(selected);
|
||||||
|
deselectAll();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const changeSelectedIdentity = async () => {
|
const changeSelectedIdentity = async () => {
|
||||||
if (selectedIdentities.length === 0) {
|
if (selectedIdentities.length === 0) {
|
||||||
window.alert('You need to select an identity first (CTRL+CLICK)');
|
window.alert('You need to select an identity first (CTRL+CLICK)');
|
||||||
@ -928,6 +948,7 @@ const App = () => {
|
|||||||
<Button onClick={guessIdentity}>Guess</Button>
|
<Button onClick={guessIdentity}>Guess</Button>
|
||||||
</>}
|
</>}
|
||||||
{ selected.length !== 0 && <>
|
{ selected.length !== 0 && <>
|
||||||
|
<Button onClick={forgetFace}>Forget</Button>
|
||||||
<Button onClick={removeFaceFromIdentity}>Remove</Button>
|
<Button onClick={removeFaceFromIdentity}>Remove</Button>
|
||||||
<Button onClick={updateFasAsNotFace}>Not a face</Button>
|
<Button onClick={updateFasAsNotFace}>Not a face</Button>
|
||||||
<Button onClick={changeSelectedIdentity}>Change Identity</Button>
|
<Button onClick={changeSelectedIdentity}>Change Identity</Button>
|
||||||
|
@ -101,6 +101,7 @@ def load_faces(db_path ):
|
|||||||
JOIN facedescriptors ON (faces.descriptorId=facedescriptors.id)
|
JOIN facedescriptors ON (faces.descriptorId=facedescriptors.id)
|
||||||
WHERE faces.identityId IS null
|
WHERE faces.identityId IS null
|
||||||
AND faces.classifiedBy != 'not-a-face'
|
AND faces.classifiedBy != 'not-a-face'
|
||||||
|
AND faces.classifiedBy != 'forget'
|
||||||
AND faces.photoId=photos.id
|
AND faces.photoId=photos.id
|
||||||
''')
|
''')
|
||||||
for row in res.fetchall():
|
for row in res.fetchall():
|
||||||
|
@ -197,6 +197,7 @@ function init() {
|
|||||||
type: Sequelize.DataTypes.ENUM(
|
type: Sequelize.DataTypes.ENUM(
|
||||||
'machine', /* DBSCAN with VGG-Face */
|
'machine', /* DBSCAN with VGG-Face */
|
||||||
'human', /* Human identified */
|
'human', /* Human identified */
|
||||||
|
'forget', /* implies "human"; identityId=NULL */
|
||||||
'not-a-face'), /* implies "human"; identityId=NULL */
|
'not-a-face'), /* implies "human"; identityId=NULL */
|
||||||
defaultValue: 'machine',
|
defaultValue: 'machine',
|
||||||
},
|
},
|
||||||
|
@ -36,27 +36,16 @@ router.put("/:id?", async (req, res/*, next*/) => {
|
|||||||
}
|
}
|
||||||
const { action } = req.body;
|
const { action } = req.body;
|
||||||
console.log(`${action}: ${faces}`);
|
console.log(`${action}: ${faces}`);
|
||||||
switch (action) {
|
if ([ 'not-a-face', 'forget' ].indexOf(action) !== -1) {
|
||||||
case 'not-a-face':
|
|
||||||
await photoDB.sequelize.query(
|
await photoDB.sequelize.query(
|
||||||
`UPDATE faces SET classifiedBy='not-a-face',identityId=NULL ` +
|
`UPDATE faces SET classifiedBy=':action',identityId=NULL ` +
|
||||||
`WHERE id IN (:faces)`, {
|
`WHERE id IN (:faces)`, {
|
||||||
replacements: { faces }
|
replacements: {
|
||||||
|
action,
|
||||||
|
faces
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/*
|
|
||||||
faces = await photoDB.sequelize.query(
|
|
||||||
'SELECT * FROM faces WHERE id IN (:faces)', {
|
|
||||||
replacements: { faces },
|
|
||||||
type: photoDB.Sequelize.QueryTypes.SELECT,
|
|
||||||
raw: true
|
|
||||||
}
|
|
||||||
);
|
|
||||||
faces.forEach(face => {
|
|
||||||
face.faceId = face.id;
|
|
||||||
delete face.id;
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
return res.status(200).json(faces);
|
return res.status(200).json(faces);
|
||||||
}
|
}
|
||||||
return res.status(400).json({ message: "Invalid request" });
|
return res.status(400).json({ message: "Invalid request" });
|
||||||
|
@ -528,10 +528,12 @@ const getUnknownIdentity = async (faceCount) => {
|
|||||||
faces AS total
|
faces AS total
|
||||||
WHERE
|
WHERE
|
||||||
total.identityId IS NULL
|
total.identityId IS NULL
|
||||||
AND total.classifiedBy != 'not-a-face') AS total
|
AND total.classifiedBy != 'not-a-face'
|
||||||
|
AND total.classifiedBy != 'forget') AS total
|
||||||
WHERE
|
WHERE
|
||||||
faces.identityId IS NULL
|
faces.identityId IS NULL
|
||||||
AND faces.classifiedBy != 'not-a-face'
|
AND faces.classifiedBy != 'not-a-face'
|
||||||
|
AND total.classifiedBy != 'forget'
|
||||||
${ limit }`;
|
${ limit }`;
|
||||||
|
|
||||||
unknownIdentity.relatedFaces = await photoDB.sequelize.query(sql, {
|
unknownIdentity.relatedFaces = await photoDB.sequelize.query(sql, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user